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

Hi all,

Say you have two continuous variables, size and number of eggs laid. These are both measured once for each individual in an experiment.  Each individual belongs to a family. In addition, individuals in a family are reared on one of two food treatments (each individual is given only one of these treatments for the duration of the experiment). Family is treated as a random effect and food as a fixed effect.

I would like to know how food treatment changes the covariance parameter estimates for the two variables, with family as the subject of the covariance parameter estimates.

To produce the covariance parameter estimates for the two traits whilst ignoring food treatment my code is as follows.

A dummy variable, ‘variable’, details if a measurement is for size or number of eggs laid, with column y as the value of that variable.  ‘number’ is the specific ID given to each individual.

Proc mixed data=mylib.mydata;

Class family variable number;

y = variable;

random variable /type=un sub=family g gcorr;

repeated /type=un sub=family*number;

run;

Any suggestions would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

Observation 1: You may want to shift to PROC GLIMMIX, as I doubt strongly that egg count follows a normal distribution.  You may want to look at Example 44.5 in the PROC GLIMMIX (SAS/STAT13.2) documentation for Joint Modeling of Binary and Count Data, except here size is probably normal.  Still, the methodology should hold.

Observation 2:  This is really why you want to move to GLIMMIX.  Try something like:

proc glimmix data=yourdata;

class family variable number food;

model y=food variable food*variable / noint s dist=byobs(variable);

random _residual_/subject=number group=food;

covtest homogeneity;

run;

This treats the two y variables as coming from separate distributions (see the documentation on how to handle this), but correlated within number.  It also fits separate variances for the food groups, and through the COVTEST provides a test of homogeneity.  I would recommend a negative binomial distribution for the egg count variable.

Steve Denham

View solution in original post

3 REPLIES 3
SteveDenham
Jade | Level 19

Observation 1: You may want to shift to PROC GLIMMIX, as I doubt strongly that egg count follows a normal distribution.  You may want to look at Example 44.5 in the PROC GLIMMIX (SAS/STAT13.2) documentation for Joint Modeling of Binary and Count Data, except here size is probably normal.  Still, the methodology should hold.

Observation 2:  This is really why you want to move to GLIMMIX.  Try something like:

proc glimmix data=yourdata;

class family variable number food;

model y=food variable food*variable / noint s dist=byobs(variable);

random _residual_/subject=number group=food;

covtest homogeneity;

run;

This treats the two y variables as coming from separate distributions (see the documentation on how to handle this), but correlated within number.  It also fits separate variances for the food groups, and through the COVTEST provides a test of homogeneity.  I would recommend a negative binomial distribution for the egg count variable.

Steve Denham

DIHS
Calcite | Level 5

Many thanks for your response Steve. This essentially answers my question although something is still unclear to me.

As far as I understand, you have removed the G side random effects that I had in my original code (for family), and have left only the R side random effects (for individual). Is there a particular reason for this? As I would like to know how food changes the covariance parameter estimates for the two variables with family as the subject (not individual), is it possible to include another random statement, for family, and apply the covtest statement specifically to the family random effect?

So the random statements for GLIMMIX would look something like:

random variable  / subject = family group=food type=un;

random _residual_/subject=family(number) group=food type=un;

SteveDenham
Jade | Level 19

Sorry to be so late in replying, but vacay got in the way.

In my opinion, your two random statements would be precisely what is needed.  Hopefully you have enough data to be able to get good estimates for these.

Steve Denham

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
  • 3 replies
  • 1554 views
  • 3 likes
  • 2 in conversation