This is the problem that I am running into. To choose the best way of doing cox proportion.

There are two functions available in R - one is coxph and the other is svycoxph which is for survey objects. I am more inclined to using the svycoxph as we are able to specify weights, id, and cluster information of the nhanes survey.

With this I tried to make models for cancer mortality (mortstat_logical == 2 is cancer here) for bicarbonate levels. I adjusted for demographic parameters. I checked for violation of cox proportional hazard assumption and found that it is not being violated (using function cox.zph).

*Here I am using bicarbonate as a continuous variable because I wasn't getting much signal when I had split them into categories. To ensure that I am in the right direction, I modelled using the continuous variable which should ideal give the right direction and a p value <0.05 (based on earlier publications).

When I made this model using coxph I found that higher bicarbonate levels lead to lesser mortality by cancer (p = 0.006) as suggested by previous publications as well. But coxph was done without strata, id and weights. So I tried the svycoxph. But I found that here bicarbonate was no longer significant.

coxph(Surv(time_after_exm, mortstat_logical==2) ~ bicarbonate + 
       age + sex + race + poor + insurance + education, 
       data = nhanes_data_noNA)
svycoxph(Surv(time_after_exm, mortstat_logical==2) ~ bicarbonate + 
       age + sex + race + poor + insurance + education, data = 
       nhanes_data_noNA, design = nhanes_svydesign)


enter image description hereenter image description hereenter image description hereenter image description here


2 Answers 2


The fact that a study oversampling certain types of persons does not imply that the sampling weights should be used in the analysis. Use of sample weights causes upweighting of certain individuals which by necessity (since the total sample size is fixed) leads to downweighting of other individuals. Though sampling statisticians will hate this idea, sample weights should be used only when computing estimates of population averages. This is done at the post-regression-coefficient-estimation phase. Example: Suppose that a study oversampled males. The best estimate of the sex effect uses the unweighted sample values and must suffer a little from the sex ratio not being 1:1. The idea is to use full information by conditioning on all covariates. Once you condition on sex=male to get a survival estimate, one does not need to take into account that P(sex=male) > 0.5 from our unequal probability sample

  • $\begingroup$ In my environment, this is a common point of discussion, and I woyld love if you have a good reference for this irrelevance of sampling weights! $\endgroup$ Dec 9, 2021 at 12:13
  • 1
    $\begingroup$ This has been discussed for decades but I have not collected references. Think of it this way: if you want to develop an estimator that has maximum variance, then disrespect the sample sizes that occurred in the study. Sampling statisticians tend not to fully understand conditioning. And their resulting population averaged estimates do not apply to individuals. We are usually concerned with individual decision making, not group decision making. $\endgroup$ Dec 9, 2021 at 12:23

Dealing with NHANES, you shall use svycoxph to account of psu strata and weights, with the subset option to refer to the dataset without NA. If you don't, you have biased results as the not weighted population is oversampling different subpopulations. I'd say that passing a filtered data frame as data in the svycoxph is also origin of bias, but I am not 100% sure about how this is implemented in the source code. Would use the most safe subset option as given by the examples of svycoxph.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.