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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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