[R] applying data generating function
    Christophe Pallier 
    pallier at lscp.ehess.fr
       
    Sun Mar  7 23:24:48 CET 2004
    
    
  
Fred J. wrote:
>I need to generate a data set based on this equation
>X(t) = 3.8x(t-1) (1-x(t-1)) + e(t), where e(t) is a
>N(0,0,001) random variable
>I need say 100 values.
>
>How do I do this? 
>
>
>  
>
I assume X(t) and x(t) are the same (?).
f<-function (x) { 3.8*x*(1-x) + rnorm(1,0,.001) }
v=c()
x=.1 # starting point
for (i in 1:100) { x=f(x); v=append(v,x) }
There may be smarter ways...
Christophe Pallier
    
    
More information about the R-help
mailing list