Mainreplacetext: Pseudo-observation formula conversion helpers

Description Usage Arguments Details Value See Also Examples

Description

Pseudo-observation formula conversion helpers

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Mainreplacetext(varn, data, verbosity = 0, leftsuffix = "_L",
  rightsuffix = "_R", interpretation = c("regular", "difference",
  "marginal", "symmetric"))

LHSreplacetext(varn, data, verbosity = 0, leftsuffix = "_L",
  rightsuffix = "_R", interpretation = c("regular", "difference",
  "marginal", "symmetric"), lhs = c("PO", "<", "<="))

Freplacetext(varn, data, verbosity = 0, leftsuffix = "_L",
  rightsuffix = "_R", interpretation = c("regular", "difference",
  "marginal", "symmetric"))

Oreplacetext(varn, data, verbosity = 0, leftsuffix = "_L",
  rightsuffix = "_R", interpretation = c("regular", "difference",
  "marginal", "symmetric"))

Lreplacetext(varn, data, verbosity = 0, leftsuffix = "_L",
  rightsuffix = "_R", interpretation = c("regular", "difference",
  "marginal", "symmetric"))

Rreplacetext(varn, data, verbosity = 0, leftsuffix = "_L",
  rightsuffix = "_R", interpretation = c("regular", "difference",
  "marginal", "symmetric"))

Arguments

varn

character holding the variable (column) name that will be considered.

data

Context where the column name can be interpreted

verbosity

The higher this value, the more levels of progress and debug information is displayed (note: in R for Windows, turn off buffered output)

leftsuffix, rightsuffix

Suffixes that will be added to the 'left' and 'right' observation's column name in the pseudo-observation. Note: no checking is done that these suffixes are safe, so the wrong suffixes may lead to unexpected behaviour.

interpretation

If "marginal" (not the default) parts of the formula are converted to imply marginal pim modeling (see e.g. Mainreplacetext). If it is "difference", then the design matrix of the PIM is the difference of the design matrices of each part of the pseudo-observations. The default option is "regular", which will interpret unaltered columns as differences. A new option is "symmetric", which works the same as "regular", but will enforce the symmetry condition by making the sign switch when changing the order (typically, this is achieved by subtracting the inverse for each dummy).

lhs

"PO", "<" or "<=": Unequality used for the lefthandside of the formula. The default ("PO") is the normal probabilistic index.

Details

Each of these functions (except Mainreplacetext) takes parts of a formula like "L(somevar)" and turns it into the matching formula text for pseudo-observations.

The replacement texts currently look like this for each of the functions (assuming the default suffixes, and where relevant X a three-level (ordered) factor):

The above is valid for interpretation "regular". For interpretation "symmetric", here are the different results:

Please note that these replacements will only work for column names present in data, and not for "calculated" columns. Trying this will likely result in unpredictable behaviour or errors.

Value

A vector of at least two character values. The first one is the "find" text, the second one holds the "replace" text. Depending on the function, this may or may not hold regular expressions. What comes after these first two items are more character values. the first half of these represent the expected names of the resulting columns in the design matrix, the second half are (in the same order) somewhat cleaned up names for them.

See Also

pimformula

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
iris$Spord<-as.ordered(iris$Species)
Mainreplacetext("Sepal.Length", iris, verbosity=1)
LHSreplacetext("Sepal.Length", iris, verbosity=1)
Freplacetext("Species", iris, verbosity=1)
Oreplacetext("Spord", iris, verbosity=1)
Lreplacetext("Sepal.Length", iris, verbosity=1)
Rreplacetext("Sepal.Length", iris, verbosity=1)
Mainreplacetext("Sepal.Length", iris, verbosity=1, interpretation="marginal")
LHSreplacetext("Sepal.Length", iris, verbosity=1, interpretation="marginal")
Freplacetext("Species", iris, verbosity=1, interpretation="marginal")
Oreplacetext("Spord", iris, verbosity=1, interpretation="marginal")
Lreplacetext("Sepal.Length", iris, verbosity=1, interpretation="marginal")
Rreplacetext("Sepal.Length", iris, verbosity=1, interpretation="marginal")

pimold documentation built on May 2, 2019, 5:50 p.m.