Thursday, May 04, 2006

Help with SAS

When I run the analysis to calculate repeatability, I used the code:

PROC GLM data = work.gma_must_yield;
class gen env rep;
model seedcotton = gen env rep(env) gen*env/ solution;
random gen env rep(env) gen*env;
run;

This gives me a table at the end of
The GLM Procedure
Source Type III Expected Mean Square
gen Var(Error) + 80.225 Var(gen*env) + 240.67 Var(gen)
env Var(Error) + 47.117 Var(gen*env) + 126.58 Var(rep(env)) + 471.17 Var(env)

rep(env) Var(Error) + 249.89 Var(rep(env))
gen*env Var(Error) + 84.48 Var(gen*env)


If I understand correctly, the numbers preceding Var(comp) are the constants and solving for each V can be done my subtracting the correct MS, dividing by constant. Why are these constants outputted by SAS not equal to those predicted by multiplying the degrees of freedom not associated with Var(comp)?

I also tried using code:
PROC VARCOMP data = work.gma_must_yield method = reml;
class gen env rep;
model seedcotton = gen env rep(env) gen*env;
run;

and

PROC MIXED data = work.gma_must_yield method = type2 cl;
class gen env rep;
model seedcotton = ;
random gen env rep(env) gen*env;
run;

VARCOMP with reml, ml, type1, type 2 all give different estimates. REML and ML are the highest. Type 1 and Type2 are very similar and contain negative values. These match those I calculate by hand with the constants given with PROC GLM pretty close. Mixed analysis gives the same, as long as the methods are the same. What is PROC GLM using to calculate the constants? Why are they different for gen and env? Should I just ignore them and use results from PROC VARCOMP?

Why can't it all be simple?

No comments: