Posted by
Ryan on
Feb 24, 2013; 2:31am
URL: http://spssx-discussion.165.s1.nabble.com/SPSS-error-regression-coefficient-standard-error-does-not-fit-with-significance-level-tp5718081p5718219.html
Even though I did not receive a response to my question, my guess is that some people on this list might be interested in calculating partial eta squared from a linear mixed model. For this post, I will demonstrate how to estimate partial eta squared for a fully balanced fixed effects design using two approaches.
First, let's generate some data:
*Generate Data.
set seed 98765432.
new file.
inp pro.
loop ID= 1 to 1000.
if (ID<=500) FactorA=0.
if (ID>500 and ID<=1000) FactorA=1.
if (ID<=250 | ID>750) FactorB=0.
if (ID>250 and ID<=750) FactorB=1.
comp #b0 = -1.5.
comp #b1 = 0.9.
comp #b2 = 0.5.
comp #error = rv.normal(0,1).
comp y = #b0 + #b1*FactorA + #b2*FactorB + #error.
end case.
end loop.
end file.
end inp pro.
exe.
CROSSTABS
/TABLES=FactorB BY FactorA
/FORMAT=AVALUE TABLES
/CELLS=COUNT ROW COLUMN
/COUNT ROUND CELL.
UNIANOVA y BY FactorA FactorB
/METHOD=SSTYPE(3)
/INTERCEPT=INCLUDE
/PRINT=ETASQ
/CRITERIA=ALPHA(.05)
/DESIGN=FactorA FactorB.
MIXED y BY FactorA FactorB
/FIXED=FactorA FactorB | SSTYPE(3)
/METHOD=REML.
*Calculate partial-eta squared from MIXED results using GLM partial-eta squared formula:
*Partial eta squared Factor a = Fa*DFa / (Fa*DFa + DFerror)
*Partial eta squared Factor b = Fb*DFb / (Fb*DFb + DFerror).
compute partial_eta_squared_a_GLM_formula =258.55739235480064*1 / (258.55739235480064*1 + 997) .
compute partial_eta_squared_b_GLM_formula = 77.49055195297237*1 / (77.49055195297237*1 + 997).
execute.
*Calculate partial eta squared from MIXED results using using linear mixed model formula:
*Proportion variance explained = 1 - (Full model residual variance / Reduced model residual variance)
*Note: Models employed below are based on ML estimation method.
*Fit full model.
MIXED y BY FactorA FactorB
/FIXED=FactorA FactorB | SSTYPE(3)
/METHOD=ML.
*Fit reduced model to obtain residual variance to calculate partial eta squared for Factor A.
MIXED y BY FactorB
/FIXED=FactorB | SSTYPE(3)
/METHOD=ML.
compute partial_eta_squared_a_Mixed_formula = 1 - (.9851997823936827 / 1.2406969606125673).
execute.
*Fit reduced model to obtain residual variance to calculate partial eta squared for Factor B.
MIXED y BY FactorA
/FIXED=FactorA | SSTYPE(3)
/METHOD=ML.
compute partial_eta_squared_b_Mixed_formula = 1 - (.9851997823936827 / 1.0617731775006374).
execute.
Best,
Ryan
On Tue, Feb 19, 2013 at 2:52 PM, R B
<[hidden email]> wrote:
For a fixed effects only model, or including random effects? Please post code or describe the model.On Sun, Feb 17, 2013 at 2:16 PM, Kornbrot, Diana
<[hidden email]> wrote:
Is there any simple code to obtain partial eta square for predictors in procedure mixed?
Help much appreciated
Best
Diana