Displaying 1 result from an estimated 1 matches for "qmean".
Did you mean:
mean
2004 Sep 04
0
Non-Markovian Behaviour of a Cusum?
...am I missing?
Thanks,
spencer graves
##SCRIPT:
CusumSim <- function(offset=-0.1, FIR=4.5, maxTime=500, nSims=10000){
# Simulate nSims simultaneous Cusums of length maxTime
# Q[i] <- max(0, Q[i-1]+z[i]), z[i] ~ N(offset, 1),
# Q[0] = FIR
# Store only the mean of Q[i] for each i
Qmean <- rep(NA, maxTime)
Q <- rep(FIR, nSims)
for(i in 1:maxTime){
Q <- pmax(0, Q+rnorm(nSims, mean=offset))
Qmean[i] <- mean(Q)
}
Qmean
}
set.seed(321)
Cus1 <- CusumSim()
plot(Cus1)
# Different simulation, essentially the same behavior
Cus2 <- CusumSim()
plot(Cus1, yl...