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 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

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)


[Package pim version 2.0.2 Index]