[R-sig-dyn-mod] replicates in stochastic model
"Pablo García Díaz"
garciap at usal.es
Mon Mar 18 07:15:55 CET 2013
Hi all,
I am trying to model a simple demographic stochastic system in R, and its
trajectorie during some years. For doing that I have written the following
code:
times=c(1:100)
Nt=rpois(times, 10)
phi=runif(times, 0.1,1)
ri=rpois(times, 10)
Ii=rpois(times,5)
popmod<-function(times, Nt, phi, ri, Ii){
for (i in times[-1]){
Nt[times-1]*phi[times-1]+ ri[times-1]+Ii[times-1]
}
F=data.frame(Nt=Nt[times],year=times)
}
vf<-popmod(times, Nt, phi, ri, Ii)
Now, what I want is to run some replictes (about 100) of the same model to
obtain the estimate and standard deviation of the trajectorie. I have
tried with the repeat loop, but until now all my attemps have failed.
Can anyone plese provide me some guidance and/or help?
Thanks in advance, best regards
Pablo
More information about the R-sig-dynamic-models
mailing list