
Generate Data from an Ordered Logistic or Probit Regression
node_polr.RdData from the parents is used to generate the node using by first calculating the linear predictor. An appropriately distributed random error term is then added. The resulting latent variable is categorized at user-specified cutpoints to obtain the resulting ordered factor.
Usage
node_polr(data, parents, formula=NULL, betas,
cutpoints, link="logistic", labels=FALSE,
output="factor")Arguments
- data
A
data.table(or something that can be coerced to adata.table) containing all columns specified byparents.- parents
A character vector specifying the names of the parents that this particular child node has. If non-linear combinations or interaction effects should be included, the user may specify the
formulaargument instead.- formula
An optional
formulaobject to describe how the node should be generated orNULL(default). If supplied it should start with~, having nothing else on the left hand side. The right hand side may contain any valid formula syntax, such asA + BorA + B + I(A^2), allowing non-linear effects. If this argument is defined, there is no need to define theparentsargument. For example, usingparents=c("A", "B")is equal to usingformula= ~ A + B. Contrary to thenode_gaussian,node_binomialandnode_poissonnode types, random effects and random slopes are currently not supported here.- betas
A numeric vector with length equal to
parents, specifying the causal beta coefficients used to generate the node.- cutpoints
A numeric vector containing the points at which the underlying latent variable is cut to produce the ordered factor. In general,
length(cutpoints) + 1categories will be produced.- link
The link function describing the distribution of the error term. Allowed values are
"logistic","probit","loglog","cloglog"and"cauchit", mirroring themethodargument in thepolrfunction.- labels
Labels for the levels of the resulting categories. By default (
labels = FALSE), simple integer codes are returned. Corresponds to the argument of the same name in thecutfunction.- output
A single character string specifying the kind of output that should be returned. Defaults to
"factor", but may also be set to"character".
Details
This node type currently does not support inclusion of random effects or random slopes in the formula.