Closed pgajer closed 6 years ago
Hi, thanks for letting me know. I made some recent changes that must have introduced a bug. I will try to get this resolved as soon as possible, but may need a few days to get to it.
Jim
On Mon, Nov 27, 2017 at 9:25 AM, Pawel notifications@github.com wrote:
Hi,
I found this example for spmrf binomial model
data(rain) tokyo.dat <- list(J=nrow(rain), N=rain$n.years, y=rain$n.rain) pars.H <- c("theta", "tau", "gam", "sigma") tokyo.fit <- spmrf( prior="horseshoe", likelihood="binomial", order=1, data=tokyo.dat, par=pars.H)
which generates the following error
Error in spmrf(prior = "horseshoe", likelihood = "binomial", order = 1, : number of observations N must equal length of y In addition: Warning message: In if (length(data$y) != data$N) stop("number of observations N must equal length of y") : the condition has length > 1 and only the first element will be used
After changing data list to
tokyo.dat <- list(J=nrow(rain), N=nrow(rain), y=rain$n.rain)
the error reads
Error in stanc(file = file, model_code = model_code, model_name = model_name, : c++ exception (unknown reason)
Thanks in advance for help with this :) pawel
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jrfaulkner/spmrf/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/AKVwoIZq0TbkCz_bTUGjUInGszYsWRXoks5s6vCmgaJpZM4Qr_-V .
Turns out in the check for the presence of length scalar N of observation vector y, R was confusing the variable N with the variable Nsize, which is the number of binomial trials associated with each number of binomial successes in y. This is a case when allowing partial specification of a variable name is problematic. I changed the Nsize variable name to sizeN, which fixed the problem. Check the example in the rain data set to see how to set up a data list for a binomial data set. Thanks again to Pawel for discovering this bug!
Hi,
I found this example for spmrf binomial model
data(rain) tokyo.dat <- list(J=nrow(rain), N=rain$n.years, y=rain$n.rain) pars.H <- c("theta", "tau", "gam", "sigma") tokyo.fit <- spmrf( prior="horseshoe", likelihood="binomial", order=1, data=tokyo.dat, par=pars.H)
which generates the following error
Error in spmrf(prior = "horseshoe", likelihood = "binomial", order = 1, : number of observations N must equal length of y In addition: Warning message: In if (length(data$y) != data$N) stop("number of observations N must equal length of y") : the condition has length > 1 and only the first element will be used
After changing data list to
tokyo.dat <- list(J=nrow(rain), N=nrow(rain), y=rain$n.rain)
the error reads
Error in stanc(file = file, model_code = model_code, model_name = model_name, : c++ exception (unknown reason)
Thanks in advance for help with this :) pawel