Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gwasurvivr and R "survival" package give different results #7

Closed
Qiaolan opened this issue Feb 21, 2020 · 3 comments
Closed

gwasurvivr and R "survival" package give different results #7

Qiaolan opened this issue Feb 21, 2020 · 3 comments

Comments

@Qiaolan
Copy link

Qiaolan commented Feb 21, 2020

Hi,

I find that given the same genotype data and phenotype data. gwasurvivr and R survival package cox.ph() give different p-value (both significant, but p-values are quite different, for example, one might be 1e-6 and the other 1e-7)and coefs.

Could you please give me any help? Is there any possible reason?

Thanks!

@aarizvi
Copy link
Member

aarizvi commented Feb 21, 2020

Please send a reproducible example and I can look at it with you. In theory they shouldn't be off by an order of magnitude unless the genotyping (or imputation) quality is poor. We are using the same survival:::coxph.fit internal function in this package so the estimators are the same. The only difference is that in gwasurvivr we put in initial estimates that we obtain by fitting the model just the covariates first.

@Qiaolan
Copy link
Author

Qiaolan commented Feb 21, 2020

Thanks for your reply. I am sorry the data is in the server I cannot copy it.

Below are codes of two methods

  1. R survival::coxph:
    model <- coxph(Surv(age_onset,status) ~ cov_match[,28+i] +sex+pc1+pc2+pc3+pc4+pc5,data=cov_match,ties = "efron")

  2. gwasurvivr:

bed.file <- "data_clean/Two/cov_id.bed"
cov <- read.table("data_clean/Two/cov_match.txt",header=T)
sample.ids <- as.character(cov$merged_id)

plinkCoxSurv(bed.file=bed.file,
covariate.file=cov,
id.column="merged_id",
sample.ids=sample.ids,
time.to.event="age_onset",
event="status",
covariates=c("sex", "pc1","pc2","pc3","pc4","pc5"),
inter.term=NULL,
print.covs="only",
out.file= "/fs/project/PAS1501/gaolab/qldeng/Eden/data_clean/Two/result",
chunk.size=100,
maf.filter=0.01,
flip.dosage=TRUE,
verbose=TRUE,
clusterObj=cl)

I transferred bed file to 0/1/2 and it is contained in cov_match.txt used by cox.ph()

Also, I checked the source code of gwasurvivr and I did find that it uses coxph.fit() rather than coxph. Is there any difference? I find few manual about coxph.fit()

At last, you mentioned "The only difference is that in gwasurvivr we put in initial estimates that we obtain by fitting the model just the covariates first." When I use coxph() in R survial, is there anything I need to modify?

Thanks for your help!

@Qiaolan
Copy link
Author

Qiaolan commented Feb 25, 2020

Hi and thanks for your time!

Today I checked the sample data within the gwasurvivr package. The results of survival::coxph and gwasurvivr match. Moreover, I find there's no difference if I set initial values for coxph.fit, because both coxph and coxph.fit with initials gave me the same coefs. Is this possible?

At last, returning to my original problem, my data is case-only, that is, all subjects experienced the event. Is this a possible reason that two methods gave me different coefs?

Thank you!

@aarizvi aarizvi closed this as completed Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants