diff --git a/docs/make.jl b/docs/make.jl index 9d75a24..de5e7a5 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -5,6 +5,7 @@ using BoxCox makedocs(; root=joinpath(dirname(pathof(BoxCox)), "..", "docs"), sitename="BoxCox", doctest=true, + strict=true, pages=["index.md", "api.md"]) deploydocs(; repo="github.com/palday/BoxCox.jl", push_preview=true, devbranch="main") diff --git a/src/BoxCox.jl b/src/BoxCox.jl index 9ca7d5e..e3d4884 100644 --- a/src/BoxCox.jl +++ b/src/BoxCox.jl @@ -13,6 +13,7 @@ using StatsAPI using StatsBase using StatsFuns +# XXX I have no idea why this is necessary, but otherwise isdefined(BoxCox, :params) returns false using StatsAPI: params export BoxCoxTransformation, @@ -36,7 +37,7 @@ abstract type PowerTransformation end # struct BickelDoksumTransformation <: PowerTransformation end """ - struct BoxCoxTransformation <: PowerTransformation + BoxCoxTransformation <: PowerTransformation # Fields @@ -85,7 +86,7 @@ Compare the λ parameter of `x` and `y` for approximate equality. Other internal structures of `BoxCoxTransformation` are not compared. """ function Base.isapprox(x::BoxCoxTransformation, y::BoxCoxTransformation; kwargs...) - return isapprox(x.λ, y.λ; kwargs...) + return all(isapprox.(params(x), params(y); kwargs...)) end """ @@ -98,7 +99,7 @@ Compute the Box-Cox transformation of x for the parameter value λ. The one argument variant curries and creates a one-argument function of `x` for the given λ. -See also [BoxCoxTransformation](@ref). +See also [`BoxCoxTransformation`](@ref). # References @@ -120,7 +121,7 @@ end Apply the estimated BoxCox transformation `t` to the number `x`. -See also [`BoxCox`](@ref). +See also [`boxcox`](@ref). """ function (t::BoxCoxTransformation)(x::Number) return boxcox(t.λ, x) @@ -323,6 +324,11 @@ end StatsAPI.nobs(bc::BoxCoxTransformation) = length(bc.y) +""" + StatsAPI.params(bc::BoxCoxTransformation) + +Return a vector of all parameters, i.e. `[λ]`. +""" StatsAPI.params(bc::BoxCoxTransformation) = [bc.λ] # function _pvalue(bc::BoxCoxTransformation)