CPA <- read.delim("carpopaccident.txt") library(polycor) C1 <- hetcor(CPA[,c("REGION","CAR1990", "TA1989", "DIDP1985")])$correlations library(sem) model1 <- specifyModel(text=" CAR1990 <- DIDP1985, a TA1989 <- DIDP1985, b CAR1990 <- REGION, c CAR1990 <-> TA1989, d DIDP1985 <-> DIDP1985, NA, 1 TA1989 <-> TA1989, NA, 1 CAR1990 <-> CAR1990, NA, 1 REGION <-> REGION, NA, 1 ") res1 <- sem(model1, C1, N=47) summary(res1, fit.indices=c("GFI","AGFI","CFI","RMSEA")) library(semPlot) semPaths(res1, what="stand")