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 wasnt 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)