Search code examples
survey

Using Svyciprop to get prevalence with CI across two variables


**I wanted to find the prevalence of smoking in urban and in rural area.

I used this code** enter image description here

I found this result:

enter image description here

We see that it results a little different, calculating all responses a whole. How can I use svyciprop especificially for one type of response. For example, how can I get result the prevalence of smoking in only rural area or in only urban area?


Solution

  • looks like smoking is zero/one and urban_rural is either 'urban' or 'rural' so

    svyciprop( ~ smoking , subset( svs1 , urban_rural == 'rural' ) )
    
    svyciprop( ~ smoking , subset( svs1 , urban_rural == 'urban' ) )