stan-dev / stan-dev/rstanarm

stan_lm silently ignores autoscale argument if prior_intercept is normal

Open
#353 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
R
Stars
401
Forks
136
PR merge metrics
No merged PRs in 30d

Description

Summary:

stan_lm() (really stan_biglm.fit and everything it's used for) seems to silently ignore the autoscale argument to normal() when used for prior_intercept. @bgoodri Is ignoring autoscale a bug or intended? I guess regardless of whether it's a bug or not, I don't think it should be silent.

Reproducible Steps:
# fit same model with same seed, only difference is autoscale argument
fit <- stan_lm(mpg ~ wt + qsec + am, data = mtcars, 
               prior = R2(0.75), prior_intercept = normal(0, 10, autoscale=TRUE),
               chains = 1, iter = 500, seed = 12345)
fit2 <- update(fit1, prior_intercept = normal(0, 10, autoscale=FALSE))

# draws are identical
identical(as.matrix(fit1), as.matrix(fit2)) 
[1] TRUE
RStanARM Version:

2.18.9

R Version:

3.5.2

Operating System:

OS X 10.12.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 with the stan_lm() and stan_biglm.fit paths that process prior_intercept and the normal() autoscale argument. Reproduce the two fits from the issue, then trace why their draws are identical and determine whether the intended fix is to apply autoscale or report that it is ignored; add a regression test for the chosen behavior.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.