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
new.pim.formula(formula, data, ...)# S4 method for formula,pim.environment
new.pim.formula(formula, data, ...)
# S4 method for formula,ANY
new.pim.formula(formula, data, ...)
a formula object
either a pim.environment
object containing the
data for the pim, or an object that can be converted to a
pim.environment
by new.pim.env
extra arguments to new.pim.env
a pim.formula
object.
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.
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)