@@ -122,7 +122,7 @@ const TableModels = Union{TableStatisticalModel, TableRegressionModel}
122122 StatsBase. stderror, StatsBase. vcov]
123123@delegate TableRegressionModel. model [StatsBase. modelmatrix,
124124 StatsBase. residuals, StatsBase. response,
125- StatsBase. predict, StatsBase. predict!,
125+ StatsBase. predict, StatsBase. predict!,
126126 StatsBase. cooksdistance]
127127StatsBase. predict (m:: TableRegressionModel , new_x:: AbstractMatrix ; kwargs... ) =
128128 predict (m. model, new_x; kwargs... )
@@ -180,6 +180,12 @@ function StatsBase.coeftable(model::TableModels; kwargs...)
180180 ct
181181end
182182
183+ _show_fit_stats (io:: IO , model:: TableModels ) = nothing
184+
185+ function _show_fit_stats (io:: IO , model:: TableRegressionModel )
186+ println (" R²: " , round (r2 (model), sigdigits= 4 ))
187+ end
188+
183189# show function that delegates to coeftable
184190function Base. show (io:: IO , model:: TableModels )
185191 try
@@ -189,7 +195,9 @@ function Base.show(io::IO, model::TableModels)
189195 println (io, model. mf. f)
190196 println (io)
191197 println (io," Coefficients:" )
192- show (io, ct)
198+ println (io, ct)
199+ println (io)
200+ _show_fit_stats (io, model)
193201 catch e
194202 if isa (e, ErrorException) && occursin (" coeftable is not defined" , e. msg)
195203 show (io, model. model)
0 commit comments