From e029ef4b34d1660ec23b147e3d91bccd1b7ac286 Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Fri, 16 Aug 2024 17:37:06 +0200 Subject: [PATCH] Fix coeftable when passing level keyword argument (#311) --- src/statsmodel.jl | 2 +- test/statsmodel.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/statsmodel.jl b/src/statsmodel.jl index cd814b04..76515af0 100644 --- a/src/statsmodel.jl +++ b/src/statsmodel.jl @@ -185,7 +185,7 @@ StatsAPI.coefnames(model::TableModels) = coefnames(model.mf) # coeftable implementation function StatsAPI.coeftable(model::TableModels; kwargs...) - ct = coeftable(model.model, kwargs...) + ct = coeftable(model.model; kwargs...) cfnames = coefnames(model.mf) if length(ct.rownms) == length(cfnames) ct.rownms = cfnames diff --git a/test/statsmodel.jl b/test/statsmodel.jl index a60b3d4d..d0c4358b 100644 --- a/test/statsmodel.jl +++ b/test/statsmodel.jl @@ -12,7 +12,7 @@ StatsAPI.fit(::Type{DummyMod}, x::Matrix, y::Vector) = DummyMod(collect(1:size(x, 2)), x, y) StatsAPI.response(mod::DummyMod) = mod.y ## dumb coeftable: just prints the "beta" values -StatsAPI.coeftable(mod::DummyMod) = +StatsAPI.coeftable(mod::DummyMod; level::Real = 0.95) = CoefTable(reshape(mod.beta, (size(mod.beta,1), 1)), ["'beta' value"], ["" for n in 1:size(mod.x,2)], @@ -159,7 +159,7 @@ Base.show(io::IO, m::DummyModTwo) = println(io, m.msg) @test length(predict(m, d2)) == 4 ## test copying of names from Terms to CoefTable - ct = coeftable(m) + ct = coeftable(m; level = 0.9) @test ct.rownms == ["(Intercept)", "x1", "x2", "x1 & x2"] @test termnames(m) == ("y", ["(Intercept)", "x1", "x2", "x1 & x2"])