schooldata <- read.csv("~/Desktop/test.csv", header=TRUE)
schoolcov <- cov(schooldata)
model.school <- specify.model()
f1 -> tchint, NA, 1
f1 -> tchgood, lam21, NA
f1 -> listen, lam31, NA
f1 -> tchprais, lam41, NA
f1 -> getalong, lam51, NA
f1 -> fair, NA
f1 -> spirit, lam72,NA
f1 -> racefrnd, lam82, NA
f2 -> studown, lam92, NA, 1
f2 -> tchdown, lam102, NA
f2 -> feelsafe, lam112, NA
f3 -> impede, lam123, NA, 1
f3 -> misbehav, lam133, NA
f3 -> disrupt, lam143, NA
f3 -> strict, lam153, NA
f1 <-> f1, ph1, NA
f2 <-> f2, ph2, NA
f3 <-> f3, ph3, NA
f1 <-> f2, ph21, NA
f1 <-> f3, ph31, NA
f2 <-> f3, ph32, NA
tchint <-> tchint, th1, NA
tchgood <-> tchgood, th2, NA
listen <-> listen, th3, NA
tchprais <-> tchprais,th4, NA
getalong <-> getalong, th5, NA
fair <-> fair, th6, NA
spirit <-> spirit, th7,NA
racefrnd <-> racefrnd, th8, NA
studown <-> studown, th9, NA
tchdown <-> tchdown, th10, NA
feelsafe <-> feelsafe, th11, NA
impede <-> impede, th12, NA
misbehav <-> misbehav, th13, NA
disrupt <-> disrupt, th14, NA
strict <-> strict, th15, NA
sem.model.school <- sem(model.school, schoolcov, 100)
 
summary(sem.model.school)
 
std.school <- standardized.coefficients(sem.model.school)
 
