jianyangqt / gcta

GCTA software
GNU General Public License v3.0
73 stars 23 forks source link

Error: XtWX is not invertible. #50

Closed lisongmiller closed 6 months ago

lisongmiller commented 1 year ago

Hi,

I am using gcta-1.94.1-linux-kernel-3-x86_64. When running the following code:

./gcta64 --bgen ukb_imp_pf_chr1.bgen \ --sample ukb_imp_pf_chr1.sample \ --grm-sparse sp_grm \ --joint-covar \ --fastGWA-mlm-binary \ --pheno "$phenoFile" \ --threads 10 \ --maf 0.005 \ --qcovar "$covarcFile" \ --covar "$covarbFile" \ --out output/geno_assoc

I get the error: The program will be running with up to 10 threads. Reading Oxford sample information file from [ukb_imp_pf_chr1.sample]... 26670 individuals to be included from the sample file. Reading phenotype data from [binary_pheno_lmm.txt]... 26670 overlapping individuals with non-missing data to be included from the phenotype file. 26670 individuals to be included. 9772 males, 16898 females, 0 unknown. Loading bgen index from [ukb_imp_pf_chr1.bgen.bgi]... Warning: GCTA reads sample information from '--sample' input, but ignores the built-in sample data. 26670 samples, 729034 SNPs. BGEN version 1.2, compressed by zstd. 729034 SNPs to be included from bgen index file. Total SNPs included: 729034/729034. Threshold to filter variants: MAF > 0.005000. Reading quantitative covariates from [binary_covarc_lmm.txt]. 6 covariates of 26670 samples to be included. Reading discrete covariates from [binary_covarb_lmm.txt]. 4 covariates of 26670 samples to be included. 6 qcovar, 4 covar and 0 rcovar to be included. 26670 common individuals among the covariate files to be included. 26670 overlapping individuals with non-missing data to be included from the covariate file(s). Reading the sparse GRM file from [sp_grm]... After matching all the files, 26670 individuals to be included in the analysis. Fitting covariates jointly in the association analysis. Performing GLM to get the starting values of beta for the covariates... Error: XtWX is not invertible. An error occurs, please check the options or data

The phenotype is coded as 0 or 1. The error only prompts when adding the option --covar "$covarbFile" , my covar looks like this: FID IID SEX CENTER CHIP TYPE SEX: Two levels CENTER: 22 levels CHIP: 2 levels TYPE: 5 levels

I saw a post on the forum with the same issue without solutions. https://gcta.freeforums.net/search/results?captcha_id=captcha_search&what_at_least_one=Error%3A+XtWX+is+not+invertible.&who_only_made_by=0&display_as=0&g-recaptcha-response=03AAYGu2S7ZxmvphfglCW51rLahWdnQjlR-XTg1VFHKKhT60RwLZ3rcOFaVIzMRz5nlIBXGjz7o9oEvpq1yDowffCwdJpawVGcik_VVkY24BEp8UkpeZrkCBg32uzZNuLmYstVgm3C8rNahxaUIugzMPSW0O6A--3D6kYQm3UhL9fOFHNBcE7BMuwl5oe82AvzNpXU0eb3RuaDWjEKHTDvUThUQDUxcOw1IlhpZC5qBsU68_Ixqj0oSKMxLwI1hQr8bH0Vgs503Vs0iysbXiw0SrAqcP7yes7brEa1NabKhpqnlLfZnR1tu9VbFI3SPphUOqUmCkZZeedwgs-GBT0WfGVvgfFwIvResYwhwumSaicSG_egWJz-RyZtFg7y_opNpjHr-clBkVgSeuW3nSx2Z4uQsbJrhZkS8GHij0YqeFDQ8p4yyGZEHu4uBnANX9wnkdtcw7xUSfPAmljb8_8NzwZnoUMzLdH88-xij-ic4obeocbcED7qlRUHVrSUvzn5BeqamwljbjYv8MKm8h82FtmS2bQ6CjbWUGWVX7Cd9JA50FSV7trM73M

Thanks for looking into this! Best, Song

alexanderplatt commented 6 months ago

Same issue here. No covariates used, phenotype file is quantitative.

118247316 SNPs to be included from BIM file(s).
Reading the sparse GRM file from [FACE.GOLD.chr1.grm_sp_grm]...
After matching all the files, 971 individuals to be included in the analysis.
Performing GLM to get the starting values of beta for the covariates...
Error: XtWX is not invertible.
An error occurs, please check the options or data
longmanz commented 6 months ago

Hi both,

This issue is mostly driven by un-invertible model matrix (X). @lisongmiller Please check your covariate files, and make sure the final X matrix (i.e., the X after removing individuals with NA phenotypes) is invertible. I know your initial Covar file contains different covariates with multiple levels, but some of them might not contain multiple levels after you do the NA filtering on phenotype.

@alexanderplatt Please use fastGWA-mlm instead of -glmm if your phenotype is quantitative.