Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

easy printing of fstat #400

Closed
compleathorseplayer opened this issue Jan 27, 2021 · 2 comments
Closed

easy printing of fstat #400

compleathorseplayer opened this issue Jan 27, 2021 · 2 comments

Comments

@compleathorseplayer
Copy link

compleathorseplayer commented Jan 27, 2021

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)

@andy-aa
Copy link

andy-aa commented Apr 10, 2021

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

@palday
Copy link
Member

palday commented Sep 29, 2022

I believe #424 addressed this.

@palday palday closed this as completed Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants