I am analyzing NHANES data (https://wwwn.cdc.gov/nchs/nhanes/) which use a complex, multistage, probability sampling design.
I want to plot some data in Stata using a contour plot. With non-weighted data, I would use the following command
twoway contour dbq700 bmxbmi ridageyr if cohort == 1
For survey data, however, I need weights. Once I try to consider this using the following command below, I get an error message ( " weights not allowed ")
twoway contour dbq700 bmxbmi ridageyr if cohort == 1 [aw = wtdrd6y]
It doesn't work with the svy commands either. Is it impossible to draw contour plots in Stata with survey data?
I tried:
twoway contour dbq700 bmxbmi ridageyr if cohort == 1 [aw = wtdrd6y]
I got an error message as specified above.
It is not supported because weights could not make a difference to the results. That's my analysis.
Reduce the problem to a bare minimum in one dimension: At
x = 1I observey = 150and atx = 2I observey = 250. Where do I put a contour fory = 200? Evidently, the example is contrived, so that it is clear that the contour should be placed atx = 1.5.Now add the information that at
x = 1I have the equivalent of 12 observations and atx = 2I have the equivalent of 666 observations.That information doesn't change the answer.
If you were considering the calculation as statistical, then knowing weights could be fed into some quantification of uncertainty, but contouring is a deterministic calculation.
That said, it seems likely that statistically you need a different analysis. Predicting what is geometrically a response surface with two predictors should indeed, however you do it, use information on weights, but that is a different question altogether.