View source: R/orientation_helpers.R
| infer_orientation_signs | R Documentation |
This helper analyzes observable indicators and returns a numeric vector
of 1 or -1 for use with the orientation_signs
argument in lpmec. Each sign is chosen so that the correlation
between the oriented indicator and either the outcome Y or the
first principal component of the indicators is positive.
infer_orientation_signs(Y, observables, method = c("Y", "PC1"))
Y |
Numeric outcome vector. Only used when |
observables |
A matrix or data frame of binary observable indicators. |
method |
Character string specifying how to orient the indicators.
Default is |
A numeric vector of length ncol(observables) containing
1 or -1.
set.seed(1)
Y <- rnorm(10)
obs <- data.frame(matrix(sample(c(0,1), 20, replace = TRUE), ncol = 2))
infer_orientation_signs(Y, obs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.