## Path analysis exercise -- Using sem cd("C:/Dropbox/Documents/SCS/CFA-SEM course/exercises") path <- read.csv("path.csv") library(sem) path.sem1 <- specifyEquations(text=" col = beta1*hs gre = beta2*col grad = beta3*col + beta4*gre ") path.fit1 <- sem::sem(path.sem1, data=path, fixed.x=c("hs", "col") ) path.fit1 summary(path.fit1) modIndices(path.fit1) # just identified model: add path for gre <- hs path.sem2 <- specifyEquations(text=" gre = beta1*hs + beta2*col grad = beta3*hs + beta4*col + beta5*gre ") path.fit2 <- sem::sem(path.sem2, data=path, fixed.x=c("hs", "col") ) path.fit2 summary(path.fit1)