1.研究者想了解二年級學生自評師生溫暖程度(WA_S_2)對三年級閱讀成績(reading_3)影響中,二年級教師知覺學生學習投入程度(eng_2)是否存在中介效果。
用R讀取剛剛的CSV檔,並將此資料命名為 PA
PA <- read.csv("D:/104/ML_R/WOW_data.csv",header=TRUE,sep=",")
載入套件car,將要分析的自變項進行多元共線性檢定
library(car)
Model_2<-lm(reading_3 ~ eng_2 + WA_S_2, data=PA)
vif(Model_2)
## eng_2 WA_S_2
## 1.004704 1.004704
載入套件lavaan建立中介路徑模型
library(lavaan)
model_med1<-'
WA_S_2 ~ a*eng_2
reading_3 ~ c*eng_2 + b*WA_S_2
indirect := a*b
direct := c
total := c+(a*b)
'
fit_3<-sem(model_med1,data = PA)
semre<-summary(fit_3,fit.measures=T,rsquare=T,standardized=T)
## lavaan (0.5-22) converged normally after 32 iterations
##
## Number of observations 193
##
## Estimator ML
## Minimum Function Test Statistic 0.000
## Degrees of freedom 0
## Minimum Function Value 0.0000000000000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 25.626
## Degrees of freedom 3
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1284.673
## Loglikelihood unrestricted model (H1) -1284.673
##
## Number of free parameters 5
## Akaike (AIC) 2579.346
## Bayesian (BIC) 2595.660
## Sample-size adjusted Bayesian (BIC) 2579.821
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent Confidence Interval 0.000 0.000
## P-value RMSEA <= 0.05 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## WA_S_2 ~
## eng_2 (a) 0.086 0.090 0.953 0.341 0.086 0.068
## reading_3 ~
## eng_2 (c) 9.407 1.838 5.119 0.000 9.407 0.346
## WA_S_2 (b) -1.105 1.462 -0.756 0.450 -1.105 -0.051
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .WA_S_2 0.774 0.079 9.823 0.000 0.774 0.995
## .reading_3 319.047 32.478 9.823 0.000 319.047 0.880
##
## R-Square:
## Estimate
## WA_S_2 0.005
## reading_3 0.120
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## indirect -0.095 0.160 -0.592 0.554 -0.095 -0.003
## direct 9.407 1.838 5.119 0.000 9.407 0.346
## total 9.312 1.836 5.072 0.000 9.312 0.343
載入套件繪製模型圖
library(semPlot)
semPaths(fit_3,whatLabels = "std",layout = "spring",sizeMan = 14, sizeLat = 10,nCharNodes=0,edge.label.cex = 1.8)
本例之自變項為教師評學生學習投入程度(eng_2),中介變項為學生自評師生溫暖分數(WA_S_2),依變項為閱讀表現(reading_3),該中介模型主要檢視教師評學生學習投入程度是否透過學生自評師生溫暖分數,間接影響閱讀表現。
從報表可知,在模型的直接效果上,學生學習投入程度對閱讀表現(β=0.346, t=5.119, p<.001)、教育程度對起薪(β=0.633,t=23.016,p<.001),以及起薪對目前薪資(β=0.068, t=.953,p=.341)僅有直接效果達顯著水準,換言之,每增加一個標準差的投入程度,閱讀表現就會增加0.346個標準差。此外,就解釋變異量而言,目前學生自評師生溫暖分數的變異量有0.5%被學生自評師生溫暖分數所解釋(r^2=.005),而閱讀表現的變異量則有12%被學生學習投入程度所解釋(r^2=0.12)。
date: “2016年1月23日,第一版”
author: “邱浩恩”