Skip to content

Missing plot in ODE section of user's guide #160

Closed

Description

@bbbales2

Summary:

The plot should be here: https://mc-stan.org/docs/2_22/stan-users-guide/measurement-error-models.html

Description:

Here's some R code that should produce a plot near what I think this was meant be:

library(tidyverse)
library(ggplot2)
library(deSolve)

f = function(t, y, parms) {
  return(list(c(y[2], -y[1] - 0.15 * y[2])))
}

out = ode(c(y0 = 1.0, y1 = 0.0), seq(1.0, 10.0, length = 10), f) %>%
  as_tibble() %>%
  gather(state, y, y0, y1) %>%
  mutate(y_noise = rnorm(length(y), y, 0.1))

out_highres = ode(c(y0 = 1.0, y1 = 0.0), seq(1.0, 10.0, length = 1000), f) %>%
  as_tibble() %>%
  gather(state, y, y0, y1)

out %>%
  ggplot(aes(time, y_noise)) +
  geom_point(aes(color = state)) +
  geom_path(data = out_highres, aes(time, y, group = state, color = state),
            linetype = "dashed")

Presumably it'll need formatted to be like other plots in the manual.

(edit: added missing libraries)

Current Version:

v2.22.0

Activity

  1. torkar commented on Apr 17, 2020

    @torkar
    Contributor

    @bbbales2 , I'm not 100% sure but I think I fixed this on GitHub last week. Can you check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions