Hi guys,
I am trying to use incomplete Gamma function model in SAS to fit a curve for dairy cows lactaion ,but I do not know how to write this model in SAS using Proc Nlin . Can anybody please help me about this ?
How can I specify the values of a,b and c in the model?
y(t)= a t^b e^-c*t (Wood's model)
I look forward to hearing from you.
Ibrahim.
Glad you got the results you needed. I guess you discovered that the PLOTS=FIT option automatically creates the graph.
The PARMS statement sets initial guesses for the nonlinear optimization, so I guessed. You can put any numbers that you want there, especially if you have a better guess than I do. If you make a bad guess, the process might not converge. If you make a good guess, it will converge in only a few iterations.
It sounds like you want to estimate the parameters in the model for the "average cow."
But are there covariates in the model, such as age or treatment?
Please provide example data. For example, do your data look like this?
data cows;
input
cow time milk;
datalines;
1 1 1.1
1 2 1.2
1 3 1.3
1 4 1.1
2 1 1.3
2 2 1.3
2 3 1.5
2 4 1.4
3 1 0.9
3 2 1.2
3 3 1.4
3 4 1.3
4 1 1.0
4 2 1.1
4 3 1.5
4 4 1.3
;
proc sgplot data=cows;
series x=time y=milk / group=cow;
run;
The PROC NLIN documentation contains a very similar example. Here it is modified for your model, using the data that I previously posted:
proc nlin data=cows plots=fit;
parms A=1 B=0.1 C=0.2;
bounds A B C > 0;
model milk = A * time**b * exp(-C*time);
output out=Fit predicted=Pred;
run;
Hi Rick
My dataset looks like this
I have Test_day_milk kg and Test date as this form of date dd/mm/yy but I had changed to Months only in order to have 12 months in X var. And milk kg in Var Y, Also How to additivity the Parameters A,B and c which based on what?
Alos, I'm looking for a code to plot this data as a lactation curve.
my data set around 244000 records
_
|
this code working and I got results
but why
A=1 B=0.1 C=0.2 ?
sorry about that but I want to understand why you put 1 and 0.1 and 0.2 for parms
thanks
Regards
Glad you got the results you needed. I guess you discovered that the PLOTS=FIT option automatically creates the graph.
The PARMS statement sets initial guesses for the nonlinear optimization, so I guessed. You can put any numbers that you want there, especially if you have a better guess than I do. If you make a bad guess, the process might not converge. If you make a good guess, it will converge in only a few iterations.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.