Skip to content

Commit

Permalink
import/export fitted (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinschmidt committed Dec 11, 2020
1 parent 048b8ac commit 2775380
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 2775380

Please sign in to comment.