Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import/export fitted #389

Merged
merged 2 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/GLM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ module GLM
import Statistics: cor
import StatsBase: coef, coeftable, confint, deviance, nulldeviance, dof, dof_residual,
loglikelihood, nullloglikelihood, nobs, stderror, vcov, residuals, predict,
fit, model_response, response, modelmatrix, r2, r², adjr2, adjr², PValue
fitted, fit, model_response, response, modelmatrix, r2, r², adjr2, adjr², PValue
import StatsFuns: xlogy
import SpecialFunctions: erfc, erfcinv, digamma, trigamma
export coef, coeftable, confint, deviance, nulldeviance, dof, dof_residual,
loglikelihood, nullloglikelihood, nobs, stderror, vcov, residuals, predict,
fit, fit!, model_response, response, modelmatrix, r2, r², adjr2, adjr²
fitted, fit, fit!, model_response, response, modelmatrix, r2, r², adjr2, adjr²

export
# types
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,15 @@ end
@test isapprox(vcov(gmsparse), vcov(gmdense))
end


@testset "Predict" begin
Random.seed!(1)
X = rand(10, 2)
Y = logistic.(X * [3; -3])

gm11 = fit(GeneralizedLinearModel, X, Y, Binomial())
@test isapprox(predict(gm11), Y)

@test predict(gm11) == fitted(gm11)

newX = rand(5, 2)
newY = logistic.(newX * coef(gm11))
@test isapprox(predict(gm11, newX), newY)
Expand Down