BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AgReseach7
Obsidian | Level 7

I would like to have my SAS statement checked (mainly the random error). I have a randomized complete block design; lambs were separated by gender (not a trt, just used equal # of males/females per trt) and then stratified by BW within gender (trt assignments below; data collected over multiple days).

 

I'm not sure when to use sex*wtblock vs. sex  wtblock separately.

Or, do I put sex wtblock in model statement?

 

PROC MIXED;
CLASS TRT DAY ID sex wtblock;
MODEL BWkg = TRT|DAY/DDFM=KR SOLUTION;
REPEATED DAY/SUBJECT=ID TYPE = UN;
random sex wtblock;
LSMEANS TRT|DAY/DIFF ADJUST=SIMULATE (REPORT SEED=121211) cl adjdfe=row  SLICE=(DAY TRT);
RUN;QUIT;

 

ID SEX wtBLOCK TRT
3469 F 1 BLU
3454 F 1 RED
3475 F 1 MESQ
3437 F 1 CSH
3467 F 1 ERC
3401 F 1 ONE
3424 F 2 BLU
3455 F 2 MESQ
3474 F 2 RED
3426 F 2 CSH
3435 F 2 ERC
3440 F 2 ONE
3444 F 3 ERC
3464 F 3 RED
3457 F 3 MESQ
3408 F 3 BLU
3410 F 3 CSH
3423 F 3 ONE
3413 F 4 RED
3421 F 4 BLU
3451 F 4 ONE
3406 F 4 ERC
3459 F 4 CSH
3417 F 4 MESQ
3428 M 5 BLU
3448 M 5 ERC
3460 M 5 ONE
3465 M 5 CSH
3404 M 5 MESQ
3470 M 5 RED
3441 M 6 BLU
3412 M 6 ERC
3415 M 6 MESQ
3461 M 6 CSH
3476 M 6 RED
3442 M 6 ONE
3472 M 7 ERC
3463 M 7 ONE
3405 M 7 RED
3450 M 7 MESQ
3452 M 7 BLU
3407 M 7 CSH
3439 M 8 ERC
3458 M 8 ONE
3438 M 8 RED
3411 M 8 MESQ
3427 M 8 BLU
3446 M 8 CSH
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
1 ACCEPTED SOLUTION

Accepted Solutions
sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Several thoughts...

 

1. Sex is not a random effects factor; it is fixed. I recommend

http://onlinelibrary.wiley.com/doi/10.2307/1941729/abstract

for its articulation of what is fixed, what is random, and what is hard to decide.

 

2. For similar studies in the future, I would ponder a different design with respect to allocation of animals of different weights to treatments. Blocking is very crude (you lose all that information about individual weights by lumping five animals into the same group), and you are measuring weights anyway, so think about using initial weight as a covariate. Even better, consult with a statistician at your institution/company (if one is available) about design possibilities.

 

3. I recommend not applying Type I error adjustment within the LSMEANS statement to pairwise differences among interaction means, because many of the comparisons are not sensible (e.g., A1B1 to A2B3). You lose too much power that way. Pairwise comparisons among main effects means are fine. 

 

4. Assuming that I understand your design correctly, I would consider

proc mixed data=have;
  class wtblock sex trt day;
  model bwkg = sex | trt | day;
  random wtblock(sex);
  repeated day / subject= trt*wtblock(sex) type=<whatever>;
  run;

where <whatever> is CS or AR(1) or such, but not UN: your sample size is most likely too small to support all the covariance estimates (depending upon the number of DAYs). Along with the MIXED documentation on covariance structure types, I recommend 

http://onlinelibrary.wiley.com/doi/10.1002/1097-0258(20000715)19:13%3C1793::AID-SIM482%3E3.0.CO%3B2-...

 

To implement the AR(1)+RE structure described in the above paper, you would include

random trt*wtblock(sex);

Few other covariance structures include that term.

View solution in original post

1 REPLY 1
sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Several thoughts...

 

1. Sex is not a random effects factor; it is fixed. I recommend

http://onlinelibrary.wiley.com/doi/10.2307/1941729/abstract

for its articulation of what is fixed, what is random, and what is hard to decide.

 

2. For similar studies in the future, I would ponder a different design with respect to allocation of animals of different weights to treatments. Blocking is very crude (you lose all that information about individual weights by lumping five animals into the same group), and you are measuring weights anyway, so think about using initial weight as a covariate. Even better, consult with a statistician at your institution/company (if one is available) about design possibilities.

 

3. I recommend not applying Type I error adjustment within the LSMEANS statement to pairwise differences among interaction means, because many of the comparisons are not sensible (e.g., A1B1 to A2B3). You lose too much power that way. Pairwise comparisons among main effects means are fine. 

 

4. Assuming that I understand your design correctly, I would consider

proc mixed data=have;
  class wtblock sex trt day;
  model bwkg = sex | trt | day;
  random wtblock(sex);
  repeated day / subject= trt*wtblock(sex) type=<whatever>;
  run;

where <whatever> is CS or AR(1) or such, but not UN: your sample size is most likely too small to support all the covariance estimates (depending upon the number of DAYs). Along with the MIXED documentation on covariance structure types, I recommend 

http://onlinelibrary.wiley.com/doi/10.1002/1097-0258(20000715)19:13%3C1793::AID-SIM482%3E3.0.CO%3B2-...

 

To implement the AR(1)+RE structure described in the above paper, you would include

random trt*wtblock(sex);

Few other covariance structures include that term.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1706 views
  • 1 like
  • 2 in conversation