From b01dcdfa9dfc9b9dd842e555caca67105b43ad47 Mon Sep 17 00:00:00 2001 From: YuK_Ota Date: Thu, 3 May 2018 17:57:32 +0900 Subject: [PATCH] Rename stderr to stderror (#368) --- docs/src/statmodels.md | 2 +- src/StatsBase.jl | 2 +- src/deprecates.jl | 10 +++++++++- src/statmodels.jl | 4 ++-- test/statmodels.jl | 4 ++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/src/statmodels.md b/docs/src/statmodels.md index 17994354d..de8bba8d2 100644 --- a/docs/src/statmodels.md +++ b/docs/src/statmodels.md @@ -27,7 +27,7 @@ nulldeviance r2 rss score -stderr +stderror vcov weights(::StatisticalModel) ``` diff --git a/src/StatsBase.jl b/src/StatsBase.jl index 63fe464e6..79f602586 100644 --- a/src/StatsBase.jl +++ b/src/StatsBase.jl @@ -179,7 +179,7 @@ module StatsBase nullloglikelihood, rss, score, - stderr, + stderror, vcov, predict, predict!, diff --git a/src/deprecates.jl b/src/deprecates.jl index 2d3e695b6..5aaad6452 100644 --- a/src/deprecates.jl +++ b/src/deprecates.jl @@ -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 R²(obj::StatisticalModel, variant::Symbol) r²(obj, variant) @deprecate adjR2(obj::StatisticalModel, variant::Symbol) adjr2(obj, variant) @@ -38,7 +47,6 @@ function findat!(r::IntegerArray, a::AbstractArray{T}, b::AbstractArray{T}) wher return r end - """ findat(a, b) diff --git a/src/statmodels.jl b/src/statmodels.jl index e6ef1584c..4dd48ed88 100644 --- a/src/statmodels.jl +++ b/src/statmodels.jl @@ -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) diff --git a/test/statmodels.jl b/test/statmodels.jl index d024be81e..87cd37af3 100644 --- a/test/statmodels.jl +++ b/test/statmodels.jl @@ -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