avehtari / ROS-Examples

Regression and other stories R examples
https://avehtari.github.io/ROS-Examples/
323 stars 257 forks source link

Error when running Storable Vignette (stan_polr) #130

Open bsbodden opened 1 year ago

bsbodden commented 1 year ago

The call to stan_polr in:

fit_1 <- stan_polr(factor_vote ~ value, data = data_401,
                   prior = R2(0.3, "mean"), refresh = 0)

Produces the error:

Error in cor(obs, pred, use = ifelse(na.rm, "complete.obs", "everything")) :
'x' must be numeric
  5. stop("'x' must be numeric")
  4. cor(obs, pred, use = ifelse(na.rm, "complete.obs", "everything"))
  3. R2(0.3, "mean")
  2. stan_polr.fit(x = x, y = y, wt = wt, offset = offset, method = method,
            prior = prior, prior_counts = prior_counts, shape = shape,
            rate = rate, prior_PD = prior_PD, algorithm = algorithm,
            adapt_delta = adapt_delta, do_residuals = do_residuals, ...)
1. stan_polr(factor_vote ~ value, data = data_401, prior = R2(0.3, "mean"), refresh = 0)

Versions:

R version 4.2.3 (2023-03-15)
> packageVersion("rstanarm")   
[1] ‘2.21.4’
andrewgelman commented 1 year ago

It's a bug, something to do with R, it's getting fixed.