xihaoli / STAARpipeline-Tutorial

The tutorial for performing single-/multi-trait association analysis of whole-genome/whole-exome sequencing (WGS/WES) studies using FAVORannotator, STAARpipeline and STAARpipelineSummary
GNU General Public License v3.0
26 stars 17 forks source link

Applying the STAAR pipeline to binary traits #69

Closed sawakof closed 1 month ago

sawakof commented 1 month ago

Hello. I am trying to run the STAARpipeline on WES data with a binary trait. I successfully created the aGDS and GRM, but when applying the Null Model, since it is a binary trait, I used:

obj_nullmodel <- fit_nullmodel(PHENOTYPE~SEX+PC1+PC2+PC3+PC4+PC5+PC6+PC7+PC8+PC9+PC10+as.factor(FROM), data=phenotype,kins=sgrm,use_sparse=TRUE,kins_cutoff=0.1,id="Sample_Names", groups="FROM",family=binomial(link="logit"),verbose=TRUE)

Instead of family=gaussian(), I used family=binomial(link="logit").

However, I encountered the following error:

Error in glmmkin(fixed = fixed, data = data, kins = kins, id = id, random.slope = random.slope, : Error: heteroscedastic linear mixed models are only applicable when "family" is gaussian. Calls: fit_nullmodel -> glmmkin Execution halted

The glmmkin function does not work properly.

What should I do? Or is it difficult to apply STAAR to binary traits?

xihaoli commented 1 month ago

Hi @sawakof,

Thanks for your question. Heteroscedastic linear mixed models are used for quantitative phenotypes where heterogeneous group variances may exist. For binary phenotypes, due to the mean-variance relationship, you would set groups=NULL, and then STAAR applies.

Best, Xihao

sawakof commented 1 month ago

Thank you for your prompt response! As you mentioned, by setting group=NULL and removing +as.factor(FROM) to simplify the syntax, I was able to apply STAAR successfully. Also, thank you for your explanation of the statistical model. It was very informative and helpful for my understanding.