Skip to content

Sampling from StudentizedRange returns NaN for k < 2 #1996

@ForceBru

Description

@ForceBru

In Distributions v0.25.120 rand(StudentizedRange(10, k)) seems to always produce NaN for k < 2:

julia> rand(StudentizedRange(10, 1.1), 10)'
1×10 adjoint(::Vector{Float64}) with eltype Float64:
 NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN
julia> rand(StudentizedRange(10, 1.9), 10)'
1×10 adjoint(::Vector{Float64}) with eltype Float64:
 NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN  NaN
julia> rand(StudentizedRange(10, 2), 10)'
1×10 adjoint(::Vector{Float64}) with eltype Float64:
 0.237901  3.54309  0.883281  1.79658  0.70134  0.30904  0.692738  1.68206  1.65031  2.70354
julia> [mean(isnan, rand(StudentizedRange(10, k), 100)) for k in range(1.1, 2, 20)]'
1×20 adjoint(::Vector{Float64}) with eltype Float64:
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  0.0

The last line shows that for 1.1 <= k < 2, the proportion of NaN in a sample is 1.0, so all samples are NaN.

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