BookmarkSubscribeRSS Feed
linaya
Calcite | Level 5

Hello,

 

I am working on trying to determine what is the minimum amount of data needed to accurately predict milk production in late lactation for cows. To do this, I am using a lactation model and fitting the model using daily milk yields of individual cows. I am fitting the model using data from only the first 30, 60 and 90 days in milk (dim). Then, using the parameters yielded from each of these fittings, predicting daily milk yields up to each cow's maximum day in milk. 

 

Using proc nlin, I can solve for the model parameters for each fitting. However, when it comes to making the predictions for daily milk yields up to each cow's maximum day in milk (dim), Ive just been putting the parameters outputted from SAS into excel, creating an equation with the parameters and solving for the dependent variable (milk yield (my)). Is there a way to do this in SAS that will yield the daily milk yield predictions, as well as their associated prediction intervals and residuals? 

 

This is the coding I have so far:

Data lact;
Input cow parity dim my;

datalines;

4 1 1 15.6

4 1 2 16.8;

...

4 1 350 12.3

run;

proc sort data = lact;
by cow parity dim;

proc summary data = lact;
by cow parity;
output
out = max_dim (drop = _TYPE_ _FREQ_)
max(dim) = max_dim;

data lact_max;
merge lact max_dim;
by cow parity;

proc nlin
data = lact_max (where = DIM < 31)
totalSS
method = marquardt
maxiter=1000;
by cow parity;


parms
Mo = 10 to 35 by 5
uT = 0.02 to 0.07 by 0.01
k = 0.02 to 0.07 by 0.01
L = 0.001 to 0.003;
model my = Mo*exp(uT*(1-exp(-k*DIM))/k-L*DIM);
bounds
0 < uT< 1,
0 < k < 1;
output
out = predictions
parms = Mo uT k L
predicted = pred
student = sresid
r = residuals
h= leverage
u95=upper
l95=lower
SSE=sumsquares;
run;

 

1 REPLY 1
Ksharp
Super User

A week ago, @Rick_SAS wrote a blog about fitting a growth curve by logistic function.

Maybe he could give you a hint .

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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