StatsModels R-like formula for a general quadratic model

Doesn’t seem to say in the manual Modeling tabular data · StatsModels.jl

But I was curious.

I think you can do it via constructing terms directly.

using Base.Iterators
function allinteractions(terms::Vector{Symbol})
    tmp = sum(Term.(terms))
    tmp + sum([t1&t2 for(t1, t2) in Iterators.product(tmp, tmp)])
end

formula = Term(:y)~allinteractions([:a, :b, :c])
using GLM
lm(formula, df)
3 Likes