FitBNR | R Documentation |
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.
FitBNR(t, s, X, Z = NULL, sig = 0.05, ...)
t |
Target outcome vector. |
s |
Surrogate outcome vector. |
X |
Target model matrix. |
Z |
Surrogate model matrix. Defaults to |
sig |
Significance level. |
... |
Additional arguments accepted if fitting via EM. See
|
The target and surrogate model matrices are expected in numeric format. Include an intercept if required. Expand factors and interactions in advance.
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.
# 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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.