shfujim
这是我的一个课后作业,自己写了计算过程,但是和答案的方差分析表有差别,自己琢磨了好半天也没结果,请网友帮忙。先谢谢大家了^_^
题目
比较4条公鱼的产鱼量,每条公鱼与3条同品种的母鱼交配受精后,得到的小鱼在两个池塘中养殖,长大后测量各个池塘的鱼的总量。
我写的计算过程如下:
data nested;
input sire $ dam $ weight;
datalines;
a1 b1 85
a1 b1 89
a1 b2 72
a1 b2 70
a1 b3 70
a1 b3 67
a1 b4 82
a1 b4 84
a2 b5 91
a2 b5 88
a2 b6 85
a2 b6 83
a2 b7 65
a2 b7 61
a3 b8 59
a3 b8 62
a3 b9 60
a3 b9 56
a3 b10 67
a3 b10 71
a4 b11 75
a4 b11 78
a4 b12 85
a4 b12 89
;
proc glm;
class sire dam;
model weight= sire dam(sire);
means sire dam(sire)/LSD Duncan Tukey;
run;
标准答案的方差分析表如下;
SS DF MS F
公鱼间 1960.50 3 653.50 6.5
公鱼内母鱼间 804.00 8 100.50 18.84
误差 64.00 12 5.3
总和 2828.50 23
shfujim
终于发现了问题所在,留下一个教训愿与大家分享:数据录入必须准确,尤其是格式!!关键是真正做数据分析时可没有参考答案的阿
汗阿
改正过来的代码如下
data nested;
input sire $ dam $ weight;
datalines;
a1 b1 85
a1 b1 89
a1 b2 72
a1 b2 70
a1 b3 70
a1 b3 67
a2 b4 82
a2 b4 84
a2 b5 91
a2 b5 88
a2 b6 85
a2 b6 83
a3 b7 65
a3 b7 61
a3 b8 59
a3 b8 62
a3 b9 60
a3 b9 56
a4 b10 67
a4 b10 71
a4 b11 75
a4 b11 78
a4 b12 85
a4 b12 89
;
proc anova;
class sire dam;
model weight= sire dam(sire);
means sire dam(sire)/LSD Duncan Tukey;
run;