05-17-2018 02:48 AM
I am in need to calculate the initial and final NLLS of ai, bi, ci. With this I have the initial estimates of ai, bi, ci. I aware that the following equations would help to calculate the initial and final NLLS . However, I am struggling to write the SAS code through PROC NLIN. I would be much thankful, if anyone may help to write the SAS Code PROC NLIN.
Equation : yi = ai exp(-bi(x-ci)^2)
yi = 0.31, ai = 37, bi=3900.19, ci=0.314, x=0.291
05-17-2018 09:09 AM - edited 05-17-2018 09:17 AM
The PROC NLILN documentation contains a Getting Started example as well as more compilcated examples. To use the procedure your data set should contain MULTIPLE pairs of the (x, y) data values. A typical usage is as follows:
proc nlin data=Have; parms a=37 b=3900 c=0.3; model y = a*exp(-b*(x-c)**2); run;
However, I will point out that you can solve this problem by using PROC GENMOD (or even PROC REG). If you take the log of both sides, your model becomes
log(Y) = log(a) - b*(x-c)**2
which (if you reparametrize) is equivalent to a quadratic model for log(Y):
log(Y) = B0 + B1*x + B2*x**2
Which approach is better depends on an assumption about how the errors are distributed.