Measuring R squared of a linear regression with GLM and Dataframes

Hi

I am new to Julia. I do not see how to get the R^2 of a linear regression using DataFrames and GLM. I can get the sum of squares of the errors (so I am almost there), but not the R^2.

Is there a way of getting form the output of the regression the R^2, or at least the variance of the LHS variable?

Sorry if this is a silly question.

Thanks!

There’s an r2 function in StatsBase for this, which is reexported by DataFrames: http://statsbasejl.readthedocs.io/en/stable/statmodels.html

1 Like

A good trick is to try whos(GLM), which will show all names exported by GLM. If you scroll down you will find the command r2, and you can continue with ?r2.

1 Like

Thanks SO SO much!!!

You guys are great!!!

SEVI