Compute Probability of Each True Mediator, for Every Subject
Compute Probability of Each True Mediator, for Every Subject
Compute the probability of the latent true mediator M∈{1,2} as P(Mi=j∣Xi)=1+exp(Xiβ)exp(Xiβ)
for each of the i=1,…,n subjects.
true_classification_prob(beta_matrix, x_matrix)
Arguments
beta_matrix: A numeric column matrix of estimated regression parameters for the true mediator mechanism, M (true mediator) ~ X (predictor matrix of interest), obtained from COMMA_EM, COMMA_PVW, or COMMA_OLS.
x_matrix: A numeric matrix of covariates in the true mediator mechanism. x_matrix should not contain an intercept.
Returns
true_classification_prob returns a dataframe containing three columns. The first column, Subject, represents the subject ID, from 1 to n, where n is the sample size, or equivalently, the number of rows in x_matrix. The second column, M, represents a true, latent mediator category M∈{1,2}. The last column, Probability, is the value of the equation P(Mi=j∣Xi)=1+exp(Xiβ)exp(Xiβ) computed for each subject and true, latent mediator category.