This code demonstrates how to use a latent class moderator to examine heterogeneity in intervention effects among adolescents receiving treatment for cannabis use. First, the code identifies latent classes of contextual and individual risk at baseline using LCA. Then, it uses an adjusted 3-step approach with BCH weights to regress the outcomes on level of care, latent class membership, the interaction between them, and covariates.