multivariateFormula: Formula construction

Description Usage Arguments Details Value Examples

View source: R/multivariateFormula.r

Description

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.

Usage

1
2
multivariateFormula(Y, X = NULL, ..., A = NULL, additional = NULL,
  data = NULL)

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

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.

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# 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

## End(Not run)

SCGLR documentation built on May 1, 2019, 8 p.m.