Weighted Data with Survey Package

Hey !

My dataset includes 5 variables:

gender - 1 (Male), 2 (Female)

car (has a car) - 1 (Yes), 2 (No), 3 (Don't know), 4 (Refused)

motorcycle (has a motorcycle) - 1 (Yes), 2 (No), 3 (Don't know), 4 (Refused)

helmet (if has a motorcycle: wears helmet when driving a motorcycle) - 1 (Yes), 2 (No), 3 (Don't know), 4 (Refused)

weights - sampling weights

I want to do some descriptive statistics on:

1: proportion of females having a car (among women)

2: proportion of people wearing a helmet when driving a motorcycle among those having a motorcycle

3: proportion of women wearing a helmet when driving a motorcycle among women having a motorcycle

4: proportion of women wearing a helmet when driving a motorcycle among women having both a car and a motorcycle

I am using the survey package. This is what I did:

weighteddata = svydesign(ids = ~1, data = data, weights = data$weights)

for 1: svyby(~car, ~gender, svymean)

With 2 - 4 I struggle.

Please send help!

Thanks, Ella

Can you provide a reproducible example for your dataset?

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.