Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- Adjusted R^2

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-29-2015 11:59 AM

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

- 3.982 1.525 21
- 3.882 1.547 24
- 3.393 0.81 27
- 3.586 0.76 30
- 2.295 0.27 33
- 3.475 0.67 36

;

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;

- der.B=sdb;

sr=(sow**(1-B)-(R-delta)*(1-B)*time);

if sr>0 then sdr=(stx-sr**(1/(1-B)))/delta;

else sdr=0;

- der.R=sdr;

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;

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to UmarKhan

08-29-2015 02:28 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

08-29-2015 02:47 PM

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 R^{2} can be calculated as 1-[(1-R^{2})(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 R^{2. }

Thanks

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to UmarKhan

08-29-2015 03:20 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to UmarKhan

08-30-2015 06:37 AM

Cross linking this post to https://communities.sas.com/message/296865#296865