stan-dev / stan-dev/rstan

Error when running 8schools exampel model

Open
#688 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided 8schools.R reproduction with RStan 2.19.2 and R 3.6.1 on Windows, focusing on the failure during stan() after optimizing() succeeds. Trace the sort.matrix call and the reported validity warning, then verify the example completes without the unused partial argument error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.