Using weights with srvyr package

Hey guys,

i am currently working on an important project where i need to use weights. I constructed the weight and tried to use it with the srvyr package but it doesnt have any impact on the result and I don't know why...

It is actually pretty straight forward:

The weight construction:

dat_gew <- dat %>%
mutate(gew = ifelse(Welle==1,(517.5/735),(517.5/300)))

My syntax:

test <- dat_gew %>%
as_survey(weights = c(gew)) %>%
group_by(Welle) %>%
summarize(n = survey_mean(Welle, na.rm = T))

Syntax is literally the same as in the package creators example, but still i get the unweighted results...anyone knows the reason for it? The result should be n = 517.5 for both waves (= Welle).

Help is greatly appreciated!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.