JenniNiku/gllvm

sparse matricies

Closed this issue · 2 comments

Great package! Love it!

Feature request: allow matricies to be handled as sparse matricies.

The slowest step according to profvis is MASS::ginv, in some applications, presence/absence data is sparse. In these cases, sparse matrix algorithms may improve performance. Could you add an option to allow matricies to be handled as sparse matricies?

Thanks!

Thanks!

Can you provide a little more details on how you expect a sparse response matrix to speed up model fitting?

  1. A sparse response matrix is an intriguing idea, although that assumes that it is really the response matrix that slows things down. That might be true, but only when the number of observations becomes extraordinary large would I expect it to truly make a difference, and it has nothing to do with calls to MASS::ginv.

  2. MASS::ginv inverts a block of the asymptotic precision matrix, which will not be any different if we evaluate the responses as a sparse matrix. We might benefit from explicitly calling each block as a sparse matrix, if they are truly sparse, which will depend on the model being fitted I suppose.

If you're worried about the inversion taking long, make sure to add sd.errors = FALSE to your model call in order to prevent it from happening.

Thank you for the answer,

For some reason I thought we were inverting the response matrix, please ignore my question.