[R-sig-dyn-mod] Individual-based modelling

John Harrold john.m.harrold at gmail.com
Tue Jul 4 17:30:22 CEST 2017


Hello Sibylle,

It sounds like you are trying to construct a mixed-effects model?

https://en.wikipedia.org/wiki/Mixed_model

The way I do this is I construct an "individual" model like you have above.
Then along with the system parameters you've specified above, you also have
to specify the variability of these parameters. With the variability
specified, typically a variance/covariance matrix and an assumed
distribution for these parameters (e.g. lognormal), you generate
"subjects". That's a separate parameter set for each subject. And for each
"subject" and a given set of inputs you run a simulation. So if you
generate 1000 subjects, you run your above simulation 1000 times. The
outputs are collected and you have a distribution of predictions.

Is that what you're looking for or am I just way off on this one?

John


On Mon, Jul 3, 2017 at 4:49 AM Sibylle Mohr <Sibylle.Mohr at glasgow.ac.uk>
wrote:

> Dear all,
>
> I want to implement an individual-based model and am unsure how to go
> about this - here’s to hoping someone can point me in the right direction..
>
> I created a simple model (predator-prey like equations) which predicts the
> number of scab mites from serological data (i.e. immune response) on a
> **single** animal (see code below).
> Immune response grows with mite count here.
> Now I would like to extend the model from a single sheep towards an
> individual-based model representing the flock of animals with two initial
> states, “clinical” and "sub-clinical” depending on the how large the immune
> response is (i.e. small immune response = infested but no clinical signs).
> So I guess I have to questions:
>
> (a) How can I go from a single animal model to an individual-based
> population model?
> (b) How can I integrate this into a two-stage model?
>
> Any thoughts are most welcome.
>
> Many thanks & best wishes,
>
> Sibylle
>
>
> -------------------------------------------------------------------------------------------------------------------------
> The code:
>
> ## Immune response model
>
> require(simecol)
> require(deSolve)
>
> # P = number of scab mites,
> # E = ‘amount’ of protective immunity,
> # W = mites in environment
> # nu = intrinsic mite growth rate,
> # mu*E = per-capita mite death rate,
> # epsilon*P = per-capita growth of the immune response
> # alpha =  rate of decline of the immune response in the absence of
> antigenic stimulation
> # lambda = parasite environmental production
> # gamma= = parasite environmental death
> # beta = transmission rate
>
> ImmRespode <- {new("odeModel",
>                      main = function(time, init, parms){
>                        with(as.list(c(init, parms)),{
>
>                          dP <- P*(nu - mu*E)
>                          dE <- -E*(alpha - epsilon*P)
>                          dW <- (lambda*E) - (gamma*W) - (beta*W*P)
>
>                          list(c(dP, dE, dW))
>                        })
>                      },
>                      times = c(from = 0, to = 365, by = 0.01),
>                      init = c(P = 2, E = 2, W = 0),
>
>                      parms = c(nu = .11, mu = .01, epsilon = .00024, alpha
> = .00024, lambda = .05, gamma = .05, beta=.05),
>                      solver = "lsoda")
> }
> ImmRespode <- sim(ImmRespode)
>
> print(ImmRespode, all=TRUE)
> ImmRespodedata <- out(ImmRespode)       # ?simecol::out
>
> par(mfrow = c(1, 3))
> plot(ImmRespodedata[,1], ImmRespodedata[,3], type="l", xlab = "Time
> Period", ylab = "Immune response", col=2)
> plot(ImmRespodedata[,1], ImmRespodedata[,2], type="l", xlab = "Time
> Period", ylab = "Mite Density")
> plot(ImmRespodedata[,1], ImmRespodedata[,4], type="l", xlab = "Time
> Period", ylab = "Environment")
>
>
>
> --
> Sibylle Mohr, Ph.D.
> Institute of Biodiversity, Animal Health, and Comparative Medicine
> College of Medical, Veterinary and Life Sciences
> University of Glasgow
> 464 Bearsden Rd. Glasgow G61 1QH
> _______________________________________________
> R-sig-dynamic-models mailing list
> R-sig-dynamic-models at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models

	[[alternative HTML version deleted]]



More information about the R-sig-dynamic-models mailing list