set_user123
set_user123

Reputation: 21

Sommer Package: mmer prediction error because of singular matrix

I am running a GxE mixed model in Sommer, with the environments as a fixed factor and genotypes as a random factor with a GRM as covariance structure (G_GY). For the interaction term, the covariance structure EA is the kronecker product of G_GY with a diagonal matrix with the environments as row and columns and 1's on the diagonal and all other values set to zero (the same as done here in section 4: https://cran.r-project.org/web/packages/sommer/vignettes/v4.sommer.gxe.pdf). The model then looks as follows:

sommer_model <- mmer(norm.across.env ~ env, naMethodY = "include",
                     random = ~ vsr(genotype_id, Gu = G_GY) + 
                                vsr(env:genotype_id, Gu = EA),
                     data=df_data_GY, rcov = ~ units, verbose=FALSE)

I then use the predict() function as such:

Dt4 <- sommer_model4$Dtable          
Dt4[1:4,"include"] <- T          
p <- predict(object = sommer_model, Dtable = Dt4, D = "env:genotype_id") 

However, here I get the following warning:

Warning message: In solve(WtViW) : LAPACK 'dgetrf': matrix is exactly singular, U[i,i]=0, i=409

If I run the model without the interaction term and then use predict() this warning does not occur, so it seems to be a problem with the EA matrix being singular. I tried adding small values to the diagonal of EA, to the entire matrix of EA, as well as setting the argument tolParInv to increasingly higher values, but to no avail. Looking at the EA matrix, it has 10682 rows and rankMatrix(EA)[1] shows a rank of 10682, meaning that the matrix is actually full rank and therefore cannot be singular. If I run solve(EA), this function is able to produce the inverse matrix and no error is produced. So I do not understand why mmer shows this warning. Does the warning perhaps pertain to a different matrix that is created by mmer, which is then later used to produce the predictions?

The dataset is quite large, so I am unfortunately not able to provide a reproducible example, but I was wondering if anyone experienced a similar problem or can help me understand the mmer function a bit better.

Upvotes: 1

Views: 34

Answers (0)

Related Questions