I'm interested in calculating the count r2 statistic as well as the count-adjusted r2 for logistic regression. Count r2 is the total number of correct predictions over the total number of counts. Adjusted count r2 is the correct number of counts minus the most frequent outcome divided by the total count minus the most frequent outcome.
The final number I get here for count r2 is 27. When we use the user-written fitstat, it tells me that it's 89.2 and 63.6, respectively. And, since I struggle with the count r2 statistic, I can't calculate the adjusted version.
What am I doing wrong here?
Code:
cls sysuse auto, clear qui logit foreign price weight mpg predict prob, xb fitstat qui g correct = cond(prob>.5,1,0) count if correct==1 loc correct = r(N) di `correct'/_N
What am I doing wrong here?
Comment