Displaying 1 result from an estimated 1 matches for "v_init_cond".
Did you mean:
p_init_cond
2013 Jan 03
2
simulation
...te the equations I have just presented?
I have good confidence with R for statistical analysis, but not for simulation therefore I apologize for my ignorance.
What I came up with is the following:
##general settings
c<-0.5
lambda<-0.3
a<-c/lambda
n<-500
## Eq.12 (the v_t random walk)
V_init_cond<-0
Et<-ts(rnorm(n+100,mean=0,sd=1))
Vt<-Et*0
Vt[1]<-V_init_cond+Et[1]
for(i in 2:(n+100)) {
Vt[i]<-Vt[i-1]+Et[i]
}
Vt<-ts(Vt[(length(Vt)-n+1):length(Vt)])
plot(Vt)
## Eq.13 (the strategy)
Xt_init_cond<-0
Xt<-Xt_init_cond*0
Xt[2]<-c(Vt[1]-Pt[1])
for(i in 2:(n)){
Xt[i]<...