FitBNR: Fit Bivariate Normal Regression Model

View source: R/Estimation.R

FitBNRR Documentation

Fit Bivariate Normal Regression Model

Description

Estimation procedure for bivariate normal regression models. The EM algorithm is applied if s contains missing values, or if X differs from Z. Otherwise, an accelerated least squares procedure is applied.

Usage

FitBNR(t, s, X, Z = NULL, sig = 0.05, ...)

Arguments

t

Target outcome vector.

s

Surrogate outcome vector.

X

Target model matrix.

Z

Surrogate model matrix. Defaults to X.

sig

Significance level.

...

Additional arguments accepted if fitting via EM. See FitBNEM.

Details

The target and surrogate model matrices are expected in numeric format. Include an intercept if required. Expand factors and interactions in advance.

Value

An object of class 'mnr' with slots containing the estimated regression coefficients, the target-surrogate covariance matrix, the information matrices for regression parameters, and the residuals.

Examples


# Case 1: No surrogate missingness.
set.seed(100)
n <- 1e3
X <- stats::rnorm(n)
data <- rBNR(
  X = X,
  Z = X,
  b = 1,
  a = -1,
  t_miss = 0.1,
  s_miss = 0.0
)
t <- data[, 1]
s <- data[, 2]

# Model fit.
fit_bnls <- FitBNR(
  t = t,
  s = s,
  X = X
)

# Case 2: Target and surrogate missingness.
set.seed(100)
n <- 1e3
X <- stats::rnorm(n)
Z <- stats::rnorm(n)
data <- rBNR(
  X = X,
  Z = Z,
  b = 1,
  a = -1,
  t_miss = 0.1,
  s_miss = 0.1
)

# Log likelihood.
fit_bnem <- FitBNR(
  t = data[, 1],
  s = data[, 2],
  X = X,
  Z = Z
)


zrmacc/BNEM documentation built on March 31, 2024, 12:20 a.m.