View source: R/gen-brown-motion.R
brownian_motion | R Documentation |
Create a Brownian Motion Tibble
brownian_motion(
.num_walks = 25,
.n = 100,
.delta_time = 1,
.initial_value = 0,
.dimensions = 1
)
.num_walks |
Total number of simulations. |
.n |
Total time of the simulation. |
.delta_time |
Time step size. |
.initial_value |
Integer representing the initial value. |
.dimensions |
The default is 1. Allowable values are 1, 2 and 3. |
Brownian Motion, also known as the Wiener process, is a continuous-time random process that describes the random movement of particles suspended in a fluid. It is named after the physicist Robert Brown, who first described the phenomenon in 1827.
The equation for Brownian Motion can be represented as:
W(t) = W(0) + sqrt(t) * Z
Where W(t) is the Brownian motion at time t, W(0) is the initial value of the Brownian motion, sqrt(t) is the square root of time, and Z is a standard normal random variable.
Brownian Motion has numerous applications, including modeling stock prices in financial markets, modeling particle movement in fluids, and modeling random walk processes in general. It is a useful tool in probability theory and statistical analysis.
A tibble containing the generated random walks with columns depending on the number of dimensions:
walk_number
: Factor representing the walk number.
step_number
: Step index.
y
: If .dimensions = 1
, the value of the walk at each step.
x
, y
: If .dimensions = 2
, the values of the walk in two dimensions.
x
, y
, z
: If .dimensions = 3
, the values of the walk in three dimensions.
The following are also returned based upon how many dimensions there are and could be any of x, y and or z:
cum_sum
: Cumulative sum of dplyr::all_of(.dimensions)
.
cum_prod
: Cumulative product of dplyr::all_of(.dimensions)
.
cum_min
: Cumulative minimum of dplyr::all_of(.dimensions)
.
cum_max
: Cumulative maximum of dplyr::all_of(.dimensions)
.
cum_mean
: Cumulative mean of dplyr::all_of(.dimensions)
.
Steven P. Sanderson II, MPH
Other Generator Functions:
discrete_walk()
,
geometric_brownian_motion()
,
random_normal_drift_walk()
,
random_normal_walk()
set.seed(123)
brownian_motion()
set.seed(123)
brownian_motion(.dimensions = 3) |>
head() |>
t()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.