Is there a continuous maximum function in R that does not require a time series object? I want to simulate the reflected Brownian motion, which can be simulated by having Y = Brownian motion - the maximum of Brownian motion up to this time. Now tell me that I can simulate a Brownian motion (this is trivial) and I have a series of random times (therefore not an integer, because I want to simulate a continuous time process), how can I find a maximum of 10 seconds? For clarity, my code so far:
brownian = function(n=1000, fun=rnorm) {x=cumsum(fun(n))}
X= brownian()
t=cumsum(abs(sin(seq(1:1000)))) %these are the random times
Now I would ideally like to write Y = X -...., but cannot use any time series arguments. b / c TS objects even require a time interval. How should I do it?
source
share