ui_pcor: Uncertainty intervals for partial correlation

View source: R/ui_pcor.R

ui_pcorR Documentation

Uncertainty intervals for partial correlation

Description

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.

Usage

ui_pcor(
  out_formula,
  data,
  rho = c(-0.3, 0.3),
  rho2 = rho,
  alpha = 0.05,
  gridn = 101,
  gridn2 = 11
)

Arguments

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 rho2 in the model for missing in the predictor of interest within missing data mechanism C. The same as rho by default.

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 rho at which confidence intervals should be constructed. Default is 101.

gridn2

The number of distinct points for rho2 at which confidence intervals should be constructed for missing data mechanism C. Default is 11.

Details

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.

Value

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 lm for the specified regression.

mis_formula

Regression formula for missingness mechanism(s).

mis_model

A result of a call to glm for probit model (s) for the missingness mechanism(s).

rho

The range of values for the sensitivity parameter, rho, for which an uncertainty interval is constructed. Default is (-0.3; 0.3).

gridrho

The values of the sensitivity parameter rho (parameters rho1 and rho2 for missing data mechanisms C) for which confidence intervals are constructed.

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

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

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

ui

Uncertainty interval for partial correlation. An interval from the minimum lower bound to the maximum upper bound of estimated confidence intervals.

Author(s)

Tetiana Gorbach

References

Gorbach, T., de Luna, X. (2018). Inference for partial correlation when data are missing not at random. Statistics & Probability Letters, 141, 82-89.

Examples

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


ui documentation built on June 25, 2026, 5:09 p.m.

Related to ui_pcor in ui...