Skip to content

Commit

Permalink
Rename :confint to :confidence
Browse files Browse the repository at this point in the history
  • Loading branch information
nalimilan committed Nov 10, 2018
1 parent 2e1fef4 commit c2a5bd2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ julia> predict(ols)
julia> newX = DataFrame(X=[2,3,4]);
julia> predict(ols, newX, interval=:confint)
julia> predict(ols, newX, interval=:confidence)
3×3 Array{Float64,2}:
4.33333 1.33845 7.32821
6.83333 2.09801 11.5687
Expand Down
12 changes: 8 additions & 4 deletions src/lm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,20 @@ If `interval` is `nothing` (the default), return a vector with the predicted val
for model `mm` and new data `newx`.
Otherwise, return a 3-column matrix with the prediction and
the lower and upper confidence bounds for a given `level` (0.95 equates alpha = 0.05).
Valid values of `interval` are `:confint` delimiting the uncertainty of the
predicted relationship, and `:predint` delimiting estimated bounds for new data points.
Valid values of `interval` are `:confidence` delimiting the uncertainty of the
predicted relationship, and `:prediction` delimiting estimated bounds for new data points.
"""
function predict(mm::LinearModel, newx::AbstractMatrix;
interval::Union{Symbol,Nothing}=nothing, level::Real = 0.95)
retmean = newx * coef(mm)
if interval === :confint
Base.depwarn("interval=:confint is deprecated in favor of interval=:confidence")
interval = :confidence
end
if interval === nothing
return retmean
elseif interval !== :confint
error("only :confint is currently implemented") #:predint will be implemented
elseif interval !== :confidence
error("only interval=:confidence is currently implemented") #:predint will be implemented
end
length(mm.rr.wts) == 0 || error("prediction with confidence intervals not yet implemented for weighted regression")

Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ end
Ylm = X * [0.8, 1.6] + 0.8randn(10)
mm = fit(LinearModel, X, Ylm)
pred1 = predict(mm, newX)
pred2 = predict(mm, newX, interval=:confint)
pred2 = predict(mm, newX, interval=:confidence)

@test pred1 == pred2[:, 1]
[1.6488076594462182, 0.4706674451801356, 2.5010808086024423,
Expand Down

0 comments on commit c2a5bd2

Please sign in to comment.