new.pim.env {pim} | R Documentation |
Constructor for a pim.environment
Description
This functions serves as a constructor for an object of the class
pim.environment
. In most cases, calling this function directly
is not necessary.
Usage
new.pim.env(data, ...)
## S4 method for signature 'missing'
new.pim.env(data, ...)
## S4 method for signature 'environment'
new.pim.env(
data,
compare = "unique",
env = parent.frame(),
vars = NULL,
classes = NULL,
...
)
## S4 method for signature 'list'
new.pim.env(data, compare = "unique", vars = NULL, ...)
## S4 method for signature 'data.frame'
new.pim.env(data, compare = "unique", vars = NULL, ...)
## S4 method for signature 'ANY'
new.pim.env(data, ...)
Arguments
data |
a data frame, a list or an environment containing the data for a probabilistic index model. |
... |
extra parameters for construction of the poset, like
the argument |
compare |
a character vector, matrix or list that defines how the
set of pseudo observations (poset) should be constructed.
if set to |
env |
an environment that is the parent environment of the object. |
vars |
An optional character vector with the names of the variables
that should be included in the pim environment. Note that the
variable names should be found in the object passed to argument |
classes |
An optional character vector with the classes of the
variables in the environment, given in the same order as
the argument |
Details
This function is called during the preparation of the model matrix for a pim. The resulting object is used to evaluate the formula of a pim, and stores information on how this is done.
Note that the parent of the environment is actually the
pim.poset
object in the poset
slot.
The parent you set using the env
argument,
is the parent of the pim.poset
object. This ensures that
when a formula is evaluated in the pim.environment
it
will use a suitable search path to find all functions and objects.
Value
an object of the class pim.environment
Examples
new.pim.env() # Creates an empty object
# Starting from a data frame
data(DysData)
env1 <- new.pim.env(DysData)
env2 <- new.pim.env(DysData, compare=NULL)
poset(env2)
env3 <- new.pim.env(DysData, compare="all")
poset(env3)
data(FEVData)
env4 <- new.pim.env(FEVData, vars=c('Age','Sex'))
ls(env4)