Skip to content

Commit 9b59c4e

Browse files
Show F-statistic for regression models
Co-authored-by: Phillip Alday <[email protected]>
1 parent dc45b6a commit 9b59c4e

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
@@ -123,7 +123,7 @@ const TableModels = Union{TableStatisticalModel, TableRegressionModel}
123123
@delegate TableRegressionModel.model [StatsBase.modelmatrix,
124124
StatsBase.residuals, StatsBase.response,
125125
StatsBase.predict, StatsBase.predict!,
126-
StatsBase.cooksdistance]
126+
StatsBase.cooksdistance, fstatistic]
127127
StatsBase.predict(m::TableRegressionModel, new_x::AbstractMatrix; kwargs...) =
128128
predict(m.model, new_x; kwargs...)
129129
# Need to define these manually because of ambiguity using @delegate
@@ -184,6 +184,14 @@ _show_fit_stats(io::IO, model::TableModels) = nothing
184184

185185
function _show_fit_stats(io::IO, model::TableRegressionModel)
186186
println("R²: ", round(r2(model), sigdigits=4))
187+
try
188+
fstat = fstatistic(model)
189+
println(io, fstat)
190+
catch e
191+
if !(isa(e, MethodError) && e.f == fstatistic)
192+
rethrow(e)
193+
end
194+
end
187195
end
188196

189197
# show function that delegates to coeftable

0 commit comments

Comments
 (0)