
Last chance! 50% off unlimited learning
Sale ends in
This functions serves as a constructor for an object of the class
pim.environment
. In most cases, calling this function directly
is not necessary.
new.pim.env(data, ...)# S4 method for missing
new.pim.env(data, ...)
# S4 method for environment
new.pim.env(
data,
compare = "unique",
env = parent.frame(),
vars = NULL,
classes = NULL,
...
)
# S4 method for list
new.pim.env(data, compare = "unique", vars = NULL, ...)
# S4 method for data.frame
new.pim.env(data, compare = "unique", vars = NULL, ...)
# S4 method for ANY
new.pim.env(data, ...)
an object of the class pim.environment
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
from new.pim.poset
.
a character vector, matrix or list that defines how the
set of pseudo observations (poset) should be constructed.
if set to NULL
, no poset is constructed.
See also new.pim.poset
for more information on how to specify a custom poset.
an environment that is the parent environment of the object.
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 data
.
An optional character vector with the classes of the
variables in the environment, given in the same order as
the argument data.names
.
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.
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)
Run the code above in your browser using DataLab