new.pim.formula {pim} | R Documentation |
Constructor for pim.formula
Description
This function reworks a formula to a pim.formula for use
in a probabilistic index model. This function is only meant
to be used internally, but is exported. It should be used only
in concordance with model.matrix.pim
Usage
new.pim.formula(formula, data, ...)
## S4 method for signature 'formula,pim.environment'
new.pim.formula(formula, data, ...)
## S4 method for signature 'formula,ANY'
new.pim.formula(formula, data, ...)
Arguments
formula |
a formula object |
data |
either a |
... |
extra arguments to |
Details
It is the constructor to be used for a pim.formula
object, and should only be used in conjunction with
model.matrix.pim
and pim.fit
as shown
in the examples.
Value
a pim.formula
object.
See Also
pim.formula-class
for more information on the
class itself. PO
, L
and R
for some
functions that can be used in a pim.formula
#' @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)