Compute Conditional Probability of Each Observed Outcome Given Each True Outcome for a given MCMC Chain, for Every Subject
pitilde_compute_for_chains(chain_colMeans, V, n, n_cat)
pitilde_compute_for_chains
returns a matrix of conditional probabilities,
\(P(\tilde{Y}_i = \ell | Y^*_i = k, Y_i = j, V_i) = \frac{\text{exp}\{\delta_{\ell kj0} + \delta_{\ell kjV} V_i\}}{1 + \text{exp}\{\delta_{\ell kj0} + \delta_{\ell kjV} V_i\}}\)
corresponding to each subject and observed outcome. Specifically, the probability for subject \(i\) and second-stage observed category $1$ occurs at row \(i\). The probability for subject \(i\) and second-stage observed category $2$ occurs at row \(i +\)
n
.
Columns of the matrix correspond to the first-stage outcome categories \(j = 1, \dots,\)
n_cat
.
The third dimension of the array corresponds to the true outcome categories,
\(j = 1, \dots,\)
n_cat
.
A numeric vector containing the posterior means for all
sampled parameters in a given MCMC chain. chain_colMeans
must be a named
object (i.e. each parameter must be named as delta[l,k,j,p]
).
A numeric design matrix.
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, V
.
The number of categorical values that the true outcome, \(Y\), the first-stage observed outcome, \(Y^*\), and the second-stage observed outcome, \(\tilde{Y}\),\ can take.