wbonat / mcglm

Fitting multivariate covariance generalized linear models
GNU General Public License v3.0
21 stars 5 forks source link

mc_sic multiresponse error #14

Closed uasolo closed 5 years ago

uasolo commented 5 years ago

hi and many many thanks for the package! I get this error when I run mc_sic on a multiresponse model: Error in inv_C %*% res : Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90

Reproducible code, slight modification of the example code in mc_sic man page. (I am running mcglm version 0.4.0, R version 3.5.2 on Ubuntu 16.04).

x1 <- runif(100, -1, 1) x2 <- gl(2,50) beta1 = c(5, 0, 3) beta2 = c(15, 2, 1) X <- model.matrix(~ x1 + x2) y1 <- rnorm(100, mean = X%%beta1 , sd = 1) y2 <- rnorm(100, mean = X%%beta2 , sd = 1) data <- data.frame(y1, y2, x1, x2) fit0 <- mcglm(c(y1 ~ 1, y2 ~ 1), list(mc_id(data), mc_id(data)), data = data) mc_sic(fit0, scope = c("x1", "x2"), data = data, response = 1)

error here

fiddling with mc_sic arguments does not help. Any solution? Many thanks!

wbonat commented 5 years ago

Hi, We have a bug here! Sorry! I will fix it asap. For now, I would suggest to perform the selection using univariate models instead of the multivariate one. The final result will be the same, because the selection is done for each response that's why you have to choose the argument response = 1.

x1 <- runif(100, -1, 1) x2 <- gl(2,50) beta1 = c(5, 0, 3) beta2 = c(15, 2, 1) X <- model.matrix(~ x1 + x2) y1 <- rnorm(100, mean = X%%beta1 , sd = 1) y2 <- rnorm(100, mean = X%%beta2 , sd = 1) data <- data.frame(y1, y2, x1, x2)

fit0 <- mcglm(c(y1 ~ 1), list(mc_id(data)), data = data) mc_sic(fit0, scope = c("x1", "x2"), data = data, response = 1)