<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Dear R users,</DIV>
<DIV>I am writing my master thesis and I need to simulate equations 12, 13 and 
14 of the attached paper.</DIV>
<DIV>Pls forgive my ignorance but it is the first time I try something like 
that.</DIV>
<DIV>The code I came up with so far is presented below, but I think that it is 
very incorrect or, at least, doesn’t work.</DIV>
<DIV>If you have any idea on the approach that I’ve to take or on how to improve 
my code pls don’t hesitate to contact me.</DIV>
<DIV>I appreciate your patience.</DIV>
<DIV>Thanks</DIV>
<DIV>Simone Gogna</DIV>
<DIV> </DIV>
<DIV>##general settings</DIV>
<DIV>c<-0.5</DIV>
<DIV>lambda<-0.3</DIV>
<DIV>a<-c/lambda</DIV>
<DIV>n<-500     </DIV>
<DIV> </DIV>
<DIV>## Eq.12</DIV>
<DIV>V_init_cond<-0</DIV>
<DIV>Et<-ts(rnorm(n+100,mean=0,sd=1))</DIV>
<DIV>Vt<-Et*0</DIV>
<DIV>Vt[1]<-V_init_cond+Et[1]</DIV>
<DIV>for(i in 2:(n+100)) {</DIV>
<DIV>  Vt[i]<-Vt[i-1]+Et[i]</DIV>
<DIV>}</DIV>
<DIV>Vt<-ts(Vt[(length(Vt)-n+1):length(Vt)])</DIV>
<DIV>plot(Vt)</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>#Eq.13</DIV>
<DIV>Xt_init_cond<-0</DIV>
<DIV>Xt<-Xt_init_cond*0</DIV>
<DIV>Xt[2]<-c(Vt[1]-Pt[1])</DIV>
<DIV>for(i in 2:(n)){</DIV>
<DIV>  Xt[i]<-c(Vt[i-1]-Pt[i-1])</DIV>
<DIV>}</DIV>
<DIV>Xt<-ts(Xt[(length(Xt)-n+1):length(Xt)])</DIV>
<DIV>plot(Xt)</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>##Eq. 14</DIV>
<DIV>P_init_cond<-0</DIV>
<DIV>Pt<-Rt*0</DIV>
<DIV>Pt[1]<-P_init_cond+Rt[1]</DIV>
<DIV>for(i in 2:(n+100)) {</DIV>
<DIV>  Pt[i]<-Pt[i-1]+Rt[i]</DIV>
<DIV>}</DIV>
<DIV>Pt<-ts(Pt[(length(Pt)-n+1):length(Pt)])</DIV>
<DIV>plot(Pt)</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>epsilon<-ts(rnorm(n,mean=0,sd=1))</DIV>
<DIV>Rt_init_cond<-0</DIV>
<DIV>Rt<-Rt_init_cond*0</DIV>
<DIV>Rt[2]<- -a*Rt[1]+a*Et[1]+epsilon[2]</DIV>
<DIV>for(i in 2:(n)){</DIV>
<DIV>  Rt[i]<- -a*Rt[i-1]+a*Et[i-1]+epsilon[i]</DIV>
<DIV>}</DIV>
<DIV>Rt<-ts(Rt[(length(Rt)-n+1):length(Rt)])</DIV>
<DIV>plot(Rt)</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV></DIV></DIV></BODY></HTML>