GLM.jl
GLM.jl copied to clipboard
easy printing of fstat
Hi All. What about the following for easy access to ftest()?
ftest(lmodel)=(1/(1-r2(lmodel))-1)*(length(predict(lmodel))-
length(coef(lmodel)))/(length(coef(lmodel))-1)
I have been giving this manually to my students, but it would be nice to have it available as a method (at the moment ftest() with one argument fails)
I tried to make this into a Pull request but have never done that and got bogged down with 'branch comparisons'. Could someone please submit this if you think it is a good idea?
Maybe the function should be called fstat()
to be analogous to the r2()
diagnostic (a value, as opposed to a table)
It also needs easy access to the p-value for the F-statistic.
function fstat(ols::LinearModel)
k = length(coef(ols)) - 1
n = nobs(ols)
F = (1 / (1 - r2(ols)) - 1) * (n - k - 1) / k
p = ccdf(FDist(k, n - k - 1), F)
return F, p
end
I believe #424 addressed this.