Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Dec 17, 2024
1 parent 6da102a commit 469a881
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/rescale_weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ rescale_weights <- function(data, by, probability_weights, nest = FALSE, method
# design effect according to Kish
deff <- mean(weights^2) / (mean(weights)^2)
# rescale weights, so their mean is 1
z_weights <- ((weights + 1) - mean(weights) ) / stats::sd(weights)
z_weights <- weights * (1 / mean(weights))
# divide weights by design effect
data$pweight <- NA_real_
data$pweight[weight_non_na] <- z_weights / deff
Expand Down

0 comments on commit 469a881

Please sign in to comment.