model.matrix.pim {pim} | R Documentation |
Create a model matrix for a probabilistic index model
Description
This function creates a model matrix for use in a probabilistic
index model. This model matrix can be passed to pim.fit
.
Usage
model.matrix(object, ...)
## S4 method for signature 'pim'
model.matrix(object, data, ...)
## S4 method for signature 'pim.formula'
model.matrix(
object,
data,
model = c("difference", "marginal", "regular", "customized"),
...
)
Arguments
object |
a |
... |
extra arguments passed to or from other methods.
This is currently only implemented in concordance with
the generic |
data |
an optional argument specifying the data frame for which
the model matrix should be constructed. See also
|
model |
a single character value with possible values "difference"
(the default), "marginal", "regular" or "customized". See also
|
Value
a design matrix for a pim model
Examples
data("FEVData")
# Create the "model frame"
FEVenv <- new.pim.env(FEVData, compare="unique")
# This includes the poset
pos <- poset(FEVenv, as.list=TRUE)
# create the formula and bind it to the pim.environment.
FEVform <- new.pim.formula(
Age ~ I(L(Height) - R(Height)) ,
FEVenv
)
# Use this formula object to construct the model matrix
# use the default model ( difference )
MM <- model.matrix(FEVform)
# Use this formula object to construct the pseudo response
Y <- response(FEVform)
# Now pim.fit can do what it does
res <- pim.fit(MM,Y, estim = "estimator.glm", penv=FEVenv)
[Package pim version 2.0.2 Index]