Programming the statistical procedures from SAS

Proc Mixed

Reply
New Contributor
Posts: 2

Proc Mixed

[ Edited ]

Hi,

I want to run a repeated measure in proc mixed with double nest (site is nested in calf and calf is nested in tx) but I am not success to do it. Would you please to help revise my code below? with an example of data of two calves.

 

data dex1;

input calf time site $ tx $ log10cfu;

datalines;

9 -1 Ear control 0

9 -1 Eye control 0

9 -1 Nose control 0

30 7 Ear Dex 0

30 7 Eye Dex 0

30 7 Nose Dex 3.574031268

;

proc mixed method=reml covtest data=dex1;

class calf time site tx;

model log10cfu= site time tx tx*time/ddfm=satterth solution;

random calf site site*calf site*time calf*time calf*tx calf*time*tx calf*time*tx*site;

lsmeans time*tx/ alpha=0.05 cl tdiff Pdiff;

repeated time /sub= site (calf tx) type=arh(1) r rcorr;

run;

 

Many thanks for help,

 

Hussain

 

PROC Star
PROC Star
Posts: 404

Re: Proc Mixed

[ Edited ]
Posted in reply to aboalzahra1423

Consider (assuming that I understand your experimental design correctly):

 

proc mixed method=reml covtest data=dex1;
  class calf time site tx;
  model log10cfu= tx site tx*site time time*tx time*site time*tx*site / 
    ddfm=satterth solution;
  random calf(tx);
  *random site*calf(tx); /* this statement could be included with arh(1) or not; 
    for most other types, it is excluded because it is redundant to the 
    repeated statement */
  repeated time / subject=site*calf(tx) type=arh(1) r rcorr;
  lsmeans time*tx / alpha=0.05 cl tdiff Pdiff;
run;

 

In the MIXED procedure, fixed effects that are identified in the MODEL statement are not duplicated in the RANDOM statement, so you would not have site or site*time in RANDOM.

 

calf*time*tx*site should be excluded from RANDOM because it identifies the residual variance; if you include it, your model is overspecified.

 

In my opinion, some of your terms in RANDOM are either wrong (like calf, rather than calf(tx) ) or partition variance unnecessarily (like calf*time and calf*time*tx.

 

 

New Contributor
Posts: 2

Re: Proc Mixed

Thank you so much sld. I appreciate your help.

Ask a Question
Discussion stats
  • 2 replies
  • 213 views
  • 0 likes
  • 2 in conversation