write_formula: write_formula

View source: R/write_formula.R

write_formulaR Documentation

write_formula

Description

write_formula

Usage

write_formula(
  response_var = "y",
  predictor_var = NULL,
  level1_id = "stu_id",
  level2_id1 = "sch_id_1",
  level3_id1 = NULL,
  random_l1_var = NULL,
  random_l2_var = NULL,
  random_l3_var = NULL,
  intercept = "1"
)

Arguments

response_var

String. Gives the name of the response variable. Note: if the response variable is not normally distributed, the link must be included (see runMLwiN) for details. Also note: for non-normal links, a constant variable (given as "cons" or "denom" in the R2MLwiN) documentation must be added to the data and included in the link. For example: "logit(outcome, cons)".

predictor_var

A vector of strings. Gives the names of the predictor variables (fixed effects). For an unconditional model, set predictor_var = NULL.

level1_id

A string. Gives the name of the level-1 id variable.

level2_id1

A string. Gives the name of the first level-2 id variable.

level3_id1

A string. Gives the name of the first level-3 id variable.

random_l1_var

A vector of strings. Gives the names of the variables to be used to explain complex level-1 variation.

random_l2_var

A vector of strings. Gives the names of the variables to be used to explain complex level-2 variation.

random_l3_var

A vector of strings. Gives the names of the variables to be used to explain complex level-3 variation.

intercept

String. Indicates the value of the intercept. The intercept defaults to 1. As of 2-10-21, runMLwiN fails when a non-1 intercept is given. For mixed distribution or multi-category outcomes, a constant intercept can be specified using brackets: "1[1]".

Value

A formula object.

Examples

## Not run: 

write_formula("y", c("x_predictor", "z_composite"))


## End(Not run)

tessaleejohnson/corclus documentation built on Oct. 11, 2022, 3:46 a.m.