Re: [R] Stochastic SEIR model

From: Francisco Zagmutt <gerifalte28_at_hotmail.com>
Date: Thu 16 Nov 2006 - 17:11:42 GMT

Dear Massimo

This site have some code that may help you to get started. http://www.statistik.lmu.de/~hoehle/software/

Also if you want to take an agent-based approach, you may want to take a look at the "simecol" package

Regards,

Francisco

Massimo Fenati wrote:
> Thanks for your fast advises.
>
> A simple examples of SEIR model is shown below:
>
> #expample of very simple SEIR model#####
> library(odesolve)
> times<-seq(0,1200,1)
> parms<-c(
> b=0.35, #BETA OR COEFFICIENT OF TRANSMISSION
> pl=1/7, #LATENCY
> g=1/21, #RECOVERY
> a=0.05/7 #LETHALITY IN ADULT
> )
> xstart<-c(S=100,E=0,I=1,R=0,nn=101)
> model<-function(t,x,parms){
> S <-x[1]
> E <-x[2]
> I <-x[3]
> R <-x[4]
> nn <-x[5]
>
> with(as.list(parms),{
> dS<--S*b*I/nn
> dE<-S*b*I/nn-E*pl
> dI<-E*pl-I*(a+g)
> dR<-I*g
> dnn<-dS+dE+dI+dR
>
> list(c(dS,dE,dI,dR,dnn))
> })
> }
> out<-as.data.frame(lsoda(xstart,times,model,parms))
> plot(times,out$S,type="l")
> lines(times,out$E,col="green")
> lines(times,out$I,col="red")
> lines(times,out$R,col="blue")
> #########
>
> I'd like to vary one or more parameters (with several
> distribution) for obtaining probabilistic results from the
> model projections.
>
> Now I'll try also with winBUGS, but I've never worked with
> it. I hope..
>
> Thank you very much.
>
> Max
>
>
>
> On Thu, 16 Nov 2006 09:26:12 -0500
> Tamas K Papp <tpapp@Princeton.EDU> wrote:

>> On Thu, Nov 16, 2006 at 02:55:07PM +0100, Massimo Fenati 
>> wrote:
>>> Dear colleagues,
>>> Iím a new R-help user. Iíve read the advertisements 
>>> about 
>>> the good manners and I hope to propose a good question.
>>> Iím using R to build an epidemiological SEIR model based 
>>> on ODEs. The odesolve package is very useful to solve 
>>> deterministic ODE systems but Iíd like to perform a 
>>> stochastic simulation based on Markov chain Montecarlo 
>>> methods. I donít know which packages could be used to do 
>>> it (I tried with "sde" but without results).
>>> Have you some suggestions about useful methods and/or 
>>> function in R for reaching my aim.
>> Hi Max,
>>
>> I don't know what SEIR is.  R has some MCMC packages
>> (RSiteSearch("MCMC") will help you there), but it is 
>> easy to write a
>> Metropolis/Gibbs sampler yourself, making use of the 
>> structure of your
>> problem.
>>
>> The sde package is for approximating likelihoods of 
>> continuous time
>> stochastic differential equations (which is a difficult 
>> problem by
>> itself).
>>
>> It is hard to give more advice without knowing what you 
>> are trying to
>> achieve -- it is good that you have read the posting 
>> guide, but please
>> give more details if you want more specific answers.
>>
>> HTH,
>>
>> Tamas

>
> MASSIMO FENATI
> -----------------------------------------
> Istituto Nazionale per la Fauna Selvatica
> Via Cŗ Fornacetta, 9
> 40064 - Ozzano dell'Emilia (BO)- Italy
> tel: +39 0516512245
> cel: +39 3392114911
> fax: +39 051796628
> e-mail: massimo.fenati@infs.it
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
-- 
Dr. Francisco J. Zagmutt
College of Veterinary Medicine and Biomedical Sciences
Colorado State University

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri Nov 17 04:20:34 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 17 Nov 2006 - 03:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.