Hello all,
I have a problem in estimating a contrast in a data set where there are 2 lines, 6 year-seasons (YS), 10 animals and 1 trait (TR) in 18 observations.
The desired contrast is X1-X2 where,
X1 = (mean of Line1+mean of Line1*YS) and
X2 = (mean of Line2+mean of Line2*YS).
I calculated the result manually:
X1 is manually estimated as:
Line1 mean = (66/10) = 6.6
Mean of Line1*YS1 = (28/5) = 5.60
Mean of Line1*YS2 = (30/4) = 7.50
Mean of Line1*YS3 = (8/1) = 8.00
Then X1 = 6.6 + 5.6 + 7.5 + 8 = 27.70
X2 is manually estimated as:
Line2 mean = (48/8) = 6.00
Mean of Line2*YS1 = (20/3) = 6.67
Mean of Line2*YS2 = (19/3) = 6.33
Mean of Line2*YS3 = (9/2) = 4.50
Then X2 = 6.00 + 6.67 + 6.33 + 4.50 = 23.5
X1-X2 = 27.7-23.5 = 4.2
*/
------------------------
and by SAS as:
------------------------
title " means";
data test;
input Line YS Animal TR @@;
cards;
1 1 1 5 1 1 1 6 1 1 2 5 1 2 2 8 1 2 3 7 1 2 3 9 1 3 3 8 1 1 4 7 1 2 4 6 1 1 5 5 2 1 6 6 2 2 6 5 2 3 7 4 2 1 7 9 2 2 8 8 2 1 8 5 2 2 9 6 2 3 10 5
;
run;
proc sort data=test; by ys line;
proc means noprint data=test;
class ys line;
var tr ;
output out=test2 mean= avg_tr;
run;
proc print data=test2;
run;
data line1 line2 ; set test2;
if line=1 then output line1;
if line=2 then output line2;
run;
proc means noprint data=line1;
var avg_tr; ;
output out=test3 sum= X1;
run;
proc means noprint data=line2;
var avg_tr; ;
output out=test4 sum= X2;
run;
data final;
merge test3 test4;
diff=x1-x2;
run;
title "The desired contrast X1-X2";
proc print data=final;
run;
-----------------------------------------------------------------------------------------------------------
The result is the same by both methods, but have two problems
1-I'd like to get the standard error of the difference between the X1 and X2.
2-I think that there is a duplicated intercept in the model. How to exclude it?
Is there any suggestions?