Thanksfor modifying my program that now can produce R^2 too. But I have asked a question many time from PaigeMiller but he (I think he is not receiving the notification) is not answering to my question. Please PaigeMiller answer to my question that the R^2 that is produced with this modification is adjusted R^2 or coefficient of determination (R^2).
Many thanks.
data large;
input sow stw time;
datalines;
4 3.366 3
4 3.052 6
4 2.666 9
4 2.755 12
4 2.203 15
4 1.886 18
;
proc nlin data=large method=marquardt;
parms B=0.5 R=0.1;
delta=0.000001;
s=sow**(1-B)-R*(1-B)*time;
if s>0 then stx=s**(1/(1-B));
else stx=0;
model stw=stx;
sb=(sow**(1-B+delta)-R*(1-B+delta)*time);
if sb>0 then sdb=(stx-sb**(1/(1-B+delta)))/delta;
else sdb=0;
sr=(sow**(1-B)-(R-delta)*(1-B)*time);
if sr>0 then sdr=(stx-sr**(1/(1-B)))/delta;
else sdr=0;
output out=largep p=pstw;
run;
output out=smallp p=pstw;
to
output out=smallp p=pstw r=stw_residual;
Then, this ought to work (untested code)
proc summary data=smallp;
var stw_residual stw;
output out=stats css(stw)=sstot uss(stw_residual)=ssres;
run;
data final;
set stats;
rsquared=1-(ssres/sstot);
run;
Its the weekend. He may be on vacation or at the lake but is in no way obligated to answer your question anyways. According to Wikipedia's definition it appears to be the r-squared value.
https://en.m.wikipedia.org/wiki/Coefficient_of_determination
Dear Reeza,
it is clear that the r^2 which produced through this modification is simple r^2. Can you please modify it more with this for adjusted r^2. I need to write adjusted r^2 in my research paper.
Adjusted R2 can be calculated as 1-[(1-R2)(n-1)(n-k-1)-1]
where n is the number of data points and k is the number of regressors (parameters in your cases)
- and you already now are able to calculate R2.
Thanks
You have the formula and presumably the n and p. Try modifying the DATA FINAL step in the original code. If you can't get it post what you've tried and I might help.
Cross linking this post to https://communities.sas.com/message/296865#296865
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.