Skip to content

Commit

Permalink
delegate coefnames for wrapped models to model frame
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinschmidt committed May 18, 2018
1 parent fdeb053 commit 38c33ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/statsmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function StatsBase.predict(mm::DataFrameRegressionModel, df::AbstractDataFrame;
return(out)
end


StatsBase.coefnames(model::DataFrameModels) = coefnames(model.mf)

# coeftable implementation
function StatsBase.coeftable(model::DataFrameModels)
Expand Down
3 changes: 3 additions & 0 deletions test/statsmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Base.show(io::IO, m::DummyModTwo) = println(io, m.msg)
m = fit(DummyMod, f, d)
@test model_response(m) == Array(d[:y])

## coefnames delegated to model frame by default
@test coefnames(m) == coefnames(ModelFrame(f, d)) == ["(Intercept)", "x1", "x2", "x1 & x2"]

## test prediction method
## vanilla
@test predict(m) == [ ones(size(d,1)) Array(d[:x1]) Array(d[:x2]) Array(d[:x1]).*Array(d[:x2]) ] * collect(1:4)
Expand Down

0 comments on commit 38c33ee

Please sign in to comment.