R

Piping with magrittr

I have just spent a semester teaching multilevel modeling, and in the R codes I provided, I usually use the pipe operator (%>%). For example, to compute the cluster means, we can do

Weighted Least Squares

Load packages Data Polychoric Correlations lavaan OpenMx Weighted Least Squares Estimation One-factor model Standard Errors Final thoughts Recently I was working on a revision for a paper that involves structural equation modeling with categorical observed variables, and it uses a robust variant of weighted least square (also called asymptotic distribution free) estimators.

Asymptotic Standard Errors in CFA

Define True Model and Simulate Some Data Define Log-Likelihood Function Defining $$\mathcal{l}(\boldsymbol{\mathbf{\Sigma}}; S)$$ in R: MLE Asymptotic Standard Errors Using expected information Observed information (using Hessian) MLM/MLMV MLR Bibliography In our lab meeting I’m going to present the article by Maydeu-Olivares (2017), which talked about standard errors (SEs) of the maximum likelihood estimators (MLEs) in SEM models.

Bayesian MLM With Group Mean Centering

The Problem Demonstration Group mean centering with lme4 Same analyses with Bayesian using brms Group mean centering treating group means as latent variables With random slopes Using the Full Data With lme4 With Bayesian taking into account the unreliability Bibliography This post is updated on 2020-02-04 with cleaner and more efficient STAN code.

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.