[R] Generating numbers with time-dependent upperbound
arun
smartpink111 at yahoo.com
Tue Dec 3 04:14:53 CET 2013
Hi,
May be this helps:
m <- 0.01
T <- 90
t <- 0:T
set.seed(42)
res1 <- sapply(t,function(.t) runif(1,0,m*(T-.t)))
#or
set.seed(42)
res2 <- runif(91,rep(0,91),m*(rep(T,91)-t))
identical(res1,res2)
#[1] TRUE
A.K.
Hi,
I need to generate a sequence that consists of random numbers.
My first idea was runif with the condition m(T-t), but i couldn't
achieve.
Given: m=0.01 , T=90, t={0,1,...,T}
Sequence: s={p_0, p_1,..., p_T}, where p_t is chosen from the time-dependent interval [0, m(T-t)]
I appreciate if someone helps me.
More information about the R-help
mailing list