Matheus Rabetti
Matheus Rabetti

Reputation: 43

Is it possible to use an aggregated denominator on svyratio - survey package?

Below is what I think is the best way to explain the problem. It is not the first time I run into this situation.

Lookingfor_job: is a categoric variable defining the way the unemployed is looking for a job. Something like: curriculum delivery, look for an agency and call family members. It assumes values in the (1, 2, ..., 12) interval.

Here, I want to calculate the total of unemployed by state and lookingfor_job and divided by the total of unemployed by group. In the end, I need a percentage, by state, of which way a unemployed will look for a job.

Result expected: x% of the people looking for a job try to this in the 'call a friend' option (job_find == '2') for the state Y.
I was thinking in a way that I could do this for all categories.

svyby(~unemployed,
  ~state+lookingfor_job, # total unemployed population per state and way looking for a job
  denominator = ~svyby(~unemployed, ~state, desocup.pnad), #total unemployed population per state
  design = desocup.pnad,
  svyratio,
  vartype = 'ci')

I think somehow i could calculate both separated and then divide. But, my knowledge in complex surveys can't help me.

svyby(~unemployed,
  ~state+lookingfor_job,
  design = desocup.pnad,
  svytotal,
  vartype= 'ci') -> findjob

svyby(~unemployed,
  ~state,
  design = desocup.pnad,
  svytotal,
  vartype= 'ci') -> total

Upvotes: 1

Views: 332

Answers (1)

Anthony Damico
Anthony Damico

Reputation: 6104

forgetting about states and svyby, is this the svyratio that you want for the nationwide estimate?

# among all unemployed nationwide, what share are looking for a job?
svyratio( ~ seeking_job , denominator = ~ unemployed , design = your_design )

if that is what you are looking for, then you can break svyratio out by state with this configuration

# among all unemployed (broken out by state), what share are looking for a job?
svyby( ~ seeking_job , denominator = ~ unemployed , by = ~ state , design = your_design , svyratio )

note that there is a bug in svyby+svyratio in certain situations. you may need to add all variables to the denominator, like this:

svyby( ~ find_job , denominator = ~ find_job + unemployed , by = ~ state , design = pnad , svyratio )

Upvotes: 1

Related Questions