turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Using PROC NLIN to fit curves for dairy cattle and...

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-09-2018 05:17 PM

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:

Thank you

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to houde030

02-09-2018 05:23 PM

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;

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Sascoder

02-09-2018 05:30 PM

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.