Learn R Programming

LCPA (version 1.0.0)

get.AvePP: Calculate Average Posterior Probability (AvePP)

Description

Computes the average posterior probability for the most likely class assignment in latent class/profile analysis. This metric quantifies classification precision. The total average posterior probability \(\geq 0.70\) (Nylund-Gibson & Choi, 2018) indicate adequate classification quality.

Usage

get.AvePP(object)

Value

A \((L+1) \times (L+1)\) matrix with the following structure:

  • Rows: Represent each latent class (1 to L) and a final "Total" row.

  • Columns: Represent each latent class (1 to L) and a final "Total" column.

  • Diagonal elements \(\text{ave}[l,l]\): Average posterior probability for observations assigned to class \(l\). That is, $$\overline{P}_{ll} = \frac{1}{N_l} \sum_{n: \hat{z}_n = l} p_{nl},$$ where \(N_l\) is the number of observations assigned to class \(l\), and \(\hat{z}_n = \arg\max_{l'} p_{nl'}\).

  • Off-diagonal elements \(\text{ave}[l,k]\) (\(l \ne k\)): Average posterior probability of class \(k\) among observations assigned to class \(l\). Useful for assessing classification confusion. $$\overline{P}_{lk} = \frac{1}{N_l} \sum_{n: \hat{z}_n = l} p_{nk}.$$

  • Bottom-right corner \(\text{ave}[L+1,L+1]\): Overall average posterior probability across all observations, $$\overline{P}_{\text{total}} = \frac{1}{N} \sum_{n=1}^N \max_{l} p_{nl}.$$

Arguments

object

An object of class "LCA" or "LPA" returned by LCA or LPA, or any object containing:

  • P.Z.Xn: \(N \times L\) matrix of posterior class probabilities, where:

    • \(N\) = Total number of observations (\(n = 1, 2, \dots, N\))

    • \(L\) = Number of latent classes (\(l = 1, 2, \dots, L\))

    • Element \(p_{nl} = P(Z_n = l \mid \mathbf{X}_n)\) denotes the posterior probability that observation \(n\) belongs to class \(l\) given observed data \(\mathbf{X}_n\)

References

Nylund-Gibson, K., & Choi, A. Y. (2018). Ten frequently asked questions about latent class analysis. Translational Issues in Psychological Science, 4(4), 440-461. https://doi.org/10.1037/tps0000176

Examples

Run this code
# Example with simulated data
set.seed(123)
data.obj <- sim.LCA(N = 500, I = 4, L = 2, IQ=0.9)
response <- data.obj$response

# Fit 2-class model with EM algorithm
# \donttest{
fit.em <- LCA(response, L = 2, method = "EM", nrep = 10)

AvePP_value <- get.AvePP(fit.em)
print(AvePP_value)

# }

Run the code above in your browser using DataLab