| ui_pcor | R Documentation |
This function is used to calculate uncertainty intervals for partial correlation between two variables adjusting for a set of other variables. The two variables of interest might have missing data according to the three missing data mechanisms (see reference). Data for the variables in the adjustment set should be completely observed.
ui_pcor(
out_formula,
data,
rho = c(-0.3, 0.3),
rho2 = rho,
alpha = 0.05,
gridn = 101,
gridn2 = 11
)
out_formula |
Regression formula where one variable of interest is the outcome and another variable of interest is the first predictor. Other predictors are variables in the adjustment set. |
data |
data.frame containing the variables in the formula. |
rho |
The min and the max of the sensitivity parameter. |
rho2 |
The min and the max of the sensitivity parameter |
alpha |
Significance level. Default 0.05 corresponding to a confidence level of 0.95 for CI and UI. |
gridn |
The number of distinct points for |
gridn2 |
The number of distinct points for |
In order to visualize the results, you can use plot.uipcor. In the initial publication (see reference), the sensitivity parameter is called gamma, while the function denote the sensitivity paramter as rho for the corespondence with other functions in the package.
A list containing:
call |
The matched call |
out_formula |
Regression formula where one variable of interest is the outcome and another variable of interest is the first predictor. Other predictors are variables in the adjustment set. |
out_model |
A result of a call to |
mis_formula |
Regression formula for missingness mechanism(s). |
mis_model |
A result of a call to |
rho |
The range of values for the sensitivity parameter, |
gridrho |
The values of the sensitivity parameter |
pcor, rho0 |
Estimated partial correlation assuming that the sensitivity parameter(s) is 0. |
pcor |
Estimated partial correlation for different values of the sensitivity parameter(s) in |
ident.bound |
Bounds for the estimated identification region for partial correlation. An interval from the lowest to the largest estimated partial correlation. |
pcor.se |
Standard error for different values of the sensitivity parameter(s) in |
ci.rho0 |
Confidence interval for partial correlation assuming that the sensitivity parameter(s) is 0. |
ci |
Confidence intervals for partial correlation for different values of the sensitivity parameter(s) in |
ui |
Uncertainty interval for partial correlation. An interval from the minimum lower bound to the maximum upper bound of estimated confidence intervals. |
Tetiana Gorbach
Gorbach, T., de Luna, X. (2018). Inference for partial correlation when data are missing not at random. Statistics & Probability Letters, 141, 82-89.
library(MASS)
n <- 1000
rho <- 0.1
error <- mvrnorm(n, mu = c(0, 0, 0), Sigma = diag(c(1.16, 0.028^2 * (1 - rho^2), 1)))
X3 <- rnorm(n, mean = 67, sd = 7)
X4 <- rbinom(n, 1, prob = 0.3)
X2 <- 2.313 - 0.042 * X3 - 0.216 * X4 + error[, 1]
X1 <- 1.092 + 0.01 * X2 - 0.002 * X3 - 0.006 * X4 + 0.028 * rho * error[, 3] + error[, 2]
Z <- as.numeric(2.708 + 0.548 * X2 - 0.036 * X3 - 0.042 * X4 + error[, 3] > 0)
X1[Z == 0] <- NA
data <- data.frame(X1, X2, X3, X4)
ui <- ui_pcor(
out_formula = X1 ~ X2 + X3 + X4,
data = data,
rho = c(0.1, 0.5),
alpha = 0.05,
gridn = 10
)
ui
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.