launch_shinystan - error in b %*% data%Zt

57 views
Skip to first unread message

g.huntingt...@gmail.com

unread,
Nov 28, 2016, 2:50:08 PM11/28/16
to Stan users mailing list
I'm receiving the following error when running luanch_shinystan against a stan_lmer object:

Error in b %*% data$Zt : 
  Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90

Anyone seen this before?

Ben Goodrich

unread,
Nov 28, 2016, 3:07:02 PM11/28/16
to Stan users mailing list

What was the stan_lmer() formula?
 

g.huntingt...@gmail.com

unread,
Nov 28, 2016, 3:09:50 PM11/28/16
to Stan users mailing list
The formula:

fit1 <- stan_lmer(Y ~ d*w + c
                  + (1|g1)
                  + (1|g2)
                  + (1|g3)
                  + (1|g4)
                  + (1|g5:g6)
                  , data = samp
                  , adapt_delta = .995)

Ben Goodrich

unread,
Nov 28, 2016, 3:30:03 PM11/28/16
to Stan users mailing list
On Monday, November 28, 2016 at 3:09:50 PM UTC-5, g.huntingt...@gmail.com wrote:
The formula:

fit1 <- stan_lmer(Y ~ d*w + c
                  + (1|g1)
                  + (1|g2)
                  + (1|g3)
                  + (1|g4)
                  + (1|g5:g6)
                  , data = samp
                  , adapt_delta = .995)

I'm guessing some interaction between g5 and g6 was collinear with g1, g2, g3, and g4. But we would have to be able to reproduce the error to know for sure.

Ben

g.huntingt...@gmail.com

unread,
Nov 28, 2016, 3:32:05 PM11/28/16
to Stan users mailing list
Ran the same model on the same data last week without issue. I reinstalled the rstanarm and shiny packages, and now I get not only that error but also this:

In addition: Warning message:
In pp_check.stanreg(object = list(coefficients = c(0.662893547323838,  :
  Argument 'check' is deprecated. Specify 'plotfun' instead. In future versions the 'check' argument will be removed.

On Monday, November 28, 2016 at 1:50:08 PM UTC-6, g.huntingt...@gmail.com wrote:

g.huntingt...@gmail.com

unread,
Nov 28, 2016, 3:42:15 PM11/28/16
to Stan users mailing list
Another oddity: the calculated error term for each random effect is the same.

Ben Goodrich

unread,
Nov 28, 2016, 3:43:07 PM11/28/16
to Stan users mailing list
On Monday, November 28, 2016 at 3:32:05 PM UTC-5, g.huntingt...@gmail.com wrote:
Ran the same model on the same data last week without issue. I reinstalled the rstanarm and shiny packages, and now I get not only that error but also this:

In addition: Warning message:
In pp_check.stanreg(object = list(coefficients = c(0.662893547323838,  :
  Argument 'check' is deprecated. Specify 'plotfun' instead. In future versions the 'check' argument will be removed.

We know about that warning message (since Jonah wrote it), but the first thing is probably a bug.

Ben

g.huntingt...@gmail.com

unread,
Nov 28, 2016, 3:45:52 PM11/28/16
to Stan users mailing list
OK. Anything else I can do to help squash it?

Ben Goodrich

unread,
Nov 28, 2016, 3:49:16 PM11/28/16
to Stan users mailing list
On Monday, November 28, 2016 at 3:45:52 PM UTC-5, g.huntingt...@gmail.com wrote:
OK. Anything else I can do to help squash it?

Maybe do options(error = recover) before triggering the error. You can paste the traceback and jump into the frame before the error to see what the dimensions and colnames of data$Zt are.

Ben

Jonah Gabry

unread,
Dec 2, 2016, 4:26:34 PM12/2/16
to Stan users mailing list
Sorry I missed this until now. Are you able to share the data you used when fitting the stan_lmer model so we can reproduce the original error? Or simulated data that results in the same problem would be fine.  

Thanks!

Jonah


On Monday, November 28, 2016 at 3:45:52 PM UTC-5, g.huntingt...@gmail.com wrote:

g.huntingt...@gmail.com

unread,
Dec 5, 2016, 12:28:02 PM12/5/16
to Stan users mailing list
So after masking the data to make it share-able here, I reran the model and no longer receive that specific error. My guess is that maybe it's related to the length of some of the factor level names, because that's the only thing that's changed about this data file compared to the one that generated the error.

However, the model still reports equivalent variances for all random effects. Any idea what's going on there, or should I start a new topic to address that?

library(rstanarm)
options(mc.cores = parallel::detectCores())

samp <- read.csv("rawdata.csv", header=TRUE)
samp$Yr <- factor(samp$Yr)
samp$Track <- factor(samp$Track)

fit <- stan_lmer(logP ~ 
                    Track
                  + logD
                  + logW
                  + logC
                  + (1|Yr)
                  + (1|SalesRep)
                  + (1|CustomerId)
                  + (1|OMkt:DMkt)
                  + (1|CarrierId)
                  , data = samp)

print(fit,digits=3)
launch_shinystan(fit)
rawdata.csv

Jonah Gabry

unread,
Dec 6, 2016, 5:15:34 PM12/6/16
to Stan users mailing list
Thanks for sharing. I don't think this is related to your model or data but rather to this bug: https://github.com/stan-dev/rstanarm/issues/137. It's now fixed on the develop branch on github. 

Jonah
Reply all
Reply to author
Forward
0 new messages