Skip to content

Commit 95248a5

Browse files
committed
Unify methods for weighted Stouffer combination
Drops the generic `combine` methods with weights: Only the Stouffer method currently supports weights. Unifies the `combine` methods with `StatsBase.Weights` and `Vector` weights to support only an `AbstractVector` input: This handles both existing cases with one method, and provides a more flexible interface for additional types of weights.
1 parent a8c0062 commit 95248a5

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/combinations.jl

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ function combine(pValues::AbstractVector{T}, method::M)::T where {T<:AbstractFlo
44
combine(PValues(pValues), method)
55
end
66

7-
function combine(pValues::AbstractVector{T}, weights::Weights, method::M)::T where {T<:AbstractFloat, M<:PValueCombination}
8-
combine(PValues(pValues), weights, method)
9-
end
10-
11-
function combine(pValues::AbstractVector{T}, weights::AbstractVector{R}, method::M)::T where {T<:AbstractFloat, R<:Real, M<:PValueCombination}
12-
combine(PValues(pValues), weights, method)
13-
end
14-
157

168
## Fisher combination ##
179

@@ -71,7 +63,7 @@ function combine(pValues::PValues{T}, method::StoufferCombination)::T where T<:A
7163
return p
7264
end
7365

74-
function combine(pValues::PValues{T}, weights::Vector{T}, method::StoufferCombination)::T where T<:AbstractFloat
66+
function combine(pValues::PValues{T}, weights::AbstractVector{R}, method::StoufferCombination)::T where {T<:AbstractFloat, R<:Real}
7567
n = length(pValues)
7668
if n == 1
7769
return pValues[1]
@@ -85,8 +77,8 @@ function combine(pValues::PValues{T}, weights::Vector{T}, method::StoufferCombin
8577
return p
8678
end
8779

88-
function combine(pValues::PValues{T}, weights::Weights, method::StoufferCombination)::T where T<:AbstractFloat
89-
combine(pValues, values(weights), method)
80+
function combine(pValues::AbstractVector{T}, weights::AbstractVector{R}, method::StoufferCombination)::T where {T<:AbstractFloat, R<:Real}
81+
combine(PValues(pValues), weights, method)
9082
end
9183

9284

0 commit comments

Comments
 (0)