Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft #2

Merged
merged 7 commits into from
Oct 11, 2024
Merged

Draft #2

merged 7 commits into from
Oct 11, 2024

Conversation

richfitz
Copy link
Member

@richfitz richfitz commented Oct 8, 2024

This won't pass until mrc-ide/odin2#71 is merged as it relies on that

@richfitz richfitz marked this pull request as ready for review October 9, 2024 08:28
@richfitz richfitz requested a review from weshinsley October 9, 2024 08:28
Copy link
Contributor

@weshinsley weshinsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts so far

```

There are a few things to note here:

* equations are defined out of order; we just will things into existance and trust `odin` to put them in the right order for us (much more on this later)
* equations are defined out of order; we just will things into existence and trust `odin` to put them in the right order for us (much more on this later)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check three lines below the apostrophe after "equations"

odin.qmd Outdated Show resolved Hide resolved
```

The result of this is a function which creates a `dust_system_generator` object, which we can use with functions from `dust2` to simulate from this model.
The `odin()` function will compile (more strictly, [transpile](https://en.wikipedia.org/wiki/Source-to-source_compiler)) the odin code to C++ and then compile this into machine code and load it into your session.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above- I wonder if somewhere near line 21, we need to say what we mean by "model" and what we mean by "system". It overlaps but I guess my understanding is that the model is the science model, essentially the dS, dI, dR that we might write out on paper to describe the SIR model, and the "system" is everything within the odin({...}) bracket that implements the model, which needs initialisation and parameterisation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything is a model is the problem :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a big callout

time.qmd Outdated Show resolved Hide resolved
```

Consider just about the simplest interesting "system" of ODEs, the logistic equation:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also include this in maths notation and/or link to wikipedia about the logistic equation...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a link for now

y <- dust_unpack_state(sys, y)
plot(t, y$incidence, type = "s", xlab = "Time", ylab = "Incidence")
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could make it even more obvious:

Our step is a quarter of a day, so we see four levels of incidence per day, with the last being the daily peak.

```

The reported values are here are at the *end* of each step, so rarely see an incidence of 0 except at the very start and end of the simulation. What we really care about are the values at the end of each day though where it reaches a peak:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and again we could be brutally obvious and say "Let's run again with a timestep of 1 day"

```

This has run the model to the point where we have the first observed data (time `r d$time[[1]]`), this time without returning any data to R, then we have used `dust_system_compare_data` with the first row of data. This returns a vector of 10 likelihoods -- one per particle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the first time we have mentioned "particle"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a callout about this

monty.qmd Outdated Show resolved Hide resolved
@@ -0,0 +1,52 @@
# Packaging odin models
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one isn't emerging into the HTML version yet?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks

richfitz and others added 2 commits October 11, 2024 16:17
Co-authored-by: Wes Hinsley <w.hinsley@imperial.ac.uk>
@richfitz richfitz merged commit a9e9a75 into main Oct 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants