This page describes how to set up code in Mplus to fit a full structural equation model with latent variables. The model consists of three latent variables and eleven manifest variables, as described here. Mplus only reads data in text format, see this post for details on how to prepare a data file for Mplus. The data can be accessed from Github. To review, the model to be fit is the following:

This page describes how to set up code in Mplus to fit a confirmatory factor analysis (CFA) model. The model, which consists of two latent variables and eight manifest variables, is described here. Mplus only reads data in text format, see this post for details on how to prepare a data file for Mplus. The data can be accessed from Github. To review, the model to be fit is the following:

Industrialization and Democracy (Bollen, 1989) The CFA and SEM examples are taken from data analyzed in Kenneth Bollen’s (1989) book Structural Equations with Latent Variables. The goal of the model is to determine how democracy and industrialization in 1960 are associated with democracy in 1965. The problem is that there are no good single items that capture the entirety of the concepts of democracy and industrialization. Hence, these concepts are treated as latent (unobserved) variables imperfectly measured by a set of observed indicators.

From SPSS Mplus requires data to be read in from a text file without variable names, with numeric values only, and with missing data coded as a single numeric value, such as -999. A common workflow for preparing data to analyze in Mplus is to perform the variable cleaning in SPSS and then save the data as a text file. This guide shows the appropriate steps using the sample file bollen_sem.

This post will review geometric series and game theory, and discuss the prisoner’s dilemma and its importance.
What is Game Theory Game theory is the study of interdependent decisions. That is, “my optimal choice depends on what you choose, and your optimal choice depends on what I choose.” A stable state where no participant can gain an advantage through a change of strategy, assuming the other participants actions remain unchanged is a nash equilibrium.

To read and write Excel files from R, click here. To read and write SPSS, SAS and Stata files from R, click here. To read and write text files from R, click here.

This tutorial walks you through how to use the readxl package to read Microsoft Excel .xls and .xlsx file formats into R, and how to export data from R back out to an Excel format using the writexl package. readxl’s functions are related to importing Excel files into a tibble object, which is modern R’s internal data format. A tibble can then be manipulated to create summary tables or plots, run statistical tests, or perform other common analysis tasks.

Estimating HLM Models Using R: Part 1 There are a number of different R packages that now exist for fitting mixed models, including hierarchical linear models. For cross-sectional applications, perhaps the most frequently used package is lme4 (Bates et al., 2015). However, due to ambiguity in how to appropriately determine the degrees of freedom for \(t\)-tests, lme4 does not provide \(p\)-values for the fixed effects. The lmerTest package (Kuznetsova et al.

Estimating HLM Models Using R: Part 2 The Means-as-Outcomes Model After estimating the empty model, R&B develop a Means-as-Outcomes model in which a school-level variable, meanses, is added to the model for the intercept. This variable reflects the average student SES level in each school. Recall that, when fitting the empty model, we began with the following equation:
\[ Y_{ij} = \beta_{0j} + e_{ij} \]
Now the intercept can be modeled as a grand mean, \(\gamma_{00}\), plus the effect of the average SES score, \(\gamma_{01}\), plus a random error, \(u_{0j}\).

Estimating HLM Models Using R: Part 3 Random Coefficient Model Next, R&B present a model in which student-level SES is included instead of average SES, and they treat the slope of student SES as random. One complication is that R&B present results after group-mean centering student SES. Group-mean centering means that the average SES for each student’s school is subtracted from each student’s individual SES. The following creates a new, group mean centered SES variable.