0

I wanted a package that had a function that calculated the angular, linear, coefficient of determination R^2, standard deviation... and I am having trouble finding it.

I've seen the examples here https://juliastats.org/GLM.jl/stable/examples/#Linear-regression-1 but I didn't like it much because I also wanted the coefficient of determination. Could you tell me a specific function to do that or will I need to implement my own function?

1 Answers1

0

StatsBase has coefficient of determination. StatsBase.jl includes many functions that were felt to be too little used for the base installation's Statistics.jl

From the docs of that package:


StatsAPI.r2 — Function r2(model::StatisticalModel) r²(model::StatisticalModel) Coefficient of determination (R-squared).

For a linear model, the R² is defined as ESS/TSS, with ESS the explained sum of squares and TSS the total sum of squares.


Particularly, instances of StatisticalModel implement the following methods.

StatsAPI.adjr2 — Function adjr2(model::StatisticalModel) adjr²(model::StatisticalModel) Adjusted coefficient of determination (adjusted R-squared).

For linear models, the adjusted R² is defined as 1 - (1 - (1-R^2)(n-1)/(n-p)), with R^2 the coefficient of determination, n the number of observations, and p the number of coefficients (including the intercept). This definition is generally known as the Wherry Formula I.

Bill
  • 5,600
  • 15
  • 27