From: Thx for your HELP on 21 Jun 2010 13:58 Hi, I am trying to fit an exponential curve on the following dataset. The regression results I got from excel is: SpecHum = 4.7145 * e^(0.0371*temperature) How can I replicate the regression in SAS? And also, is there a code that will automatically calculate SpecHum for the temperature I want using the outputted regression line? Any help is appreciated. Thank you very much. data test; input temperature SpecHum; datalines; 105 145 100 145 100 140 100 130 95 140 95 130 95 130 95 120 95 110 90 140 90 130 90 120 90 110 90 100 90 90 85 140 85 130 85 120 85 110 85 100 85 90 85 80 80 140 80 130 80 120 80 110 80 100 80 90 80 80 80 70 75 110 75 100 75 90 75 80 75 70 75 60 70 100 70 90 70 80 70 70 70 60 70 50 65 80 65 70 65 60 65 50 65 40 60 70 60 60 60 50 60 40 55 50 55 40 55 30 50 40 50 30 45 40 45 30 45 20 40 30 40 20 35 20 30 20 25 10 25 15 20 10 20 8 15 10 15 8 10 8 10 6 5 6 5 4 0 4 -5 4 -10 3 -10 2 -15 2 -20 2 -20 1.5 ; run;
From: FPAStatman on 21 Jun 2010 14:44 On Jun 21, 11:58 am, Thx for your HELP <jjongw...(a)gmail.com> wrote: > Hi, > > I am trying to fit an exponential curve on the following dataset. > The regression results I got from excel is: SpecHum = 4.7145 * > e^(0.0371*temperature) > How can I replicate the regression in SAS? > And also, is there a code that will automatically calculate SpecHum > for the temperature I want using the outputted regression line? > > Any help is appreciated. Thank you very much. > > data test; > input temperature SpecHum; > datalines; > > 105 145 > 100 145 > 100 140 > 100 130 > 95 140 > 95 130 > 95 130 > 95 120 > 95 110 > 90 140 > 90 130 > 90 120 > 90 110 > 90 100 > 90 90 > 85 140 > 85 130 > 85 120 > 85 110 > 85 100 > 85 90 > 85 80 > 80 140 > 80 130 > 80 120 > 80 110 > 80 100 > 80 90 > 80 80 > 80 70 > 75 110 > 75 100 > 75 90 > 75 80 > 75 70 > 75 60 > 70 100 > 70 90 > 70 80 > 70 70 > 70 60 > 70 50 > 65 80 > 65 70 > 65 60 > 65 50 > 65 40 > 60 70 > 60 60 > 60 50 > 60 40 > 55 50 > 55 40 > 55 30 > 50 40 > 50 30 > 45 40 > 45 30 > 45 20 > 40 30 > 40 20 > 35 20 > 30 20 > 25 10 > 25 15 > 20 10 > 20 8 > 15 10 > 15 8 > 10 8 > 10 6 > 5 6 > 5 4 > 0 4 > -5 4 > -10 3 > -10 2 > -15 2 > -20 2 > -20 1.5 > ; > run; One way could be: proc nlin data=test; model spechum=b1*exp(b2*temperature); parms b1=4 b2=0 ; run;
From: Thx for your HELP on 21 Jun 2010 15:12 Thanks for your help. I don't know if I am mistaken, but the code doesn't seem to replicate the regression from excel. Is there another option? Thanks again.
From: FPAStatman on 21 Jun 2010 15:48 On Jun 21, 1:12 pm, Thx for your HELP <jjongw...(a)gmail.com> wrote: > Thanks for your help. I don't know if I am mistaken, but the code > doesn't seem to replicate the regression from excel. Is there another > option? > > Thanks again. How did you get the results from Excel? That might help get similar results from SAS. The model provided by Proc NLIN has smaller squared residuals than the model you provided. (42,729.53 from your model, 20,411.68 from Proc NLIN model). I also get the same results from Proc GENMOD, so more details from Excel would be useful.
|
Pages: 1 Prev: SQL equivalent of LAST. processing How to drop unwanted columns Next: Restructure dataset |