Skip to content

Commit

Permalink
Add check for invalid probs weights args
Browse files Browse the repository at this point in the history
  • Loading branch information
smishr committed Oct 31, 2022
1 parent c14c088 commit ace6bbe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/SurveyDesign.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ struct SimpleRandomSample <: AbstractSurveyDesign
if isa(probs, Symbol)
probs = data[!, probs]
end

if !( sum(probs) 1 )
error("Sampling probabilities for SRS must sum to 1")
elseif !(sum(1 ./ weights) 1)
error("Inverse of weights should for SRS must sum to 1")
end
if ignorefpc
@warn "assuming all weights are equal to 1.0"
weights = ones(nrow(data))
Expand Down

0 comments on commit ace6bbe

Please sign in to comment.