Skip to content

Commit

Permalink
Rename stderr to stderror (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
yukota authored and nalimilan committed May 3, 2018
1 parent a0e6f1e commit b01dcdf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/src/statmodels.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ nulldeviance
r2
rss
score
stderr
stderror
vcov
weights(::StatisticalModel)
```
Expand Down
2 changes: 1 addition & 1 deletion src/StatsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ module StatsBase
nullloglikelihood,
rss,
score,
stderr,
stderror,
vcov,
predict,
predict!,
Expand Down
10 changes: 9 additions & 1 deletion src/deprecates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ import Base.varm, Base.stdm
@deprecate AICc(obj::StatisticalModel) aicc(obj)
@deprecate BIC(obj::StatisticalModel) bic(obj)

if !isdefined(Base, :stderr)
@deprecate stderr(obj::StatisticalModel) stderror(obj)
else
function (io::typeof(stderr))(obj::StatisticalModel)
Base.depwarn("stderr(obj::StatisticalModel) is deprecated, use stderror(obj) instead", :stderr)
io === stderr ? stderror(obj) : throw(MethodErrror(io, (obj,)))
end
end

@deprecate R2(obj::StatisticalModel, variant::Symbol) r2(obj, variant)
@deprecate (obj::StatisticalModel, variant::Symbol) (obj, variant)
@deprecate adjR2(obj::StatisticalModel, variant::Symbol) adjr2(obj, variant)
Expand All @@ -38,7 +47,6 @@ function findat!(r::IntegerArray, a::AbstractArray{T}, b::AbstractArray{T}) wher
return r
end


"""
findat(a, b)
Expand Down
4 changes: 2 additions & 2 deletions src/statmodels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ informationmatrix(model::StatisticalModel; expected::Bool = true) =
error("informationmatrix is not defined for $(typeof(obj)).")

"""
stderr(obj::StatisticalModel)
stderror(obj::StatisticalModel)
Return the standard errors for the coefficients of the model.
"""
stderr(obj::StatisticalModel) = sqrt.(diag(vcov(obj)))
stderror(obj::StatisticalModel) = sqrt.(diag(vcov(obj)))

"""
vcov(obj::StatisticalModel)
Expand Down
4 changes: 2 additions & 2 deletions test/statmodels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ x2 0.368314 Great -90 <1e-4
x3 0.344454 Bad -80 <1e-4
"""

@test sprint(show, CoefTable(m, ["Estimate", "Stderr", "df", "p"],
@test sprint(show, CoefTable(m, ["Estimate", "Stderror", "df", "p"],
["x1", "x2", "x3"], 4)) == """
Estimate Stderr df p
Estimate Stderror df p
x1 0.819778 0.844007 0.923676 0.1717
x2 0.669931 0.67919 0.066098 0.4204
x3 0.453058 0.72525 0.999172 0.5567
Expand Down

0 comments on commit b01dcdf

Please sign in to comment.