Skip to content

Commit 13c5d9b

Browse files
Show F-statistic for regression models
Co-authored-by: Phillip Alday <[email protected]>
1 parent 70c61d1 commit 13c5d9b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/statsmodel.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const TableModels = Union{TableStatisticalModel, TableRegressionModel}
133133
@delegate TableRegressionModel.model [StatsBase.modelmatrix,
134134
StatsBase.residuals, StatsBase.response,
135135
StatsBase.predict, StatsBase.predict!,
136-
StatsBase.cooksdistance]
136+
StatsBase.cooksdistance, fstatistic]
137137
StatsBase.predict(m::TableRegressionModel, new_x::AbstractMatrix; kwargs...) =
138138
predict(m.model, new_x; kwargs...)
139139
# Need to define these manually because of ambiguity using @delegate
@@ -197,6 +197,14 @@ _show_fit_stats(io::IO, model::TableModels) = nothing
197197

198198
function _show_fit_stats(io::IO, model::TableRegressionModel)
199199
println("R²: ", round(r2(model), sigdigits=4))
200+
try
201+
fstat = fstatistic(model)
202+
println(io, fstat)
203+
catch e
204+
if !(isa(e, MethodError) && e.f == fstatistic)
205+
rethrow(e)
206+
end
207+
end
200208
end
201209

202210
# show function that delegates to coeftable

0 commit comments

Comments
 (0)