Skip to content

Commit

Permalink
try..catch all of _show_fit_stats
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejSlamecka committed Apr 26, 2022
1 parent 659dc51 commit 88490cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/statsmodel.jl
Expand Up @@ -196,13 +196,14 @@ end
_show_fit_stats(io::IO, model::TableModels) = nothing

function _show_fit_stats(io::IO, model::TableRegressionModel)
println("R²: ", round(r2(model), sigdigits=4),
"\t Adjusted R²: ", round(adjr2(model), sigdigits=4))
try
println("R²: ", round(r2(model), sigdigits=4),
"\t Adjusted R²: ", round(adjr2(model), sigdigits=4))

fstat = fstatistic(model)
println(io, fstat)
catch e
if !(isa(e, MethodError) && e.f == fstatistic)
if !(isa(e, MethodError) && (e.f == r2 || e.f == adjr2 || e.f == fstatistic))
rethrow(e)
end
end
Expand Down

0 comments on commit 88490cf

Please sign in to comment.