0

When using the Hmsc package in R (https://github.com/hmsc-r/HMSC), I am getting a consistent error in some (not all) of the examples given in the vignettes as well as my own data. The error happens when running the sampleMcmc() function.

I have tried to ensure all of my data frames and matrices are in the same format as the working examples in the vignettes. Some of the examples, however, replicate the error message I get with my own data. For example:

library(Hmsc)
n = 50
x = rnorm(n)
alpha = 0
beta = 1
sigma = 1
L = alpha + beta*x
y = L + rnorm(n, sd = sigma)
Y = as.matrix(y)
XData = data.frame(x = x)
m = Hmsc(Y = Y, XData = XData, XFormula = ~x)
nChains = 2
thin = 5
samples = 1000
transient = 500*thin
verbose = 500*thin
m = sampleMcmc(m, thin = thin, samples = samples, transient = transient, nChains = nChains, verbose = verbose)

gives me the following error:

[1] "Computing chain 1"
Error in tcrossprod(x, y) : 
  requires numeric/complex matrix/vector arguments

My system info is :

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
 [1] LC_CTYPE=en_NZ.UTF-8       LC_NUMERIC=C               LC_TIME=en_NZ.UTF-8        LC_COLLATE=en_NZ.UTF-8    
 [5] LC_MONETARY=en_NZ.UTF-8    LC_MESSAGES=en_NZ.UTF-8    LC_PAPER=en_NZ.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] truncnorm_1.0-8 statmod_1.4.32  phytools_0.6-99 pROC_1.15.3     pdist_1.2       nnet_7.3-12     mvtnorm_1.0-11  MCMCpack_1.4-4 
 [9] Matrix_1.2-17   ggplot2_3.2.0   BayesLogit_0.6  abind_1.4-5     dplyr_0.8.3     fields_9.8-3    maps_3.3.0      spam_2.2-2     
[17] dotCall64_1.0-0 MASS_7.3-51.1   ape_5.3         corrplot_0.84   knitr_1.23      stringr_1.4.0   Hmsc_0.4.3.0    coda_0.19-3    

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2              lattice_0.20-38         snow_0.4-3              gtools_3.8.1            assertthat_0.2.1       
 [6] R6_2.4.0                plyr_1.8.4              MatrixModels_0.4-1      pillar_1.4.2            rlang_0.4.0            
[11] lazyeval_0.2.2          rstudioapi_0.10         SparseM_1.77            phangorn_2.5.5          combinat_0.0-8         
[16] splines_3.6.1           igraph_1.2.4.1          munsell_0.5.0           xfun_0.8                compiler_3.6.1         
[21] numDeriv_2016.8-1.1     pkgconfig_2.0.2         mnormt_1.5-5            mgcv_1.8-28             mcmc_0.9-6             
[26] tidyselect_0.2.5        tibble_2.1.3            expm_0.999-4            quadprog_1.5-7          withr_2.1.2            
[31] crayon_1.3.4            nlme_3.1-140            gtable_0.3.0            magrittr_1.5            scales_1.0.0           
[36] stringi_1.4.3           scatterplot3d_0.3-41    fastmatch_1.1-0         tools_3.6.1             glue_1.3.1             
[41] purrr_0.3.2             yaml_2.2.0              plotrix_3.7-6           colorspace_1.4-1        animation_2.6          
[46] clusterGeneration_1.3.4 quantreg_5.42.1

It would be great to understand why I am getting this error, and how to overcome it so that I can fix my real data set.

Thanks

1 Answers1

0

There was a bug and issue is resolved. See https://github.com/hmsc-r/HMSC/issues/17