Good Formula Implementation
Closed this issue · 2 comments
jakobdambon commented
Be able to use formula notation like y ~ (x1 | s1 + ... + sd) + (x2 || s1 + ... + sd) + x3
to define a GP-based SVC model, where:
(x1 | s1 + ... + sd)
is a fixed and random effect (SVC) with coordinatess1
tosd
.(x1 || s1 + ... + sd)
like above, but||
indicates an SVC without fixed effect / mean.x3
is only a fixed effect without random effect (SVC)
An SVC for the intercept is only added when a 1
is provided.
reinhardfurrer commented
Gilles has implemented the formula notation in abn
. I believe it was too complicated as he has done it from scratch (dissecting the formula argument). Possibly use the standard/"stats" approach as in lm
to get the model.matrix
stuff and a second iteration for the random part. I am not much of a regexp'er, hence glancing at abn
would be inspiring for me.
jakobdambon commented
Calls with formulas are supported in the following way:
- Use the
formula
anddata
argument in theSVC_mle.formula
method - To differentiate between fixed and random effects, i.e., similar to
X
andW
matrices. Use argumentRE_formula
to provide other covariates for the random effect than the ones used by argumentformula
. By default, ifRE_formula
is not provided, the same as in the argumentformula
are used. - A model trained with a formula call stores formulas. When the
predict.SVC_mle
method is called, one can provide the data in the argumentnewdata
. Using the formulas stored in the model fit, the covariate matrices fornewX
andnewW
are constructed. - If
newX
andnewW
are already provided, they are overwritten by the covariate matrices obtained from the formulas.