bm: Generate a time series of Brownian motion.

Description Usage Arguments Examples

Description

This function generatea a time series of one dimension Brownian motion, adapted from http://cos.name/wp-content/uploads/2008/12/stochastic-differential-equation-with-r.pdf .

Usage

1
  bm(x0 = 0, t0 = 0, t = 1, n = 100)

Arguments

x0

the start value, with the default value 0

t0

the start time point, with the default value 0

t

the end time point, with the default value 1

n

the number of points between t0 and t that will be generated, with the default value 100

Examples

1
2
3
4
bm()
plot(bm())
a <- bm(x0=1, t0=1, t=2, n=1000)
plot(a)

Example output

Time Series:
Start = c(0, 1) 
End = c(1, 1) 
Frequency = 100 
  [1]  0.000000000 -0.108119500 -0.026798589  0.002037065  0.145862924
  [6]  0.002436917 -0.128220065 -0.278737826 -0.287960618 -0.296887845
 [11] -0.352299599 -0.426379059 -0.344716779 -0.367336558 -0.338993493
 [16] -0.412412885 -0.385968361 -0.298553172 -0.327300561 -0.294889558
 [21] -0.267796156 -0.300320751 -0.354529580 -0.390457139 -0.383357315
 [26] -0.345656699 -0.348960546 -0.313119361 -0.206174321 -0.262388699
 [31] -0.321243903 -0.366081878 -0.421539329 -0.377759862 -0.366823860
 [36] -0.351090686 -0.240652475 -0.310793200 -0.271253835 -0.346896312
 [41] -0.434187352 -0.543349277 -0.593031061 -0.635907220 -0.729882170
 [46] -0.769633633 -0.915871725 -0.960742912 -0.788272179 -0.847281048
 [51] -0.716556332 -0.552658729 -0.535020322 -0.663725035 -0.758877171
 [56] -0.806138402 -0.669570312 -0.604977944 -0.660347395 -0.631374438
 [61] -0.579911368 -0.546994795 -0.590241615 -0.469527914 -0.482037010
 [66] -0.530449819 -0.543866484 -0.351934799 -0.278252420 -0.382115285
 [71] -0.370843823 -0.421402360 -0.627077175 -0.620275536 -0.547907255
 [76] -0.447935244 -0.430193831 -0.374041344 -0.484814571 -0.457274319
 [81] -0.448119641 -0.415556653 -0.466535464 -0.443002208 -0.474632146
 [86] -0.602029010 -0.589360276 -0.631585363 -0.552775323 -0.652623693
 [91] -0.857485394 -0.800777383 -0.905571989 -0.920610072 -0.782592843
 [96] -0.817327262 -0.901210449 -0.887741344 -1.010903824 -1.103849217
[101] -1.029097986

somebm documentation built on May 2, 2019, 9:30 a.m.