Skip to content

Commit b953553

Browse files
Show F-statistic for regression models
1 parent 950ba92 commit b953553

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/statsmodel.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,17 @@ function Base.show(io::IO, model::TableModels)
190190
println(io)
191191
println(io,"Coefficients:")
192192
println(io, ct)
193+
println(io)
194+
println("R²: ", round(r2(model), sigdigits=4))
193195
if model isa TableRegressionModel
194-
println(io)
195-
println("R²: ", round(r2(model), sigdigits=4))
196+
try
197+
fstat = fstatistic(model)
198+
println(io, fstat)
199+
catch e
200+
if !(isa(e, MethodError) && e.f == fstatistic)
201+
rethrow(e)
202+
end
203+
end
196204
end
197205
catch e
198206
if isa(e, ErrorException) && occursin("coeftable is not defined", e.msg)
@@ -202,3 +210,5 @@ function Base.show(io::IO, model::TableModels)
202210
end
203211
end
204212
end
213+
214+
fstatistic(m::TableRegressionModel) = fstatistic(m.model)

0 commit comments

Comments
 (0)