2020/1/7做HLM的一些注意点贾良定2020/1/72HLM中选项HLMothersetting选:ControllingestimationFullmaximumlikelihood2020/1/73注意1.Restrictedmaximumlikelihood方法只评价random的方差好坏,所以会出错。对deviance产生影响2.SigR2是level1的R2.Level2的R2在variancecomponents中。3.Deviance是HLM变化的最好报告值。4.报告所有的variance相加之和,报告它的变化情况而不报告各自变化情况。5.为什么要看finalestimationoffixedeffects(withrobuststandarderrors)。主要是数据分布很难达到正态分布。Robustestimation放松了此假设。如果确信数据正态分布,看上面的表也可以。2020/1/74注意6.一般只报告shapiro-wilk值做正态分布检验7.有人说sobeltest只适合singlelevel的检验。8.Montecarlomethod适合单、跨层次的mediation检验。有样本自助法和参数自助法bootstrapping两种方法9.Proclin方法做mediationtesting2020/1/75Incrementalmodel在第1层次用grandmeancentering。Level1variance=between+within+randomLevel2variance=between+random在level1用grandmeancentering时,level1上保留了between和within的方差,又减少了randomvariance.X2X1Y1Level2Level12020/1/76Mediationalmodel若X1存在,则grandmeancentering若X1不存在,仅做X2M1,则grandmeancentering或groupmeancentering,效果一样。若X1,X2Y1,则必须用grandmeancentering。X2X1Y1Level2Level1M12020/1/77Moderationalmodel此时,level1必须用groupmeancentering.因为level1上有三部分的方差,between+within+random。此时groupmeancentering就把level1的方差干净为within+random,所以level2的X2是对withinvariance的调节。若在level1上用grandmeancentering,由level1上还存在between+within+random三部分方差。此时X2的调节作用分不清是对between的影响,还是within的影响。X2X1Y1Level2Level12020/1/78Separatemodel用groupmeancentering,与incrementalmodel相同。SPSSdatapreparationDataClean注意:有的变量名太长,另存为.sd7version时候,进入HLM不能进入mdm之中。所以,变量名不能多于8个字符。不同层次的ID:变成numeric从小到大排序2020/1/792020/1/710用HLM分析高级SPSS版本数据先将SPSS数据另存为sasv7-8,.sd7(short-term)MakenewMDMfilestatapackageinput在InputFileType中选Anythingelse(stat/transfer)2020/1/7112020/1/7122020/1/713输完第一层次的数据后,missingdataYes;runninganalysis每个层次的数据选择完成后,给mdm一个文件名,并给保存的路径MakemdmCheckStats:认真研究一下这个TXT文件的statistics,问为什么不同层次的样本是这么多?回去再看看数据。都完成了,Done:出现下面的页面2020/1/7142020/1/715这个页面叫:nullmodel2020/1/716Nullmodel:Step1inTable1ofAguinisetal.(2013,JoM),orTable2ofChangetal.(2014,JAP)只有dependentvariable,没有任何predictors;这个模型是看每个层次能够解释因变量的方差比重。RunAnalysis-run于是出现一个DOS运行页面,然后自动消失2020/1/7172020/1/718ResultsFinalestimationoffixedeffects(withrobuststandarderrors)----------------------------------------------------------------------------StandardApprox.FixedEffectCoefficientErrorT-ratiod.f.P-value----------------------------------------------------------------------------ForINTRCPT1,P0ForINTRCPT2,B00INTRCPT3,G0004.1012650.06473163.359250.000----------------------------------------------------------------------------Finalestimationoflevel-1andlevel-2variancecomponents:------------------------------------------------------------------------------RandomEffectStandardVariancedfChi-squareP-valueDeviationComponent------------------------------------------------------------------------------INTRCPT1,R00.348840.1216923165.515850.000level-1,E0.331560.10993------------------------------------------------------------------------------Finalestimationoflevel-3variancecomponents:------------------------------------------------------------------------------RandomEffectStandardVariancedfChi-squareP-valueDeviationComponent------------------------------------------------------------------------------INTRCPT1/INTRCPT2,U000.173530.030112434.322700.079------------------------------------------------------------------------------Statisticsforcurrentcovariancecomponentsmodel--------------------------------------------------Deviance=285.220776Numberofestimatedparameters=42020/1/719有三个层次的variance,wecancalculatetheDV’svarianceproportionthateachlevelcanexplain.DVtotalvariance=0.10993(L1)+0.12169(L2)+0.03011(L3)=0.26173%L1=0.10993/0.26173=42%%L2=0.12169/0.26173=46%%L3=0.03011/0.26173=12%2020/1/720Controlmodel:Step2inTable2ofChangetal.(2014,JAP)2020/1/721Randominterceptandfixedslopemodel:Step2inTable1ofAguinisetal.(2013,JoM),orStep3inTable2ofChangetal.(2014,JAP)2020/1/722RandominterceptandRandomslopemodel:Step3inTable1ofAguinisetal.(2013,JoM),orStep4inTable2ofChangetal.(2014,JAP)2020/1/723Slope(L2)varianceIntercept-slope(L2)covariance上面两个值都可以在Results中的Tau(beta)矩阵中有。注意:varianceisnotnegative;co-variancemaybenegativeorpositiveorzero.2020/1/724Cross-LevelInteraction:Randominterceptandrandomslope,Step4inTable1ofAguinisetal.(2013,JoM),orStep5or6inTable2ofChangetal.(2014,JAP)2020/1/7252020/1/726如果需要画图和计算线的slopeandtheirsignificance,需要在HLM的othersetting中的outputsetting中选择输出Variance-covariancematrix。去:去计算slopeandtheirsignificance:去画图2020/1/727