Description Usage Arguments Details Value See Also Examples
Pseudo-observation formula conversion helpers
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"))
|
varn |
|
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 |
lhs |
|
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):
X
becomes X_R
if interpretation
is "marginal"
, and I(as.numeric(X_R)-as.numeric(X_L))
otherwise
F(X)
becomes (I(as.numeric(X_R=="lvl1"))+I(as.numeric(X_R=="lvl2"))+I(as.numeric(X_R=="lvl3")))
if interpretation
is "marginal"
, and ( I(as.numeric(X_L=="lvl1"&X_R=="lvl2"))+I(as.numeric(X_L=="lvl1"&X_R=="lvl3"))+I(as.numeric(X_L=="lvl2"&X_R=="lvl3")))
otherwise
O(X)
becomes I(as.numeric(as.numeric(X_L)<as.numeric(X_R)))
L(X)
becomes X_L
R(X)
becomes X_R
Y
on the left hand side becomes I(as.numeric(as.numeric(X_L)<as.numeric(X_R)))
,
I(as.numeric(as.numeric(X_L)==as.numeric(X_R)))
or
I(as.numeric(as.numeric(X_L)<as.numeric(X_R)) + 0.5*as.numeric(as.numeric(X_L)==as.numeric(X_R)))
depending on lhs
The above is valid for interpretation "regular". For interpretation "symmetric", here are the different results:
F(X)
becomes I((as.numeric(X_L="lvl1"&X_R=="lvl2"))-(as.numeric(X_R=="lvl1"&X_L=="lvl2")))
(summed for all ordered combinations of levels)
O(X)
becomes I(as.numeric(as.numeric(X_L)<as.numeric(X_R))-as.numeric(as.numeric(X_R)<as.numeric(X_L)))
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.
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.
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.