BookmarkSubscribeRSS Feed
Chris_Poulos
Calcite | Level 5

I'm looking for some help nesting factors.

 

I have the following experiment design:

 

Four Treatments

Four pens per treatment

Four sampled animals per pen

3 samples measured per animal, sometimes just two samples measured, at the same time point.

 

Previously, I have only take one sample per animal, and my mode and random statement with nesting looks something like

 

Model = Treatment / cl;

Random Pen(Treatment);

 

I'm wondering how I could work Animal into that statement.  Maybe Animal*Pen(Treatment), or Animal (Pen Treatment) ?

 

Furthermore, when I write out a linear model equation, I would represent the Pen(Treatment) as uij

 

u for random effect of j pen for i treatment

 

How would I properly state it if I incorporated Animal?

 

uija, with a for animal maybe?

 

I look forward to any thoughts on this would be appreciated.  Apologies if my stats language is a bit imprecise.  Too much veterinary medicine and not enough math in my life.

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

Assuming that treatment is the only fixed effect:

class treatment pen animal;
model y = treatment; random pen(treatment)   animal*pen(treatment);

Given how SAS expands syntax, there are equivalent ways to identify a random effect in this model:

"pen(treatment)" == "pen*treatment"

"animal*pen(treatment)" == "animal*pen*treatment" == "animal(pen treatment)"

 

Equation-wise, something like (without going to the trouble of proper symbols)

 

y_ijkm = mu + t_i + p_ij + a_k(ij) + e_m(ijk)

 

where i indexes treatment t

j indexes pen p

k indexes animal a

m indexes sample e (residual error)

 

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
  • 1276 views
  • 0 likes
  • 2 in conversation