stan-dev / stan-dev/rstanarm

posterior_predict not working with newdata argument for stan_glm models

Open
#223 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary:

When using posterior_predict with newdata argument on stan_glm model I get error messages.

Description:

Depending on whether I put the formula in quotes or not when running stan_glm determines what kind of error message I get. If I put the formula in quotes I get the Error in formula(object)[[2L]] : subscript out of bounds as mentioned here https://github.com/stan-dev/rstanarm/issues/85.
If I don't use quotes I get an error message saying:
Error in eval(expr, envir, enclos) : object 'xxx' not found where 'xxx' is the name of the dependent variable in the formula, which doesn't seem relevant when making predictions.

I've also tried switching the function to stan_glm.nb (and removing family argument) and the posterior_predict function with newdata argument works fine.

RStanARM Version:

2.15.3

R Version:

3.3.3

Operating System:

Windows 10 1703 64bit

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 reproducing the reported errors in posterior_predict for a stan_glm model when newdata is supplied, comparing quoted and unquoted formulas and the working stan_glm.nb case. Trace the interaction between stan_glm and posterior_predict; done means predictions with newdata work without either reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.