Task 2c: How to Obtain Confidence Intervals for Geometric Means Using Stata

This task will provide you with a method to obtain confidence intervals for geometric means.

When the data are highly skewed you will need to transform them. For example, you can obtain the geometric mean by applying a log transformation to the data.

In this example, you will obtain geometric means for the fasting serum triglyceride variable. You can see that fasting triglycerides has a right skew by looking at the distribution with this command: sum lbxtr [w=wtsaf4yr], det – which shows that median value is 106 but the mean is 135. So, the geometric mean is a better representation of central tendency than the regular mean.

Obtain the mean and its standard error of the log transformed fasting serum triglyceride variable from the Stata command svy:mean and then use ereturn display, eform( ) to display the exponentiated coefficients (geometric mean, standard error and confidence interval).  The explanations in the summary table below provide an example that you can follow.

 

warning iconWARNING

There are several things you should be aware of while analyzing NHANES data with Stata. Please see the Stata Tips page to review them before continuing.

 

Step 1: Use svyset to define survey design variables

Remember that you need to define the SVYSET before using the SVY series of  commands. The general format of this command is below:

svyset [w=weightvar], psu(psuvar) strata(stratavar) vce(linearized)

 

To define the survey design variables for your fasting serum triglyceride analysis, use the weight variable for four-years of MEC data obtained from persons who fasted nine hours and were examined in the morning at the MEC(wtsaf4yr), the PSU variable (sdmvpsu), and strata variable (sdmvstra) .The vce option specifies the method for calculating the variance and the default is "linearized" which is Taylor linearization.  Here is the svyset command for four years of MEC data obtained from persons who fasted nine hours and were examined in the morning:

svyset [w= wtsaf4yr], psu(sdmvpsu) strata(sdmvstra) vce(linearized)