I have a package on CRAN called 'metapack' and received a message from Professor Ripley that the error must be resolved for the package to be safely retained in CRAN. I've encountered this error on R-CMD-check on GitHub but cannot replicate it on any of my local machines to save my life. The reproducible code snippet is as follows (I use Rcpp/RcppArmadillo):
library(metapack)
data("cholesterol")
Outcome <- model.matrix(~ pldlc + phdlc + ptg, data = cholesterol)
SD <- model.matrix(~ sdldl + sdhdl + sdtg, data = cholesterol)
Trial <- cholesterol$Trial
Treat <- cholesterol$trt
Npt <- cholesterol$Npt
XCovariate <- model.matrix(~ 0 + bldlc + bhdlc + btg + age + durat + white + male + dm, data = cholesterol)
WCovariate <- model.matrix(~ trt, data = cholesterol)
fmodel <- 1
set.seed(2797542)
fit <- bayes.parobs(Outcome, SD, XCovariate, WCovariate, Treat, Trial,
Npt, fmodel, mcmc = list(ndiscard = 1, nskip = 1, nkeep = 1),
scale_x = TRUE, group = cholesterol$onstat, verbose = FALSE)
which gives me the following error:
warning: chol(): given matrix is not symmetric
error: chol(): decomposition failed
This can't be true because (1) it runs without problem on other machines, (2) every matrix that is Cholesky-decomposed is ensured to be symmetric through Sig = 0.5 * (Sig + Sig.t());
. Even with Sig = arma::symmatu(Sig)
doesn't seem to guarantee symmetry.
Has anyone encountered something similar to this?