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