Skip to content

fit_nullmodel() fails with “Not a matrix” when sparse GRM is supplied #85

@komais

Description

@komais

Hello,

 obj_nullmodel <- fit_nullmodel(pheno ~ PC1 + PC2 + PC3 + PC4 + PC5 + PC6 + PC7 + PC8 + PC9 + PC10,
    data = phenotype, kins = sgrm, use_sparse = TRUE, kins_cutoff = 0.022, id = "FID",maxiter=10,
    family = binomial(link = "logit"), verbose = TRUE, groups = NULL
) 

got an error:

Fixed-effect coefficients:
 (Intercept)          PC1          PC2          PC3          PC4          PC5
 -5.87561278 472.44855848 -93.49517238  -1.13570207   8.72329401  -6.69928427
         PC6          PC7          PC8          PC9         PC10
 -2.93669950  -0.06602734  -1.28533097   3.12009658   1.54106524

Iteration  1 :
Error in glmmkin.brent(fit0, kins[[1]], method = method, maxiter = maxiter,  :
  Not a matrix.
In addition: Warning messages:
1: glm.fit: algorithm did not converge
2: Average Information REML not converged, refitting model using Brent method...

i have sgrm looks like

str(sgrm)
Formal class 'dsCMatrix' [package "Matrix"] with 7 slots
  ..@ i       : int [1:347] 0 0 1 2 2 3 4 4 5 6 ...
  ..@ p       : int [1:344] 0 1 3 4 6 7 9 10 12 13 ...
  ..@ Dim     : int [1:2] 343 343
  ..@ Dimnames:List of 2
  .. ..$ : chr [1:343] "0_HG00475" "0_HG00542" "0_HG00581" "0_HG00607" ...
  .. ..$ : chr [1:343] "0_HG00475" "0_HG00542" "0_HG00581" "0_HG00607" ...
  ..@ x       : num [1:347] 0.501 0.0626 0.4098 0.4996 0.0525 ...
  ..@ uplo    : chr "U"
  ..@ factors : list()

how can i fix this error ?
thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions