COMBO_EM_2stage {COMBO} | R Documentation |
EM-Algorithm Estimation of the Two-Stage Binary Outcome Misclassification Model
Description
Jointly estimate \beta
, \gamma^{(1)}
, \gamma^{(2)}
parameters from the true outcome,
first-stage observation, and second-stage observation mechanisms, respectively,
in a two-stage binary outcome misclassification model.
Usage
COMBO_EM_2stage(
Ystar1,
Ystar2,
x_matrix,
z1_matrix,
z2_matrix,
beta_start,
gamma1_start,
gamma2_start,
tolerance = 1e-07,
max_em_iterations = 1500,
em_method = "squarem"
)
Arguments
Ystar1 |
A numeric vector of indicator variables (1, 2) for the first-stage observed
outcome |
Ystar2 |
A numeric vector of indicator variables (1, 2) for the second-stage
observed outcome |
x_matrix |
A numeric matrix of covariates in the true outcome mechanism.
|
z1_matrix |
A numeric matrix of covariates in the first-stage observation mechanism.
|
z2_matrix |
A numeric matrix of covariates in the second-stage observation mechanism.
|
beta_start |
A numeric vector or column matrix of starting values for the |
gamma1_start |
A numeric vector or matrix of starting values for the |
gamma2_start |
A numeric array of starting values for the |
tolerance |
A numeric value specifying when to stop estimation, based on
the difference of subsequent log-likelihood estimates. The default is |
max_em_iterations |
An integer specifying the maximum number of
iterations of the EM algorithm. The default is |
em_method |
A character string specifying which EM algorithm will be applied.
Options are |
Value
COMBO_EM_2stage
returns a data frame containing four columns. The first
column, Parameter
, represents a unique parameter value for each row.
The next column contains the parameter Estimates
, followed by the standard
error estimates, SE
. The final column, Convergence
, reports
whether or not the algorithm converged for a given parameter estimate.
Estimates are provided for the two-stage binary misclassification model.
Examples
set.seed(123)
n <- 1000
x_mu <- 0
x_sigma <- 1
z1_shape <- 1
z2_shape <- 1
true_beta <- matrix(c(1, -2), ncol = 1)
true_gamma1 <- matrix(c(.5, 1, -.5, -1), nrow = 2, byrow = FALSE)
true_gamma2 <- array(c(1.5, 1, .5, .5, -.5, 0, -1, -1), dim = c(2, 2, 2))
my_data <- COMBO_data_2stage(sample_size = n,
x_mu = x_mu, x_sigma = x_sigma,
z1_shape = z1_shape, z2_shape = z2_shape,
beta = true_beta, gamma1 = true_gamma1, gamma2 = true_gamma2)
table(my_data[["obs_Ystar2"]], my_data[["obs_Ystar1"]], my_data[["true_Y"]])
beta_start <- rnorm(length(c(true_beta)))
gamma1_start <- rnorm(length(c(true_gamma1)))
gamma2_start <- rnorm(length(c(true_gamma2)))
EM_results <- COMBO_EM_2stage(Ystar1 = my_data[["obs_Ystar1"]],
Ystar2 = my_data[["obs_Ystar2"]],
x_matrix = my_data[["x"]],
z1_matrix = my_data[["z1"]],
z2_matrix = my_data[["z2"]],
beta_start = beta_start,
gamma1_start = gamma1_start,
gamma2_start = gamma2_start)
EM_results