hanchenphd / GMMAT

Generalized linear Mixed Model Association Tests
Other
36 stars 22 forks source link

how to add SNP*time interaction in glmmkin and glmm.score? #31

Closed ConnieXuhm closed 3 years ago

ConnieXuhm commented 3 years ago

Dear @hanchenphd @agilly @duytpm16 , I am using glmmkin and glmm.score for longitudinal study. I wanna see if there is a SNP*time interaction to reveal the effect of disease progression, and I wonder if I could put the interaction module into equation. Here is my present code:

model0<-glmmkin(SEVERE~time+AGE+SEX,id="work.ID",random.slope="time",data=cov_long,kins = GRM, family = gaussian(link = "identity"))
glmm.score(model0,infile="post_imputed_01.gds",outfile="GMMAT_LDA.txt",ncores=28)

I think may be I should change my equation to : SEVERE~time+AGE+SEX+SNP+SNP*time+(1+time|id), just like the lme4 does. But how can I achieve this in GMMAT? Looking forward to your reply, thanks so much!

hanchenphd commented 3 years ago

Thank you for your interest in GMMAT. For SNP x covariate interactions, please check out the glmm.gei function in our companion package MAGEE.

Best, Han

ConnieXuhm commented 3 years ago

Thank you for your interest in GMMAT. For SNP x covariate interactions, please check out the glmm.gei function in our companion package MAGEE.

Best, Han

Thanks a lot! I will try.

ConnieXuhm commented 3 years ago

Hi Chen, I followed your suggestions using MAGEE for longitudinal study. However, both my data and the example data meet an error. Here I use example data (pheno2) as an example.

library(GMMAT)
library(MAGEE)
data(example)
attach(example)
model0<-glmmkin(y.trend~sex+time,data=pheno2,id="id",kins="GRM", family=gaussian(link="inverse"))   #it runs normal
infile<-system.file("extdata","geno.gds","package="MAGEE")
gds_outfile<-tempfile()
glmm.gei(model0,interaction='sex',geno.file=infile,outfile=gds_outfile)

Here is the error: Error in as(x,"matrix")[i,,drop=drop]:subscript out of bounds

Also, I can run non-longitudinal data smoothly in pheno file. I tried to change interaction variable as "time", or change the family module, which were no change of the error. Could you help me with this? Thanks again!

hanchenphd commented 3 years ago

Cross-posted in MAGEE.