I am very new to Stata, so please bear with me.....I would like to adjust my sample to the population distribution (i.e. let's say I oversampled females, hispanic people and young people and would like to adjust for that).
I am just a bit confused about what commands I need to use. Here is what I would like to do: Use 3 control variables to adjust my sample (n=1000). I have the microdata from a Census file but I am not sure how I can 'merge' that with my study dataset to obtain the weights.
As I understand ipfraking is a good command for that. However, I do not really understand all of the steps and would really appreciate any help. This is the code that can be found under help ipfraking
Code:
. webuse nhanes2, clear . * setting up the totals . generate byte _one = 1 . svy: total _one, over(sex, nolab) . matrix total_sex = e(b) . matrix rownames total_sex = sex . svy: total _one, over(race, nolab) . matrix total_race = e(b) . matrix rownames total_race = race . * obtaining the sample . sample 500, count by(region) . * calibrating the weights . ipfraking [pw=finalwgt], ctotal(total_sex total_race) generate(rakedwgt4)
Here are my questions:
1) Does the author use the nhames2 dataset to serve as an example (this is his "study sample") or to obtain the population totals from it? Or is it both?
2) If it is his study sample, where do the population totals come from?
3) Why is region introduced here? . sample 500, count by(region)
In another example, instead of the sample 500 this is used
Code:
matrix total_sex[1,1] = total_sex[1,1]*1.25 matrix total_race[1,1] = total_race[1,1]*1.4
4) Where do the 1.25 and 1.4 come from?
Again, any help would be fantastic!
Thank you so much,
Casey
0 Response to IPFraking - How to account for population totals?
Post a Comment