stan-dev / stan-dev/rstan

Request: Reverse direction of lookup()

Open
#452 0 comments 1 reaction 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:

lookup() currently translates from an R function to a Stan function. It would be nice to allow the converse, translating from a Stan function to an R function.

Description:

I am working on an R package (blavaan) where I know the prior on each model parameter in Stan syntax, and I want to use R to generate random initial values from the prior. So I'd like to do the reverse of lookup(): I'd like to start with something like normal() and convert to dnorm(). This is easy to do with the rosetta object, but that object is not exported in rstan (so cannot be legally used by other packages). I see at least two possibilities here:

  1. Export rosetta so that it can be used by other packages.
  2. Add an argument to lookup() to tell it the desired direction (from R to Stan or from Stan to R).

If the second option is more desirable, I am happy to work on a pull request.

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 reading the existing lookup() interface and the unexported rosetta object described in the issue. Determine whether the public API should export rosetta or support Stan-to-R translation, and consider the issue complete when external R packages can perform the requested reverse lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.