stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.04k stars 268 forks source link

Error when running 8schools exampel model #688

Open Craig44 opened 5 years ago

Craig44 commented 5 years ago

Summary:

I get the following error Error in sort.matrix(x, partial = half + 0L:1L) : unused argument (partial = half + 0:1)

Description:

I have updated R and found when running my stan models that I get the error above. I re-ran the 8schools.cpp example to see if it wasn't just my models but that also produced the error. I assume it is something to do with versions

Reproducible Steps:

I get re-running 8schools.R, added below

library("rstan")
## change some settings
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())

## setwd
schools_dat <- list(J = 8, 
                    y = c(28,  8, -3,  7, -1,  1, 18, 12),
                    sigma = c(15, 10, 16, 11,  9, 11, 10, 18))

## useful for debugging.
Debug = stanc("8schools.stan") 
Debug$status

#optimize using mle
school_model = stan_model("8schools.stan")

mle = optimizing(school_model,data=schools_dat,
                 iter=2000,algorithm="LBFGS",
                 verbose=FALSE,as_vector = FALSE)  
## optimisation is fine

## run MCMC.
fit <- stan(file = '8schools.stan', data = schools_dat, 
            iter = 1000, chains = 4)
## Error produced here

Current Output:

Error in sort.matrix(x, partial = half + 0L:1L) : unused argument (partial = half + 0:1)
In addition: Warning messages:
1: In validityMethod(object) :
  The following variables have undefined values:  A_non_used_container. Many subsequent functions will not work correctly.
2: There were 2 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup 
3: Examine the pairs() plot to diagnose sampling problems

Expected Output:

No error

RStan Version:

‘2.19.2’

R Version:

R version 3.6.1 (2019-07-05)

Operating System:

Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
bgoodri commented 5 years ago

With what 8schools.stan?