Hello everyone,
I'm trying to generate a sequence that consists of random numbers and the
following algorithm works well
###
a <- 0.08
b <- 0.01
T <- 90
t <- 0:T
alpha <- 1
e <- rnorm(T, mean = 0, sd = 0.1)
d <- c( runif(1,0, a*T), rep(0, T-1) )
for (i in 2:T)
{
d[i] <- alpha * d[i-1] + e[i]
}
plot(d, type="l")
##
But I have to add this restriction " each d on
day t must satisfy to belong to the time-dependent interval [0, a*(T-t)] ". For
example, d on day 50 can be minimal 0 and maximal a*40.
I hope, somebody helps me.
Best regards
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.