stan-dev / stan-dev/rstanarm

`expose_stan_functions` fails for rstanarm model

Open
#330 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:

expose_stan_functions is a really useful utility and I'd like to use it to hopefully speed up likelihood calculations. Related to #117. Unfortunately it doesn't work on rstanarm objects.

Description:

The function fails because the #included files are gone by run time. The simplest solution I can think of would be to inline all the includes at package build time.

Reproducible Steps:

Make an rstanarm model

res <- rstanarm::stan_glm(x ~ y, data = data.frame(x = rnorm(10), y = rnorm(10)))

then try to expose functions

rstan::expose_stan_function(res$stanfit)

errors with output:

could not find include file: #include /pre/Columbia_copyright.stan
Error in stanc(model_code = mc, model_name = "User-defined functions",  : 
  failed to parse Stan model 'User-defined functions' due to the above error.
RStanARM Version:

2.18.2

R Version:

3.5.1

Operating System:

Ubuntu 16.04

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 at the expose_stan_function entry point and reproduce the failure with the rstanarm stan_glm example in the issue. Investigate how the included files are handled at package build time and verify that exposing functions from the resulting stanfit no longer reports a missing include file.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.