rBNR {SurrogateRegression} | R Documentation |
Simulate Bivariate Normal Data with Missingness
Description
Function to simulate from a bivariate normal regression model with outcomes missing completely at random.
Usage
rBNR(
X,
Z,
b,
a,
t_miss = 0,
s_miss = 0,
sigma = NULL,
include_residuals = TRUE
)
Arguments
X |
Target design matrix. |
Z |
Surrogate design matrix. |
b |
Target regression coefficient. |
a |
Surrogate regression coefficient. |
t_miss |
Target missingness in [0,1]. |
s_miss |
Surrogate missingness in [0,1]. |
sigma |
2x2 target-surrogate covariance matrix. |
include_residuals |
Include the residual? Default: TRUE. |
Value
Numeric Nx2 matrix. The first column contains the target outcome, the second contains the surrogate outcome.
Examples
set.seed(100)
# Observations.
n <- 1e3
# Target design.
X <- cbind(1, matrix(rnorm(3 * n), nrow = n))
# Surrogate design.
Z <- cbind(1, matrix(rnorm(3 * n), nrow = n))
# Target coefficient.
b <- c(-1, 0.1, -0.1, 0.1)
# Surrogate coefficient.
a <- c(1, -0.1, 0.1, -0.1)
# Covariance structure.
sigma <- matrix(c(1, 0.5, 0.5, 1), nrow = 2)
# Data generation, target and surrogate subject to 10% missingness.
y <- rBNR(X, Z, b, a, t_miss = 0.1, s_miss = 0.1, sigma = sigma)
[Package SurrogateRegression version 0.6.0.1 Index]