
Compute Conditional Probability of Each Observed Outcome Given Each True Outcome for a given MCMC Chain, for Every Subject for 2-stage models
pistar_compute_for_chains_2stage.RdCompute Conditional Probability of Each Observed Outcome Given Each True Outcome for a given MCMC Chain, for Every Subject for 2-stage models
Arguments
- chain_colMeans
A numeric vector containing the posterior means for all sampled parameters in a given MCMC chain.
chain_colMeansmust be a named object (i.e. each parameter must be named asgamma[k,j,p]).- Z
A numeric design matrix.
- n
An integer value specifying the number of observations in the sample. This value should be equal to the number of rows of the design matrix,
Z.- n_cat
The number of categorical values that the true outcome,
Y, and the observed outcome,Y*can take.
Value
pistar_compute_for_chains returns a matrix of conditional probabilities,
\(P(Y_i^* = k | Y_i = j, Z_i) = \frac{\text{exp}\{\gamma_{kj0} + \gamma_{kjZ} Z_i\}}{1 + \text{exp}\{\gamma_{kj0} + \gamma_{kjZ} Z_i\}}\)
for each of the \(i = 1, \dots,\) n subjects. Rows of the matrix
correspond to each subject and observed outcome. Specifically, the probability
for subject \(i\) and observed category $0$ occurs at row \(i\). The probability
for subject \(i\) and observed category $1$ occurs at row \(i +\) n.
Columns of the matrix correspond to the true outcome categories \(j = 1, \dots,\) n_cat.