stan-dev / stan-dev/rstan

optimizing fails on simple example when draws > 0

Open
#580 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary:

Running the simple example given in the documentation for rstan::optimizing, but adding a nonzero value for draws, results in an error.

Description:

The documentation for rstan::optimizing gives the following example code:

m <- stan_model(model_code = 'parameters {real y;} model {y ~ normal(0,1);}')
f <- optimizing(m, hessian = TRUE)

This runs fine, but if I add a nonzero draws parameter

m <- stan_model(model_code = 'parameters {real y;} model {y ~ normal(0,1);}')
f <- optimizing(m, hessian = TRUE, draws=10)

it fails with this error:

Error in dimnames(x) <- dn : 
  length of 'dimnames' [2] not equal to array extent
Reproducible Steps:

See above.

Current Output:

See above.

Expected Output:

Successful completion of call.

RStan Version:

2.18.1

R Version:

R version 3.4.3 (2017-11-30)

Operating System:

macOS High Sierra (version 10.13.6)

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 documented rstan::optimizing example with hessian = TRUE and then with draws = 10, using the reported RStan and R versions if available. Trace the optimizing entry point and the result construction that raises the dimnames error; done means the draws example completes successfully while the original example remains working.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.