Which one of these two packages to use (coxph vs svycoxph) for cox proportional hazard model using NHANES database? 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)
Image
 
svycoxph(Surv(time_after_exm, mortstat_logical==2) ~ bicarbonate + 
       age + sex + race + poor + insurance + education, data = 
       nhanes_data_noNA, design = nhanes_svydesign)

I

 A: 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
A: 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. 
