stan-dev / stan-dev/math

Interpolation function(s)

Open
#58 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature new function
Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

From @edbaskerville on December 9, 2014 23:33

It would be nice if Stan had some simple one-dimensional interpolation methods built in. (Not super-important, since this should be doable within a Stan model.)

One place this issue arises when implementing ODE models driven by empirical data sampled at discrete time intervals. Because the time derivative needs to be evaluated at arbitrary time points, the values of the driving variables need to be evaluated between sample times.

Even linear interpolation would be sufficient for many cases: e.g.,

data {
  int nTimepoints;
  real[nTimepoints] x;
}
// ...
x_t <- interpolate_linear(x, t);

would result in x_t equal to a value linearly interpolated from x[i], x[i + 1], where i <= t <= i + 1.

Copied from original issue: stan-dev/stan#1165

Contributor guide

Open the contributing guide

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

No files, tests, or entry points are named in the issue. Start by reviewing the proposed one-dimensional interpolation API and its use in ODE models with discretely sampled data; done would require an agreed interpolation interface and behavior for the stated example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data
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.