Skip to content

KSampleADTest does not accept SentinelArrays.ChainedVector #344

@sgaure

Description

@sgaure

Even though a ChainedVector is an AbstractVector, the KSampleADTest does not accept such vectors. It can of course be circumvented with a collect on the vector first. DataFrames has a habit of using ChainedVector now and then.
This is HypothesisTests v0.11.5.

julia> typeof(a)
SentinelArrays.ChainedVector{Float64, Vector{Float64}}

julia> typeof(b)
SentinelArrays.ChainedVector{Float64, Vector{Float64}}

julia> KSampleADTest(a, b)
ERROR: MethodError: no method matching KSampleADTest(::Int64, ::Int64, ::Float64, ::Float64, ::Bool, ::Int64, ::SentinelArrays.ChainedVector{…}, ::Vector{…})
The type `KSampleADTest` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  KSampleADTest(::Int64, ::Int64, ::Float64, ::Float64, ::Bool, ::Int64, ::Vector{T}, ::Vector{Int64}) where T<:Real
   @ HypothesisTests ~/.julia/packages/HypothesisTests/xna7a/src/anderson_darling.jl:84
  KSampleADTest(::AbstractVector{T}...; modified, nsim) where T<:Real
   @ HypothesisTests ~/.julia/packages/HypothesisTests/xna7a/src/anderson_darling.jl:117
...

julia> ApproximateTwoSampleKSTest(a, b)
Approximate two sample Kolmogorov-Smirnov test
----------------------------------------------
Population details:
    parameter of interest:   Supremum of CDF differences
    value under h_0:         0.0
    point estimate:          0.019
...
julia> supertypes(typeof(a))
(SentinelArrays.ChainedVector{Float64, Vector{Float64}}, AbstractVector{Float64}, Any)

julia> supertypes(typeof(b))
(SentinelArrays.ChainedVector{Float64, Vector{Float64}}, AbstractVector{Float64}, Any)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions