Measuring R squared of a linear regression with GLM and Dataframes

question

#1

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!


#2

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


#3

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.


#4

Thanks SO SO much!!!

You guys are great!!!

SEVI