How to use Lavaan for Confirmatory Factor Analysis

This is one of my homework in Structural Equation Modeling in Fall 2017. Dr. Templin provided a excelent example showing how to perform Confirmatory Factor Analysis (CFA) using Lavaan Package. I elaborated each step as following. First, load packages needed: If you don’t have the packages installed below, please use install.packages() to install them. library(tidyverse) library(lavaan) #library(semPlot) library(psych) library(knitr) library(kableExtra) 0. Background CFA on Attitude towards Inclusive Education Survey (N = 507) The affective dimension of attitudes subscale includes 6 items on a 6-point likert scale (1 = Strongly Agree, 6 = Strongly Disagree), measuring teachers’ feelings and emotions associated with inclusive education: