BookmarkSubscribeRSS Feed
samkelomotsa
Fluorite | Level 6

Good day
I want  to obtain the R squared to certain the accuracy of my gompertz model. I have run the analysis below and it converged, however I am stuck as I can not compute the R squared for the model to know much variation is explained by this model.

data sam;
input wb genotype$ week wght bwo;
datalines;
.
.
.
;
run;
proc sort data=sam; by genotype; run;


proc nlin data=sam;
by genotype;
parameters L 0.2 K 0.1; /* initial guess of L & K */
model WGHT = Bwo * EXP(L/K*(1- EXP(-K*WEEK))); /* using initial body weight as a variable since it was phentypically recorded*/
ESTIMATE 'lk_bw_FE' exp(L / K);
ESTIMATE 'lk_1_bw_infl' exp((L / K)-1);
ESTIMATE 'TI' (1 / K) * abs(log(L / K)); /*estimates age which growth rate was maximum*/
output out=sam1 predicted=Pred lclm=Lower95 uclm=Upper95;
run;sas.PNGsas1.PNG

2 REPLIES 2
Ksharp
Super User
The R-Square is just the Pearson correlation coefficient between Y and Y_Hat(a.k.a. Y_Pred).
Since you already get "predicted=Pred",
You can calculated Perason Corr by PROC CORR + var Y Pred;
and R^2= Corr^2.
Check my comment from :
https://communities.sas.com/t5/SAS-Procedures/compute-95-CI-of-r-square-in-proc-reg/m-p/859684

And @Rick_SAS blog:
https://blogs.sas.com/content/iml/2024/06/10/distribution-r-square.html

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 329 views
  • 3 likes
  • 2 in conversation