BookmarkSubscribeRSS Feed
houde030
Calcite | Level 5

I am trying to fit lactation curves for different breeds of dairy cattle using Wood's curve with an adjustment for season (s).

 

The model is:

 

y(t) = s a t^b e^-c*t 

 

My current code is:

parms a=3 b=0.25 c=-0.0016;
model milk=season*(a*time**(b)*exp(-c*time);
by breed;
output out=pred1 p=predict r=residuals;
run;

 

Code for plotting predicted values:

 

proc gplot data=pred1;
plot predict*time=breed;


run; quit;

 

However when I plot the predicted production values for separate curves for each breed the graph instead plots all 3 breeds by season. How do I get this corrected so I  get the graphs for just the breeds and not every season?

 

Here's the graph I'm getting and an example of the graph I am trying to get:

 

this is the graph I am getting that is not rightthis is the graph I am getting that is not rightHere's an example of the graph I wantHere's an example of the graph I want

Thank you

2 REPLIES 2
Sascoder
Obsidian | Level 7

Try using by statement or where clause

 

proc sort data = pred1

 by breed;

 

proc gplot data=pred1;

by breed;
plot predict*time;

 

or for more control to plot one breed at a time:

proc gplot data=pred1;

 where breed = 'A';
plot predict*time;

 

 

 

houde030
Calcite | Level 5

The code still graphs different curves for each season instead of one average curve for breed. I'm thinking there is something wrong in my Proc Nlin model. 

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