Optimizes AME model storage by converting matrices to sparse format.
Details
When use_sparse_matrices = TRUE, the posterior-mean matrices
YPM and EZ are converted to sparse storage via the
Matrix package, but only when a matrix's nonzero density is below
0.5 – converting a dense posterior-mean matrix would grow memory,
so denser matrices are left as ordinary dense matrices. For lame
fits, where YPM/EZ are per-period lists, the check and
conversion are applied per element. The additive-effect summaries
APM/BPM are named numeric vectors and are never converted.
Names and dimnames are preserved.