BookmarkSubscribeRSS Feed
Lorezo
Calcite | Level 5

Hi,

 

Sorry for the potentially novice question but I am stumped on how to plot an exponential decay curve for my data. In addition to this, I also wanted to run analysis on my data with this model but predicting parameters and also p values and r^2 values.

 

Through digging online and such I came up with this set of code where I predicted starting parameters. I am hoping someone may have an easier solution and can help me run the analysis with my data.

 

data hosp;
input time sa @@;
infile datalines dlm='09'x;
datalines;

0 84.46011014
0 84.70962302
0 80.96692981
0 82.96303286
1 95.06440758
1 93.69208673
1 85.20864879
1 76.97472372
1.5 59.88309139
1.5 64.62383612
1.5 68.61604221
1.5 55.14234665
2 82.4640071
2 68.61604221
2 67.74274713
2 57.88698834
3 94.19111249
3 75.72715932
3 78.97082677
3 77.34899304
4 78.47180101
4 55.01759021
4 54.89283377
4 83.96108438
5 61.13065579
5 45.91037006
5 43.29048482
5 54.01953869

;
proc sgscatter; plot time*sa;


proc nlmixed data=hosp;
parms g0=84.537 g1=-0.078 sigma=1.3;
mu=g0*exp(g1*time);
model sa ~ normal(mu,sigma*sigma);
predict g0*exp(g1*time) out=fit;


proc sgplot data=fit;
scatter x=time y=sa;
series x=time y=pred;

 

Thanks in advance and sorry again for the novice question.

3 REPLIES 3
PaigeMiller
Diamond | Level 26

What is wrong with the code you show?

--
Paige Miller
Lorezo
Calcite | Level 5
Sorry nothing is wrong with the code but I was wondering if there was a better way to plot the curve to make it look for clean.

I primarily was wondering how to run analysis on the model to find the parameters and p values.
PaigeMiller
Diamond | Level 26

a better way to plot the curve to make it look for clean.

I don't know what that means. Please explain further. Show us an example.

 

I primarily was wondering how to run analysis on the model to find the parameters and p values.

 

I thought your existing code does that.

--
Paige Miller

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 886 views
  • 0 likes
  • 2 in conversation