# Bayesian

## Nominal Regression in STAN

I was talking to a colleague about modeling nominal outcomes in STAN, and wrote up this example. Just put it here in case it’s helpful for anyone (probably myself in the future).

## A Bayesian region of measurement equivalence (ROME) approach for establishing measurement invariance

The current study introduces the Bayesian region of measurement equivalence (ROME) method for visualizing and quantifying such biases. ROME estimates the most probable magnitudes of test bias for individuals with different construct scores and compares it to a predefined region of tolerable bias levels.

## What to Do If Measurement Invariance Does Not Hold? Let's Look at the Practical Significance

Measurement invariance---that a test measures the same construct in the same way across subgroups---needs to hold for subgroup comparisons to be meaningful. There has been tremendous growth in measurement invariance research in the past decade. …

## Using cmdstanr in SimDesign

library(SimDesign) library(cmdstanr) [Update: Use parallel computing with two cores.] Adapted from https://cran.r-project.org/web/packages/SimDesign/vignettes/SimDesign-intro.html See https://mc-stan.org/cmdstanr/articles/cmdstanr.html for using cmdstanr Design <- createDesign(sample_size = c(30, 60, 120, 240), distribution = c('norm', 'chi')) Design ## # A tibble: 8 × 2 ## sample_size distribution ## <dbl> <chr> ## 1 30 norm ## 2 60 norm ## 3 120 norm ## 4 240 norm ## 5 30 chi ## 6 60 chi ## 7 120 chi ## 8 240 chi Generate <- function(condition, fixed_objects = NULL) { N <- condition$sample_size dist <- condition$distribution if(dist == 'norm'){ dat <- rnorm(N, mean = 3) } else if(dist == 'chi'){ dat <- rchisq(N, df = 3) } dat } Define Bayes estimator of the mean with STAN

## Model Selection for Multilevel Modeling

Complexity of MLM Information Criteria Example Selecting Fixed Effects How to Choose Between AIC and BIC? Including Lv-2 Predictors Workflow Regularization Bibliography In social sciences, many times we use statistical methods to answer well-defined research questions that are derived from some theory or previous research.

## Confidence Intervals for Multilevel Mediation (Draft)

Quasi-Bayesian/Monte Carlo CI With the mediation Package Analytical Approaches for CI With the RMediation Package Distribution of Product of Coefficients Asymptotic Normal CI Case Bootstrap Bootstrap CI Fully Bayesian Approach With rstan Posterior (Credible) Intervals Summary Table of Different CIs: Bibliography The data are from the mediation package, which are simulated data with the source of the Education Longitudinal Study of 2002.