Skip to content

Commit

Permalink
Show F-statistic for regression models
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejSlamecka committed Apr 25, 2021
1 parent 950ba92 commit b953553
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/statsmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,17 @@ function Base.show(io::IO, model::TableModels)
println(io)
println(io,"Coefficients:")
println(io, ct)
println(io)
println("R²: ", round(r2(model), sigdigits=4))
if model isa TableRegressionModel
println(io)
println("R²: ", round(r2(model), sigdigits=4))
try
fstat = fstatistic(model)
println(io, fstat)
catch e
if !(isa(e, MethodError) && e.f == fstatistic)
rethrow(e)
end
end
end
catch e
if isa(e, ErrorException) && occursin("coeftable is not defined", e.msg)
Expand All @@ -202,3 +210,5 @@ function Base.show(io::IO, model::TableModels)
end
end
end

fstatistic(m::TableRegressionModel) = fstatistic(m.model)

0 comments on commit b953553

Please sign in to comment.