Learn R Programming

MNP (version 1.0-4)

xmatrix.mnp: xmatrix.mnp: Generating the model matrix for the Multinomial Probit Models

Description

xmatrix.mnp.R is a function used to generate the model matrix for the Multinomial Probit models.

Usage

xmatrix.mnp(formula, data = sys.parent(), choiceX=NULL,
              cXnames=NULL, base=NULL, n.dim, lev,
              MoP=FALSE, verbose=FALSE, extra=FALSE)

Arguments

formula
A symbolic description of the model to be fit specifying the response variable and covariates. The formula should not include the choice-specific covariates. Details and specific examples are given below.
data
An optional data frame in which to interpret the variables in formula and choiceX. The default is the environment in which mprobit is called.
choiceX
An optional list containing a matrix of choice-specific covariates for each category. Details and examples are provided below.
cXnames
A vector of the names for the choice-specific covariates specified in choiceX. The details and examples are provided below.
base
Character. The base category name.
n.dim
A positive integer. The number of dimensions, i.e., the total number of alternatives minus one.
lev
The factor level for the response variable.
MoP
logical. TRUE for the Multinomial ordered Probit model, and FALSE for the standard Multinomial Probit model. The default is FALSE.
extra
logical. TRUE for generating the names for the coefficients as well as the model matrix. The default is FALSE.
verbose
logical. If TRUE, helpful messages are printed on the screen. The default is FALSE.

Value

  • If extra=TRUE, a list containing the following elements:
  • XThe model matrix.
  • coefnamesA vector of the names for the coefficients.
  • If extra=FALSE, the model matrix will be returned.

See Also

mprobit, ymatrix.mnp