stan-dev / stan-dev/rstan

return value of optimizing omits log_p and log_g

Open
#581 0 comments 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:

The documentation for rstan::optimizing says that the return value includes components log_p and log_g if draws>0. It does not.

Description:

See above.

Reproducible Steps:

Run the following lines:

m <- rstan::stan_model(model_code = 'data { int N; vector[N] y; } parameters {real mu; real<lower=0> sigma; } transformed parameters { real mu1 = 2.0 * mu; } model {y ~ normal(mu,sigma); }')
f <- rstan::optimizing(m, hessian = TRUE, draws=10, data=list(N=1000, y=rnorm(1000, 0.5, 1)))
Current Output:

The return value f contains only par, value, return_code, hessian, and theta_tilde.

Expected Output:

There should be components log_p, described in the documentation as "a vector of length draws that contains the value of the log-posterior evaluated at each row of theta_tilde", and log_g, described in the documentation as "a vector of length draws that contains the value of the logarithm of the multivariate normal density evaluated at each row of theta_tilde."

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

Run the reproducible R example with rstan::optimizing and inspect the returned components of f. Compare those components with the documented log_p and log_g descriptions, then update the implementation or documentation so the documented return value and actual result agree; verify the behavior with a focused test or reproduction.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.