Is there a convenience function to compute the R^2 for GLM.jl's lm?

xia*_*dai 4 linear-regression julia

using RDatasets
cars = dataset("datasets", "cars")
m1 = lm(@formula(Dist~Speed), cars)
Run Code Online (Sandbox Code Playgroud)

Now how do I extract the R^2 of m1? I tried summary(m1) and it didn't contain the information.

Bog*_*ski 5

您可以使用r2函数(两个名称指向同一函数)。

对于调整后的R ^ 2,您可以使用adjr2adjr²功能。