Helper function for building multivariate scglr formula.
NOTE: Interactions involving factors are not allowed for now.
For interactions between two quantitative variables, use I(x*y)
as usual.
Arguments
- Y
a formula or a vector of character containing the names of the dependent variables.
- X
a vector of character containing the names of the covariates (X) involved in the components or a list of it.
- ...
additional groups of covariates (theme)
- A
a vector of character containing the names of the additional covariates.
- additional
logical (if A is not provided, should we consider last X to be additional covariates)
- data
a data frame against which formula's variable will be checked
Value
an object of class MultivariateFormula, Formula, formula
with additional attributes: Y, X, A, X_vars, Y_vars,A_vars,XA_vars, YXA_vars, additional
Details
If Y is given as a formula, groups of covariates must be separated by |
(pipes). To declare last
group as additional covariates, one can use ||
(double pipes) as last group separator or set
additional
parameter as TRUE
.
Examples
if (FALSE) { # \dontrun{
# build multivariate formula
ny <- c("y1","y2")
nx1 <- c("x11","x12")
nx2 <- c("x21","x22")
nadd <- c("add1","add2")
form <- multivariateFormula(ny,nx1,nx2,nadd,additional=T)
form2 <- multivariateFormula(ny,list(nx1,nx2,nadd),additional=T)
form3 <- multivariateFormula(ny,list(nx1,nx2),A=nadd)
form4 <- multivariateFormula(y1+y2~x11+x12|x21+x22||add1+add2)
# Print formulas
form
form2
form3
} # }