#探索的因子分析修正版 x<-read.delim("clipboard") library(MASS) (res<-factanal(x[,-c(1,9,19,30)],factors=12,rotation="none",scores="promax")) #確認的因子分析 library(lavaan) library(semTools) HS.model.cfa <- ' keiken=~feskeiken+shibuyakeiken+partykeiken kyoumi=~feskyoumi+shibuyakyoumi+partykyoumi reader=~kanyu+hanasu+partykikaku money=~ishomoney+okashimoney+fesmoney yujin=~sasoinoru+yujintamesu+yujinsuisen ryuko=~ryukotoriire+tasutoriire tentou=~tento+tentosiire+tentofuan mas=~media+mediasiire+mediafuan jsns=~sns+snssiire+snsfuan event=~maturikyoumi+eventsuki syasin=~syasintouko+snsnotame+mojifujyuubun early=~newtamesu+newsyoukai+newreview ' fit<-lavaan(HS.model.cfa,data=x,auto.var=TRUE, auto.fix.first=TRUE,auto.cov.lv.x=TRUE) summary(fit, fit.measures=TRUE,standardized=T,rsquare=T) #共分散構造分析 HS.model.sem <- ' reader~early+jsns+tentou+mas+syasin+sex+event keiken~reader+jsns+tentou+mas+syasin+yujin+ryuko+event+kyoumi jsns~sex tentou~sex money~reader+kyoumi kyoumi~jsns fit.sem<-lavaan(HS.model.sem,data=x,auto.var=TRUE, auto.fix.first=TRUE,auto.cov.lv.x=TRUE) summary(fit.sem, fit.measures=TRUE,standardized=T,rsquare=T) #t検定(例) h1=matcikyoumi h2=psns t.test(x=h1,y=h2,paired=T)