new.pim.env: Constructor for a pim.environment

Description Usage Arguments Details Value Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 from new.pim.poset.

compare

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.

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

classes

An optional character vector with the classes of the variables in the environment, given in the same order as the argument data.names.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

pim documentation built on March 26, 2020, 7:57 p.m.