misclassification_prob {COMBO} | R Documentation |
Compute Conditional Probability of Each Observed Outcome Given Each True Outcome, for Every Subject
Description
Compute the conditional probability of observing outcome given
the latent true outcome
as
for each of the
n
subjects.
Usage
misclassification_prob(gamma_matrix, z_matrix)
Arguments
gamma_matrix |
A numeric matrix of estimated regression parameters for the
observation mechanism, |
z_matrix |
A numeric matrix of covariates in the observation mechanism.
|
Value
misclassification_prob
returns a dataframe containing four columns.
The first column, Subject
, represents the subject ID, from to
n
,
where n
is the sample size, or equivalently, the number of rows in z_matrix
.
The second column, Y
, represents a true, latent outcome category .
The third column,
Ystar
, represents an observed outcome category .
The last column,
Probability
, is the value of the equation
computed for each subject, observed outcome category, and true, latent outcome category.
Examples
set.seed(123)
sample_size <- 1000
cov1 <- rnorm(sample_size)
cov2 <- rnorm(sample_size, 1, 2)
z_matrix <- matrix(c(cov1, cov2), nrow = sample_size, byrow = FALSE)
estimated_gammas <- matrix(c(1, -1, .5, .2, -.6, 1.5), ncol = 2)
P_Ystar_Y <- misclassification_prob(estimated_gammas, z_matrix)
head(P_Ystar_Y)