Hello,
I am analyzing a binary outcome (depvar) using melogit so that I may 1) account for the complex survey design and 2) include random effects for states. I am using 2019 Behavioral Risk Factor Surveillance System (BRFSS) data, which has data for (virtually) all states. I have worked with survey data in Stata before with no issues and have been reading Stata's multilevel mixed effect and survey data reference manuals, as well as previous forum posts. However, I have not been able to get the svyset command right which will allow me to run the models I need.
In case some background information would be helpful:
Each state collects BRFSS data based on phone numbers in the state. States use a disproportionate stratified sample design for the telephone landline samples, dividing the landline numbers into two strata. States also use random sampling to select cell phone numbers. In BRFSS, the design variables are sample weight: finalwt; stratification variable: _ststr; primary sampling unit variable: _psu. (Note: _psu is the same for a given state in a given year.)
To survey set my data, I used
When I tried to run a simplified melogit model with a random effect for states and a factor variable for age categories
I get the error "survey final weights not allowed with multilevel models;
a final weight variable was svyset using the [pw=exp] syntax, but multilevel models
require that each stage-level weight variable is svyset using the stage's corresponding
weight() option"
That makes sense (although there is only one weight variable given in BRFSS), so I tried other syntax:
But I get the error "hierarchical groups are not nested within _psu." I tried many different combinations of the svyset command, including
(Which gives the error "weight(finalwt) invalid ssu variable name")"But I have not been able to get the above model to run.
I would greatly appreciate any advice on properly survey setting the data so that I can run an melogit model with random effects for states. Thanks so much!
I am analyzing a binary outcome (depvar) using melogit so that I may 1) account for the complex survey design and 2) include random effects for states. I am using 2019 Behavioral Risk Factor Surveillance System (BRFSS) data, which has data for (virtually) all states. I have worked with survey data in Stata before with no issues and have been reading Stata's multilevel mixed effect and survey data reference manuals, as well as previous forum posts. However, I have not been able to get the svyset command right which will allow me to run the models I need.
In case some background information would be helpful:
Each state collects BRFSS data based on phone numbers in the state. States use a disproportionate stratified sample design for the telephone landline samples, dividing the landline numbers into two strata. States also use random sampling to select cell phone numbers. In BRFSS, the design variables are sample weight: finalwt; stratification variable: _ststr; primary sampling unit variable: _psu. (Note: _psu is the same for a given state in a given year.)
To survey set my data, I used
Code:
svyset _psu [pw = finalwt], strata(_ststr) singleunit(centered)
Code:
svy: melogit depvar i.age_cat || state:
a final weight variable was svyset using the [pw=exp] syntax, but multilevel models
require that each stage-level weight variable is svyset using the stage's corresponding
weight() option"
That makes sense (although there is only one weight variable given in BRFSS), so I tried other syntax:
Code:
svyset _psu, weight(finalwt)|| state, strata(_ststr)
Code:
svyset state, strata(_ststr) weight(finalwt)
I would greatly appreciate any advice on properly survey setting the data so that I can run an melogit model with random effects for states. Thanks so much!
Comment