Programming the statistical procedures from SAS

Need help on proc mixed?

Reply
New Contributor
Posts: 4

Need help on proc mixed?

Dear All, I am using this Proc Mixed code but I got these errors

WARNING: The R matrix depends on observation order within subjects. Omitting observations from
the analysis because of missing values can affect this matrix. Consider using a
classification effect in the REPEATED statement to determine ordering in the R matrix.
NOTE: 3 observations are not included because of missing values.
WARNING: Stopped because of infinite likelihood.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.11 seconds
cpu time 0.06 seconds

 

Here is the code that I am using

 Data duckstudyMethodEffect2;
input Farm House Method$ E2 N2 Wing Back UW Blood Lethergic Dead ;
cards;
1 1 CAI 0.000 9.667 20.333 6.333 10.333 15.667 0.000 .
1 2 CAI 0.000 2.333 26.000 13.333 9.333 21.667 0.000 .
2 3 CAI . . . . . . . .
2 4 CAI 0.000 0.000 16.000 2.000 20.000 27.333 16.000 .
3 5 CAI 0.000 1.667 24.667 9.667 29.667 38.667 0.000 .
3 6 CAI 0.000 8.667 23.667 8.667 25.000 19.000 0.000 .
1 1 TW 0.388 0.886 12.590 5.672 3.136 4.031 0.194 0.000
1 2 TW 0.000 0.103 3.139 1.092 0.800 1.557 0.000 0.069
2 3 TW . . . . . . . .
2 4 TW 0.000 1.053 1.907 0.257 1.501 2.438 0.000 0.017
3 5 TW 0.009 0.009 2.742 1.755 9.066 10.197 0.009 0.118
3 6 TW 0.000 0.000 2.105 1.661 6.376 4.341 0.000 0.000
1 1 DE . . . . . . . .
1 2 DE 0.000 1.000 7.000 1.000 1.000 2.000 0.000 0.000
2 3 DE 0.000 6.000 8.000 0.000 0.000 14.000 0.000 0.000
2 4 DE 0.000 5.000 4.000 0.000 8.000 3.000 1.000 0.000
3 5 DE 0.000 0.000 12.000 2.000 34.000 34.000 0.000 0.000
3 6 DE 0.000 0.000 4.000 6.000 32.000 22.000 0.000 0.000
1 1 LO 0.063 0.063 4.452 1.230 1.040 1.722 0.000 0.000
1 2 LO 0.000 0.035 4.471 1.802 1.014 1.369 0.000 0.139
2 3 LO 0.000 1.596 1.373 0.711 0.480 3.391 0.017 0.000
2 4 LO 0.000 1.493 2.371 0.439 1.318 4.950 0.000 0.033
3 5 LO 0.000 0.000 2.333 0.691 11.691 10.760 0.000 0.018
3 6 LO 0.000 0.000 2.444 1.479 8.907 6.550 0.000 0.000
;
Proc univariate plot normal;
Var Wing;
proc sort; by Method;
proc means; by Method;
proc mixed;
class Farm House Method;
Model Wing= House Method House*Method ;
repeated / subject=House type=cs;
parms / ols;
lsmeans House Method House*Method /adjust=tukey; ;
run;

You help is appreciated!



PROC Star
PROC Star
Posts: 404

Re: Need help on proc mixed?

I'm sure that your model is not correctly specified, but you have not provided enough information for anyone to suggest an alternative.

 

What are the roles in your study for Farm, House, and Method? Is each factor a fixed or a random effect? Are any factors nested within any other factors? What is the repeated measure factor, and what design unit is it measured on multiple times? In other words, describe your experimental design.

 

New Contributor
Posts: 4

Re: Need help on proc mixed?

Thank you for the reply!

We measured some welfare indicators for birds in each farm (total 3 farms). Each farm consisted of 2 houses so we had total 6 houses for the experiment.

I considered:

Farm as random factor

House as repeated factor

Method as fixed factor (we tested 4 different methods)

I need to know the effect of method, house, and interaction between them on the welfare indicators.

I wish I clarified what I need?

Thanks for offering help!

PROC Star
PROC Star
Posts: 404

Re: Need help on proc mixed?

Were the two houses at each farm assigned to some sort of treatment (for example, light cycle)? In other words, what do the two houses represent in your study? Does the level of house (1 or 2, 3 or 4, 5 or 6) affect the mean of the response or the variance of the response. Are you specifically interested in these 6 houses, or are they meant to represent "houses" in general?

 

Does the level of farm (1 or 2 or 3) affect the mean of the response or the variance of the response? Are you specifically interested in these 3 farms, or are they meant to represent "farms" in general?

 

I recommend this paper if you are unfamiliar with figuring out what factors are random and what factors are fixed Use and Misuse of Mixed Model Analysis of Variance in Ecological Studies It's biologically friendly Smiley Happy

 

Were there groups of birds within each house, where each group of birds was assigned to a different method? If so, were the methods assigned at the same time, or in sequence? How many birds were in each group? Were different birds assigned to different groups?

 

 

 

New Contributor
Posts: 4

Re: Need help on proc mixed?

I meant to represent houses that used in the study so I give them numbers from 1 to 6 and the level of the house does not affect the mean of response. Also for farms, I meant to represent each farm. Each house contained about 6000 birds so we visited each house in separate days when birds aged 30 days and we assessed the welfare of birds by using 4 different assessment methods (fixed factors). All of the 4 methods applied in the random order on the same day per house. I need to know how the method of assessment affects the incidence of measured welfare indicators.

 

Thank you for sharing the paper!

PROC Star
PROC Star
Posts: 404

Re: Need help on proc mixed?

So I would say that house is a random effects factor, and that method is a fixed effects factor.

 

One more question about farm: are you interested in just these 3 farms, where the level of farm determines the mean of the response rather than the variance? If so, then house is the experimental unit for the fixed effect of farm. 

New Contributor
Posts: 4

Re: Need help on proc mixed?

That is right the house is the experimental unit for the fixed effect of the farm. So how is the code will looks like?

PROC Star
PROC Star
Posts: 404

Re: Need help on proc mixed?

This is my vision of your experimental design.

 

You want to assess whether there are differences in mean response among 4 specifically-chosen methods on 3 specifically-chosen farms. Both method and farm are fixed effects factors. The experimental unit for the farm factor is a house (although clearly levels of farm cannot be randomly assigned to houses); house is a random effects factor. Repeated measures on a house (of which there are 4) are randomly assigned to method; these repeated measures units comprise a random effects factor. Essentially, this is a two-way factorial in a split-plot design.

 

So, given all this, I suggest this model:

 

/*  Fit split-plot model */
proc glimmix data= duckstudyMethodEffect2
    plots=(studentpanel boxplot(fixed student));
    class house farm method;
    model wing = farm method farm*method;
    random intercept / subject=house(farm);
    lsmeans farm method / diff adjust=simulate(seed=12345);
    lsmeans farm*method / plot=meanplot(sliceby=method join cl);
    run;

BUT!!!

 

I do not know what each method measures, and looking at the data you provided, I can see that the scale of measurement is very different for each method (for example, DE is always an integer and the other methods are not). I suspect you are trying to compare apples and oranges here, which is an activity of little value. The measurements for the different methods must have a common scale; otherwise they cannot be sensibly compared.

 

You have additional issues with these data. You do not have data for all methods in all houses. You have a lot of zero values. You have values that appear unusual relative to the other values (i.e., potential outliers). And you have the minimal level of replication (n=2 houses) so your ability to assess distributional assumptions is very limited.  

 

These analyses will be challenging. But the first challenge is to determine whether the measurement scales for the different methods are actually comparable.

 

I hope this helps.

 

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