diff --git a/docs/authors.html b/docs/authors.html index d989bba..bb9711a 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -47,14 +47,13 @@

Citation

Sanderson S (2024). RandomWalker: Generate Random Walks Compatible With The 'tidyverse'. -R package version 0.0.0.9000, https://github.com/spsanderson/RandomWalker, https://www.spsanderson.com/RandomWalker/. +https://www.spsanderson.com/RandomWalker/, https://github.com/spsanderson/RandomWalker.

@Manual{,
   title = {RandomWalker: Generate Random Walks Compatible With The 'tidyverse'},
   author = {Steven Sanderson},
   year = {2024},
-  note = {R package version 0.0.0.9000, https://github.com/spsanderson/RandomWalker},
-  url = {https://www.spsanderson.com/RandomWalker/},
+  note = {https://www.spsanderson.com/RandomWalker/, https://github.com/spsanderson/RandomWalker},
 }
diff --git a/docs/index.html b/docs/index.html index 979e51c..58cb489 100644 --- a/docs/index.html +++ b/docs/index.html @@ -69,7 +69,7 @@

InstallationGitHub with:

 # install.packages("devtools")
-devtools::install_github("spsanderson/RandomWalker")
+devtools::install_github("spsanderson/RandomWalker")

Example diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 50a6bfe..0fb1c97 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.1.0 pkgdown_sha: ~ articles: getting-started: getting-started.html -last_built: 2024-07-20T00:41Z +last_built: 2024-07-22T19:25Z urls: reference: https://www.spsanderson.com/RandomWalker/reference article: https://www.spsanderson.com/RandomWalker/articles diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png index e620dfd..18cf313 100644 Binary files a/docs/reference/Rplot001.png and b/docs/reference/Rplot001.png differ diff --git a/docs/reference/brownian_motion-1.png b/docs/reference/brownian_motion-1.png index 13846b3..7ed62d5 100644 Binary files a/docs/reference/brownian_motion-1.png and b/docs/reference/brownian_motion-1.png differ diff --git a/docs/reference/brownian_motion.html b/docs/reference/brownian_motion.html index e7040b4..a599462 100644 --- a/docs/reference/brownian_motion.html +++ b/docs/reference/brownian_motion.html @@ -41,7 +41,7 @@

Usage

brownian_motion(
-  .num_walks = 10,
+  .num_walks = 25,
   .n = 100,
   .delta_time = 1,
   .initial_value = 0,
@@ -112,7 +112,7 @@ 

Examples
library(ggplot2)
 
 brownian_motion()
-#> # A tibble: 1,010 × 3
+#> # A tibble: 2,525 × 3
 #>    walk_number     x     y
 #>    <fct>       <int> <dbl>
 #>  1 1               1  0   
@@ -125,14 +125,14 @@ 

Examples#> 8 1 8 -3.64 #> 9 1 9 -3.89 #> 10 1 10 -4.13 -#> # ℹ 1,000 more rows +#> # ℹ 2,515 more rows brownian_motion() |> - ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + - geom_line() + - labs(title = "Brownian Motion", x = "Time", y = "Value") + - theme_minimal() + - theme(legend.position = "none") + ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + + geom_line() + + labs(title = "Brownian Motion", x = "Time", y = "Value") + + theme_minimal() + + theme(legend.position = "none")

diff --git a/docs/reference/discrete_walk-1.png b/docs/reference/discrete_walk-1.png index 4c56c1f..410927d 100644 Binary files a/docs/reference/discrete_walk-1.png and b/docs/reference/discrete_walk-1.png differ diff --git a/docs/reference/discrete_walk.html b/docs/reference/discrete_walk.html index 893581d..bda7f19 100644 --- a/docs/reference/discrete_walk.html +++ b/docs/reference/discrete_walk.html @@ -123,25 +123,25 @@

Examples#> # A tibble: 2,500 × 7 #> walk_number x y cum_sum cum_prod cum_min cum_max #> <fct> <int> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 1 1 -1 99 0 99 99 -#> 2 1 2 -1 98 0 99 99 -#> 3 1 3 1 99 0 99 101 +#> 1 1 1 1 101 200 101 101 +#> 2 1 2 -1 100 0 99 101 +#> 3 1 3 -1 99 0 99 101 #> 4 1 4 1 100 0 99 101 #> 5 1 5 -1 99 0 99 101 -#> 6 1 6 1 100 0 99 101 -#> 7 1 7 -1 99 0 99 101 -#> 8 1 8 1 100 0 99 101 -#> 9 1 9 -1 99 0 99 101 -#> 10 1 10 -1 98 0 99 101 +#> 6 1 6 -1 98 0 99 101 +#> 7 1 7 -1 97 0 99 101 +#> 8 1 8 1 98 0 99 101 +#> 9 1 9 1 99 0 99 101 +#> 10 1 10 1 100 0 99 101 #> # ℹ 2,490 more rows set.seed(123) discrete_walk(.num_walks = 30, .n = 250, .upper_probability = 0.55) |> -ggplot(aes(x = x, y = cum_sum)) + - geom_line(aes(group = walk_number), alpha = .618, color = "steelblue") + - theme_minimal() + - theme(legend.position = "none") + - geom_smooth(method = "lm", se = FALSE) +ggplot(aes(x = x, y = cum_sum)) + + geom_line(aes(group = walk_number), alpha = .618, color = "steelblue") + + theme_minimal() + + theme(legend.position = "none") + + geom_smooth(method = "lm", se = FALSE) #> `geom_smooth()` using formula = 'y ~ x' diff --git a/docs/reference/geometric_brownian_motion-1.png b/docs/reference/geometric_brownian_motion-1.png index be5b750..ed280f9 100644 Binary files a/docs/reference/geometric_brownian_motion-1.png and b/docs/reference/geometric_brownian_motion-1.png differ diff --git a/docs/reference/geometric_brownian_motion.html b/docs/reference/geometric_brownian_motion.html index 0c95189..42f231e 100644 --- a/docs/reference/geometric_brownian_motion.html +++ b/docs/reference/geometric_brownian_motion.html @@ -145,11 +145,11 @@

Examples#> # ℹ 2,515 more rows geometric_brownian_motion() |> - ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + - geom_line() + - labs(title = "Geometric Brownian Motion", x = "Time", y = "Value") + - theme_minimal() + - theme(legend.position = "none") + ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + + geom_line() + + labs(title = "Geometric Brownian Motion", x = "Time", y = "Value") + + theme_minimal() + + theme(legend.position = "none")

diff --git a/docs/reference/random_normal_drift_walk-1.png b/docs/reference/random_normal_drift_walk-1.png index 2f94703..4df405e 100644 Binary files a/docs/reference/random_normal_drift_walk-1.png and b/docs/reference/random_normal_drift_walk-1.png differ diff --git a/docs/reference/random_normal_drift_walk.html b/docs/reference/random_normal_drift_walk.html index 853ee92..ceffb86 100644 --- a/docs/reference/random_normal_drift_walk.html +++ b/docs/reference/random_normal_drift_walk.html @@ -116,11 +116,11 @@

Examples walks <- random_normal_drift_walk(.num_walks = 10, .n = 50, .mu = 0, .sd = 1, .drift = 0.05) -ggplot(walks, aes(x = x, y = y, group = walk_number, color = walk_number)) + - geom_line() + - labs(title = "Random Walks with Drift", x = "Time", y = "Value") + - theme_minimal() + - theme(legend.position = "none") +ggplot(walks, aes(x = x, y = y, group = walk_number, color = walk_number)) + + geom_line() + + labs(title = "Random Walks with Drift", x = "Time", y = "Value") + + theme_minimal() + + theme(legend.position = "none")

diff --git a/docs/reference/random_normal_walk.html b/docs/reference/random_normal_walk.html index 755ecce..5599921 100644 --- a/docs/reference/random_normal_walk.html +++ b/docs/reference/random_normal_walk.html @@ -166,11 +166,11 @@

Examples#> # ℹ 490 more rows random_normal_walk(.num_walks = 2, .n = 100) |> - ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + - geom_line() + - labs(title = "Random Normal Walk", x = "Time", y = "Value") + - theme_minimal() + - theme(legend.position = "none") + ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + + geom_line() + + labs(title = "Random Normal Walk", x = "Time", y = "Value") + + theme_minimal() + + theme(legend.position = "none") diff --git a/docs/reference/rw30-1.png b/docs/reference/rw30-1.png index 7f6bfbd..30cdce0 100644 Binary files a/docs/reference/rw30-1.png and b/docs/reference/rw30-1.png differ diff --git a/docs/reference/rw30.html b/docs/reference/rw30.html index e1b424f..17af765 100644 --- a/docs/reference/rw30.html +++ b/docs/reference/rw30.html @@ -85,11 +85,11 @@

Examples#> # ℹ 2,990 more rows rw30() |> - ggplot(aes(x = x, y = y, color = walk_number, group = walk_number)) + - geom_line() + - theme_minimal() + - theme(legend.position = "none") + - labs( + ggplot(aes(x = x, y = y, color = walk_number, group = walk_number)) + + geom_line() + + theme_minimal() + + theme(legend.position = "none") + + labs( title = "30 Random Walks", x = "Step", y = "Value", diff --git a/docs/search.json b/docs/search.json index 8930fc2..0c379a7 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -[{"path":"https://www.spsanderson.com/RandomWalker/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Steven Sanderson. Author, maintainer, copyright holder.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sanderson S (2024). RandomWalker: Generate Random Walks Compatible 'tidyverse'. R package version 0.0.0.9000, https://github.com/spsanderson/RandomWalker, https://www.spsanderson.com/RandomWalker/.","code":"@Manual{, title = {RandomWalker: Generate Random Walks Compatible With The 'tidyverse'}, author = {Steven Sanderson}, year = {2024}, note = {R package version 0.0.0.9000, https://github.com/spsanderson/RandomWalker}, url = {https://www.spsanderson.com/RandomWalker/}, }"},{"path":"https://www.spsanderson.com/RandomWalker/index.html","id":"randomwalker-","dir":"","previous_headings":"","what":"Generate Random Walks Compatible With The tidyverse","title":"Generate Random Walks Compatible With The tidyverse","text":"goal RandomWalker allow users easily create Random Walks different types compatible tidyverse suite packages. package currently experimental stage development.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Generate Random Walks Compatible With The tidyverse","text":"can install development version RandomWalker GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"spsanderson/RandomWalker\")"},{"path":"https://www.spsanderson.com/RandomWalker/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Generate Random Walks Compatible With The tidyverse","text":"basic example shows solve common problem:","code":"library(RandomWalker) ## basic example code rw30() |> head(10) #> # A tibble: 10 × 3 #> walk_number x y #> #> 1 1 1 0 #> 2 1 2 -0.821 #> 3 1 3 -0.969 #> 4 1 4 -2.08 #> 5 1 5 -3.58 #> 6 1 6 -2.50 #> 7 1 7 -4.65 #> 8 1 8 -4.68 #> 9 1 9 -5.75 #> 10 1 10 -6.49"},{"path":"https://www.spsanderson.com/RandomWalker/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Steven P. Sanderson II, MPH Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":null,"dir":"Reference","previous_headings":"","what":"Brownian Motion — brownian_motion","title":"Brownian Motion — brownian_motion","text":"Create Brownian Motion Tibble","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Brownian Motion — brownian_motion","text":"","code":"brownian_motion( .num_walks = 10, .n = 100, .delta_time = 1, .initial_value = 0, .return_tibble = TRUE )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Brownian Motion — brownian_motion","text":".num_walks Total number simulations. .n Total time simulation. .delta_time Time step size. .initial_value Integer representing initial value. .return_tibble default TRUE. set FALSE object class matrix returned.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Brownian Motion — brownian_motion","text":"tibble/matrix","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Brownian Motion — brownian_motion","text":"Brownian Motion, also known Wiener process, continuous-time random process describes random movement particles suspended fluid. named physicist Robert Brown, first described phenomenon 1827. equation Brownian Motion can represented : W(t) Brownian motion time t, W(0) initial value Brownian motion, sqrt(t) square root time, Z standard normal random variable. Brownian Motion numerous applications, including modeling stock prices financial markets, modeling particle movement fluids, modeling random walk processes general. useful tool probability theory statistical analysis.","code":"W(t) = W(0) + sqrt(t) * Z"},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Brownian Motion — brownian_motion","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Brownian Motion — brownian_motion","text":"","code":"library(ggplot2) brownian_motion() #> # A tibble: 1,010 × 3 #> walk_number x y #> #> 1 1 1 0 #> 2 1 2 -1.40 #> 3 1 3 -1.14 #> 4 1 4 -3.58 #> 5 1 5 -3.59 #> 6 1 6 -2.97 #> 7 1 7 -1.82 #> 8 1 8 -3.64 #> 9 1 9 -3.89 #> 10 1 10 -4.13 #> # ℹ 1,000 more rows brownian_motion() |> ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + geom_line() + labs(title = \"Brownian Motion\", x = \"Time\", y = \"Value\") + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":null,"dir":"Reference","previous_headings":"","what":"Discrete Sampled Walk — discrete_walk","title":"Discrete Sampled Walk — discrete_walk","text":"discrete_walk function generates multiple random walks discrete time periods. step walk determined probabilistic sample specified upper lower bounds. function useful simulating stochastic processes, stock price movements scenarios outcomes determined random process.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Discrete Sampled Walk — discrete_walk","text":"","code":"discrete_walk( .num_walks = 25, .n = 100, .upper_bound = 1, .lower_bound = -1, .upper_probability = 0.5, .initial_value = 100 )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Discrete Sampled Walk — discrete_walk","text":".num_walks Total number simulations. .n Total time simulation. .upper_bound upper bound random walk. .lower_bound lower bound random walk. .upper_probability probability upper bound. Default 0.5. lower bound calculated 1 - .upper_probability. .initial_value initial value random walk. Default 100.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Discrete Sampled Walk — discrete_walk","text":"tibble containing simulated walks, columns walk number, time period, various cumulative metrics (sum, product, min, max).","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Discrete Sampled Walk — discrete_walk","text":"function discrete_walk simulates random walks specified number simulations (.num_walks) given total time (.n). step walk either upper bound lower bound, determined probability (.upper_probability). initial value walk set user (.initial_value), cumulative sum, product, minimum, maximum steps calculated walk. results returned tibble detailed attributes, including parameters used simulation.","code":""},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Discrete Sampled Walk — discrete_walk","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Discrete Sampled Walk — discrete_walk","text":"","code":"library(ggplot2) discrete_walk() #> # A tibble: 2,500 × 7 #> walk_number x y cum_sum cum_prod cum_min cum_max #> #> 1 1 1 -1 99 0 99 99 #> 2 1 2 -1 98 0 99 99 #> 3 1 3 1 99 0 99 101 #> 4 1 4 1 100 0 99 101 #> 5 1 5 -1 99 0 99 101 #> 6 1 6 1 100 0 99 101 #> 7 1 7 -1 99 0 99 101 #> 8 1 8 1 100 0 99 101 #> 9 1 9 -1 99 0 99 101 #> 10 1 10 -1 98 0 99 101 #> # ℹ 2,490 more rows set.seed(123) discrete_walk(.num_walks = 30, .n = 250, .upper_probability = 0.55) |> ggplot(aes(x = x, y = cum_sum)) + geom_line(aes(group = walk_number), alpha = .618, color = \"steelblue\") + theme_minimal() + theme(legend.position = \"none\") + geom_smooth(method = \"lm\", se = FALSE) #> `geom_smooth()` using formula = 'y ~ x'"},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":null,"dir":"Reference","previous_headings":"","what":"Geometric Brownian Motion — geometric_brownian_motion","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"Create Geometric Brownian Motion.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"","code":"geometric_brownian_motion( .num_walks = 25, .n = 100, .mu = 0, .sigma = 0.1, .initial_value = 100, .delta_time = 0.003, .return_tibble = TRUE )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Geometric Brownian Motion — geometric_brownian_motion","text":".num_walks Total number simulations. .n Total time simulation, many n points time. .mu Expected return .sigma Volatility .initial_value Integer representing initial value. .delta_time Time step size. .return_tibble default TRUE. set FALSE object class matrix returned.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"tibble/matrix","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"Geometric Brownian Motion (GBM) statistical method modeling evolution given financial asset time. type stochastic process, means system undergoes random changes time. GBM widely used field finance model behavior stock prices, foreign exchange rates, financial assets. based assumption asset's price follows random walk, meaning influenced number unpredictable factors market trends, news events, investor sentiment. equation GBM : S price asset, t time, m expected return asset, s volatility asset, dW small random change asset's price. GBM can used estimate likelihood different outcomes given asset, often used conjunction statistical methods make accurate predictions future performance asset. function provides ability simulating estimating parameters GBM process. can used analyze behavior financial assets make informed investment decisions.","code":"dS/S = mdt + sdW"},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"","code":"library(ggplot2) geometric_brownian_motion() #> # A tibble: 2,525 × 3 #> walk_number x y #> #> 1 1 1 100 #> 2 1 2 99.2 #> 3 1 3 99.8 #> 4 1 4 100. #> 5 1 5 100. #> 6 1 6 100. #> 7 1 7 100. #> 8 1 8 101. #> 9 1 9 99.7 #> 10 1 10 100. #> # ℹ 2,515 more rows geometric_brownian_motion() |> ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + geom_line() + labs(title = \"Geometric Brownian Motion\", x = \"Time\", y = \"Value\") + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"function generates specified number random walks, consisting specified number steps. steps generated normal distribution given mean standard deviation. additional drift term added step introduce consistent directional component walks.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"","code":"random_normal_drift_walk( .num_walks = 25, .n = 100, .mu = 0, .sd = 1, .drift = 0.1 )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":".num_walks Integer. number random walks generate. Default 25. .n Integer. number steps random walk. Default 100. .mu Numeric. mean normal distribution used generating steps. Default 0. .sd Numeric. standard deviation normal distribution used generating steps. Default 1. .drift Numeric. drift term added step. Default 0.1.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"tibble long format columns walk_number, x (step index), y (walk value). tibble attributes number walks, number steps, mean, standard deviation, drift.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"function generates multiple random walks specified drift. walk generated using normal distribution steps, additional drift term added step.","code":""},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"","code":"library(ggplot2) walks <- random_normal_drift_walk(.num_walks = 10, .n = 50, .mu = 0, .sd = 1, .drift = 0.05) ggplot(walks, aes(x = x, y = y, group = walk_number, color = walk_number)) + geom_line() + labs(title = \"Random Walks with Drift\", x = \"Time\", y = \"Value\") + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Multiple Random Normal Walks — random_normal_walk","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"random_normal_walk function useful simulating random processes can applied various fields finance, physics, biology model different stochastic behaviors.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"","code":"random_normal_walk( .num_walks = 25, .n = 100, .mu = 0, .sd = 0.1, .initial_value = 0, .samp = TRUE, .replace = TRUE, .sample_size = 0.8 )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":".num_walks integer specifying number random walks generate. Default 25. .n integer specifying number steps walk. Default 100. .mu numeric value indicating mean normal distribution. Default 0. .sd numeric value indicating standard deviation normal distribution. Default 0.1. .initial_value numeric value indicating initial value walks. Default 0. .samp logical value indicating whether sample normal distribution values. Default TRUE. .replace logical value indicating whether sampling replacement. Default TRUE. .sample_size numeric value 0 1 specifying proportion .n sample. Default 0.8.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"tibble containing generated random walks following columns: walk_number: Factor representing walk number. x: Step index. y: Normal distribution values. cum_sum: Cumulative sum y. cum_prod: Cumulative product y. cum_min: Cumulative minimum y. cum_max: Cumulative maximum y. tibble includes attributes function parameters.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"function generates multiple random walks, sequences steps step random draw normal distribution. user can specify number walks, number steps walk, parameters normal distribution (mean standard deviation). function also allows sampling proportion steps optionally sampling replacement. output tibble includes several computed columns walk, cumulative sum, product, minimum, maximum steps.","code":""},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"","code":"# Generate 10 random walks with 50 steps each random_normal_walk(.num_walks = 10, .n = 50) #> # A tibble: 400 × 7 #> walk_number x y cum_sum cum_prod cum_min cum_max #> #> 1 1 1 0.0653 0.0653 0 0.0653 0.0653 #> 2 1 2 0.103 0.169 0 0.0653 0.103 #> 3 1 3 -0.0947 0.0741 0 -0.0947 0.103 #> 4 1 4 0.0831 0.157 0 -0.0947 0.103 #> 5 1 5 -0.160 -0.00283 0 -0.160 0.103 #> 6 1 6 -0.0612 -0.0640 0 -0.160 0.103 #> 7 1 7 -0.00677 -0.0708 0 -0.160 0.103 #> 8 1 8 0.0380 -0.0328 0 -0.160 0.103 #> 9 1 9 0.0380 0.00519 0 -0.160 0.103 #> 10 1 10 -0.0551 -0.0499 0 -0.160 0.103 #> # ℹ 390 more rows # Generate random walks with different mean and standard deviation random_normal_walk(.num_walks = 10, .n = 50, .samp = FALSE) #> # A tibble: 500 × 7 #> walk_number x y cum_sum cum_prod cum_min cum_max #> #> 1 1 1 -0.127 -0.127 0 -0.127 -0.127 #> 2 1 2 0.182 0.0553 0 -0.127 0.182 #> 3 1 3 0.0770 0.132 0 -0.127 0.182 #> 4 1 4 -0.0245 0.108 0 -0.127 0.182 #> 5 1 5 -0.0399 0.0680 0 -0.127 0.182 #> 6 1 6 0.147 0.215 0 -0.127 0.182 #> 7 1 7 0.0258 0.241 0 -0.127 0.182 #> 8 1 8 -0.0774 0.164 0 -0.127 0.182 #> 9 1 9 -0.0126 0.151 0 -0.127 0.182 #> 10 1 10 0.00426 0.155 0 -0.127 0.182 #> # ℹ 490 more rows random_normal_walk(.num_walks = 2, .n = 100) |> ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + geom_line() + labs(title = \"Random Normal Walk\", x = \"Time\", y = \"Value\") + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Random Walks — rw30","title":"Generate Random Walks — rw30","text":"Generate Random Walks","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Random Walks — rw30","text":"","code":"rw30()"},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Random Walks — rw30","text":"tibble long format columns walk, x, value, representing random walks. Additionally, attributes num_walks, num_steps, mu, sd attached tibble.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate Random Walks — rw30","text":"function generates random walks using normal distribution specified mean (mu) standard deviation (sd). walk generated independently stored tibble. resulting tibble pivoted long format easier analysis.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Generate Random Walks — rw30","text":"Steven P. Sanderson II, MPH function generates 30 random walks 100 steps pivots result long format tibble.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate Random Walks — rw30","text":"","code":"library(ggplot2) # Generate random walks and print the result rw30() #> # A tibble: 3,000 × 3 #> walk_number x y #> #> 1 1 1 0 #> 2 1 2 0.254 #> 3 1 3 2.91 #> 4 1 4 4.07 #> 5 1 5 3.55 #> 6 1 6 3.96 #> 7 1 7 4.31 #> 8 1 8 5.04 #> 9 1 9 5.31 #> 10 1 10 4.04 #> # ℹ 2,990 more rows rw30() |> ggplot(aes(x = x, y = y, color = walk_number, group = walk_number)) + geom_line() + theme_minimal() + theme(legend.position = \"none\") + labs( title = \"30 Random Walks\", x = \"Step\", y = \"Value\", color = \"Walk Number\" )"},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/news/index.html","id":"breaking-changes-development-version","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"RandomWalker (development version)","text":"None","code":""},{"path":"https://www.spsanderson.com/RandomWalker/news/index.html","id":"new-features-development-version","dir":"Changelog","previous_headings":"","what":"New Features","title":"RandomWalker (development version)","text":"Fix #9 - Add Function rw30() generate 30 random walks 100 steps Fix #17 - Add Function geometric_brownian_motion() generate Geometric Brownian Motion Fix #18 - Add Function random_normal_drift_walk() generate Random Walk Drift Fix #16 - Add Function brownian_motion() generate Brownian Motion Fix #13 - Add Function random_normal_walk() generate Random Walk Fix #30 - Add Function discrete_walk() generate Discrete Random Walk","code":""},{"path":"https://www.spsanderson.com/RandomWalker/news/index.html","id":"minor-improvements-and-fixes-development-version","dir":"Changelog","previous_headings":"","what":"Minor Improvements and Fixes","title":"RandomWalker (development version)","text":"None","code":""}] +[{"path":"https://www.spsanderson.com/RandomWalker/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Steven Sanderson. Author, maintainer, copyright holder.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sanderson S (2024). RandomWalker: Generate Random Walks Compatible 'tidyverse'. https://www.spsanderson.com/RandomWalker/, https://github.com/spsanderson/RandomWalker.","code":"@Manual{, title = {RandomWalker: Generate Random Walks Compatible With The 'tidyverse'}, author = {Steven Sanderson}, year = {2024}, note = {https://www.spsanderson.com/RandomWalker/, https://github.com/spsanderson/RandomWalker}, }"},{"path":"https://www.spsanderson.com/RandomWalker/index.html","id":"randomwalker-","dir":"","previous_headings":"","what":"Generate Random Walks Compatible With The tidyverse","title":"Generate Random Walks Compatible With The tidyverse","text":"goal RandomWalker allow users easily create Random Walks different types compatible tidyverse suite packages. package currently experimental stage development.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Generate Random Walks Compatible With The tidyverse","text":"can install development version RandomWalker GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"spsanderson/RandomWalker\")"},{"path":"https://www.spsanderson.com/RandomWalker/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Generate Random Walks Compatible With The tidyverse","text":"basic example shows solve common problem:","code":"library(RandomWalker) ## basic example code rw30() |> head(10) #> # A tibble: 10 × 3 #> walk_number x y #> #> 1 1 1 0 #> 2 1 2 -0.821 #> 3 1 3 -0.969 #> 4 1 4 -2.08 #> 5 1 5 -3.58 #> 6 1 6 -2.50 #> 7 1 7 -4.65 #> 8 1 8 -4.68 #> 9 1 9 -5.75 #> 10 1 10 -6.49"},{"path":"https://www.spsanderson.com/RandomWalker/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Steven P. Sanderson II, MPH Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":null,"dir":"Reference","previous_headings":"","what":"Brownian Motion — brownian_motion","title":"Brownian Motion — brownian_motion","text":"Create Brownian Motion Tibble","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Brownian Motion — brownian_motion","text":"","code":"brownian_motion( .num_walks = 25, .n = 100, .delta_time = 1, .initial_value = 0, .return_tibble = TRUE )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Brownian Motion — brownian_motion","text":".num_walks Total number simulations. .n Total time simulation. .delta_time Time step size. .initial_value Integer representing initial value. .return_tibble default TRUE. set FALSE object class matrix returned.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Brownian Motion — brownian_motion","text":"tibble/matrix","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Brownian Motion — brownian_motion","text":"Brownian Motion, also known Wiener process, continuous-time random process describes random movement particles suspended fluid. named physicist Robert Brown, first described phenomenon 1827. equation Brownian Motion can represented : W(t) Brownian motion time t, W(0) initial value Brownian motion, sqrt(t) square root time, Z standard normal random variable. Brownian Motion numerous applications, including modeling stock prices financial markets, modeling particle movement fluids, modeling random walk processes general. useful tool probability theory statistical analysis.","code":"W(t) = W(0) + sqrt(t) * Z"},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Brownian Motion — brownian_motion","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/brownian_motion.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Brownian Motion — brownian_motion","text":"","code":"library(ggplot2) brownian_motion() #> # A tibble: 2,525 × 3 #> walk_number x y #> #> 1 1 1 0 #> 2 1 2 -1.40 #> 3 1 3 -1.14 #> 4 1 4 -3.58 #> 5 1 5 -3.59 #> 6 1 6 -2.97 #> 7 1 7 -1.82 #> 8 1 8 -3.64 #> 9 1 9 -3.89 #> 10 1 10 -4.13 #> # ℹ 2,515 more rows brownian_motion() |> ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + geom_line() + labs(title = \"Brownian Motion\", x = \"Time\", y = \"Value\") + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":null,"dir":"Reference","previous_headings":"","what":"Discrete Sampled Walk — discrete_walk","title":"Discrete Sampled Walk — discrete_walk","text":"discrete_walk function generates multiple random walks discrete time periods. step walk determined probabilistic sample specified upper lower bounds. function useful simulating stochastic processes, stock price movements scenarios outcomes determined random process.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Discrete Sampled Walk — discrete_walk","text":"","code":"discrete_walk( .num_walks = 25, .n = 100, .upper_bound = 1, .lower_bound = -1, .upper_probability = 0.5, .initial_value = 100 )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Discrete Sampled Walk — discrete_walk","text":".num_walks Total number simulations. .n Total time simulation. .upper_bound upper bound random walk. .lower_bound lower bound random walk. .upper_probability probability upper bound. Default 0.5. lower bound calculated 1 - .upper_probability. .initial_value initial value random walk. Default 100.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Discrete Sampled Walk — discrete_walk","text":"tibble containing simulated walks, columns walk number, time period, various cumulative metrics (sum, product, min, max).","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Discrete Sampled Walk — discrete_walk","text":"function discrete_walk simulates random walks specified number simulations (.num_walks) given total time (.n). step walk either upper bound lower bound, determined probability (.upper_probability). initial value walk set user (.initial_value), cumulative sum, product, minimum, maximum steps calculated walk. results returned tibble detailed attributes, including parameters used simulation.","code":""},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Discrete Sampled Walk — discrete_walk","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/discrete_walk.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Discrete Sampled Walk — discrete_walk","text":"","code":"library(ggplot2) discrete_walk() #> # A tibble: 2,500 × 7 #> walk_number x y cum_sum cum_prod cum_min cum_max #> #> 1 1 1 1 101 200 101 101 #> 2 1 2 -1 100 0 99 101 #> 3 1 3 -1 99 0 99 101 #> 4 1 4 1 100 0 99 101 #> 5 1 5 -1 99 0 99 101 #> 6 1 6 -1 98 0 99 101 #> 7 1 7 -1 97 0 99 101 #> 8 1 8 1 98 0 99 101 #> 9 1 9 1 99 0 99 101 #> 10 1 10 1 100 0 99 101 #> # ℹ 2,490 more rows set.seed(123) discrete_walk(.num_walks = 30, .n = 250, .upper_probability = 0.55) |> ggplot(aes(x = x, y = cum_sum)) + geom_line(aes(group = walk_number), alpha = .618, color = \"steelblue\") + theme_minimal() + theme(legend.position = \"none\") + geom_smooth(method = \"lm\", se = FALSE) #> `geom_smooth()` using formula = 'y ~ x'"},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":null,"dir":"Reference","previous_headings":"","what":"Geometric Brownian Motion — geometric_brownian_motion","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"Create Geometric Brownian Motion.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"","code":"geometric_brownian_motion( .num_walks = 25, .n = 100, .mu = 0, .sigma = 0.1, .initial_value = 100, .delta_time = 0.003, .return_tibble = TRUE )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Geometric Brownian Motion — geometric_brownian_motion","text":".num_walks Total number simulations. .n Total time simulation, many n points time. .mu Expected return .sigma Volatility .initial_value Integer representing initial value. .delta_time Time step size. .return_tibble default TRUE. set FALSE object class matrix returned.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"tibble/matrix","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"Geometric Brownian Motion (GBM) statistical method modeling evolution given financial asset time. type stochastic process, means system undergoes random changes time. GBM widely used field finance model behavior stock prices, foreign exchange rates, financial assets. based assumption asset's price follows random walk, meaning influenced number unpredictable factors market trends, news events, investor sentiment. equation GBM : S price asset, t time, m expected return asset, s volatility asset, dW small random change asset's price. GBM can used estimate likelihood different outcomes given asset, often used conjunction statistical methods make accurate predictions future performance asset. function provides ability simulating estimating parameters GBM process. can used analyze behavior financial assets make informed investment decisions.","code":"dS/S = mdt + sdW"},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/geometric_brownian_motion.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Geometric Brownian Motion — geometric_brownian_motion","text":"","code":"library(ggplot2) geometric_brownian_motion() #> # A tibble: 2,525 × 3 #> walk_number x y #> #> 1 1 1 100 #> 2 1 2 99.2 #> 3 1 3 99.8 #> 4 1 4 100. #> 5 1 5 100. #> 6 1 6 100. #> 7 1 7 100. #> 8 1 8 101. #> 9 1 9 99.7 #> 10 1 10 100. #> # ℹ 2,515 more rows geometric_brownian_motion() |> ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + geom_line() + labs(title = \"Geometric Brownian Motion\", x = \"Time\", y = \"Value\") + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"function generates specified number random walks, consisting specified number steps. steps generated normal distribution given mean standard deviation. additional drift term added step introduce consistent directional component walks.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"","code":"random_normal_drift_walk( .num_walks = 25, .n = 100, .mu = 0, .sd = 1, .drift = 0.1 )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":".num_walks Integer. number random walks generate. Default 25. .n Integer. number steps random walk. Default 100. .mu Numeric. mean normal distribution used generating steps. Default 0. .sd Numeric. standard deviation normal distribution used generating steps. Default 1. .drift Numeric. drift term added step. Default 0.1.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"tibble long format columns walk_number, x (step index), y (walk value). tibble attributes number walks, number steps, mean, standard deviation, drift.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"function generates multiple random walks specified drift. walk generated using normal distribution steps, additional drift term added step.","code":""},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_drift_walk.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate Multiple Random Walks with Drift — random_normal_drift_walk","text":"","code":"library(ggplot2) walks <- random_normal_drift_walk(.num_walks = 10, .n = 50, .mu = 0, .sd = 1, .drift = 0.05) ggplot(walks, aes(x = x, y = y, group = walk_number, color = walk_number)) + geom_line() + labs(title = \"Random Walks with Drift\", x = \"Time\", y = \"Value\") + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Multiple Random Normal Walks — random_normal_walk","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"random_normal_walk function useful simulating random processes can applied various fields finance, physics, biology model different stochastic behaviors.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"","code":"random_normal_walk( .num_walks = 25, .n = 100, .mu = 0, .sd = 0.1, .initial_value = 0, .samp = TRUE, .replace = TRUE, .sample_size = 0.8 )"},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":".num_walks integer specifying number random walks generate. Default 25. .n integer specifying number steps walk. Default 100. .mu numeric value indicating mean normal distribution. Default 0. .sd numeric value indicating standard deviation normal distribution. Default 0.1. .initial_value numeric value indicating initial value walks. Default 0. .samp logical value indicating whether sample normal distribution values. Default TRUE. .replace logical value indicating whether sampling replacement. Default TRUE. .sample_size numeric value 0 1 specifying proportion .n sample. Default 0.8.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"tibble containing generated random walks following columns: walk_number: Factor representing walk number. x: Step index. y: Normal distribution values. cum_sum: Cumulative sum y. cum_prod: Cumulative product y. cum_min: Cumulative minimum y. cum_max: Cumulative maximum y. tibble includes attributes function parameters.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"function generates multiple random walks, sequences steps step random draw normal distribution. user can specify number walks, number steps walk, parameters normal distribution (mean standard deviation). function also allows sampling proportion steps optionally sampling replacement. output tibble includes several computed columns walk, cumulative sum, product, minimum, maximum steps.","code":""},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"Steven P. Sanderson II, MPH","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/random_normal_walk.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate Multiple Random Normal Walks — random_normal_walk","text":"","code":"# Generate 10 random walks with 50 steps each random_normal_walk(.num_walks = 10, .n = 50) #> # A tibble: 400 × 7 #> walk_number x y cum_sum cum_prod cum_min cum_max #> #> 1 1 1 0.0653 0.0653 0 0.0653 0.0653 #> 2 1 2 0.103 0.169 0 0.0653 0.103 #> 3 1 3 -0.0947 0.0741 0 -0.0947 0.103 #> 4 1 4 0.0831 0.157 0 -0.0947 0.103 #> 5 1 5 -0.160 -0.00283 0 -0.160 0.103 #> 6 1 6 -0.0612 -0.0640 0 -0.160 0.103 #> 7 1 7 -0.00677 -0.0708 0 -0.160 0.103 #> 8 1 8 0.0380 -0.0328 0 -0.160 0.103 #> 9 1 9 0.0380 0.00519 0 -0.160 0.103 #> 10 1 10 -0.0551 -0.0499 0 -0.160 0.103 #> # ℹ 390 more rows # Generate random walks with different mean and standard deviation random_normal_walk(.num_walks = 10, .n = 50, .samp = FALSE) #> # A tibble: 500 × 7 #> walk_number x y cum_sum cum_prod cum_min cum_max #> #> 1 1 1 -0.127 -0.127 0 -0.127 -0.127 #> 2 1 2 0.182 0.0553 0 -0.127 0.182 #> 3 1 3 0.0770 0.132 0 -0.127 0.182 #> 4 1 4 -0.0245 0.108 0 -0.127 0.182 #> 5 1 5 -0.0399 0.0680 0 -0.127 0.182 #> 6 1 6 0.147 0.215 0 -0.127 0.182 #> 7 1 7 0.0258 0.241 0 -0.127 0.182 #> 8 1 8 -0.0774 0.164 0 -0.127 0.182 #> 9 1 9 -0.0126 0.151 0 -0.127 0.182 #> 10 1 10 0.00426 0.155 0 -0.127 0.182 #> # ℹ 490 more rows random_normal_walk(.num_walks = 2, .n = 100) |> ggplot(aes(x = x, y = y, group = walk_number, color = walk_number)) + geom_line() + labs(title = \"Random Normal Walk\", x = \"Time\", y = \"Value\") + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Random Walks — rw30","title":"Generate Random Walks — rw30","text":"Generate Random Walks","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Random Walks — rw30","text":"","code":"rw30()"},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Random Walks — rw30","text":"tibble long format columns walk, x, value, representing random walks. Additionally, attributes num_walks, num_steps, mu, sd attached tibble.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate Random Walks — rw30","text":"function generates random walks using normal distribution specified mean (mu) standard deviation (sd). walk generated independently stored tibble. resulting tibble pivoted long format easier analysis.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Generate Random Walks — rw30","text":"Steven P. Sanderson II, MPH function generates 30 random walks 100 steps pivots result long format tibble.","code":""},{"path":"https://www.spsanderson.com/RandomWalker/reference/rw30.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate Random Walks — rw30","text":"","code":"library(ggplot2) # Generate random walks and print the result rw30() #> # A tibble: 3,000 × 3 #> walk_number x y #> #> 1 1 1 0 #> 2 1 2 0.254 #> 3 1 3 2.91 #> 4 1 4 4.07 #> 5 1 5 3.55 #> 6 1 6 3.96 #> 7 1 7 4.31 #> 8 1 8 5.04 #> 9 1 9 5.31 #> 10 1 10 4.04 #> # ℹ 2,990 more rows rw30() |> ggplot(aes(x = x, y = y, color = walk_number, group = walk_number)) + geom_line() + theme_minimal() + theme(legend.position = \"none\") + labs( title = \"30 Random Walks\", x = \"Step\", y = \"Value\", color = \"Walk Number\" )"},{"path":[]},{"path":"https://www.spsanderson.com/RandomWalker/news/index.html","id":"breaking-changes-development-version","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"RandomWalker (development version)","text":"None","code":""},{"path":"https://www.spsanderson.com/RandomWalker/news/index.html","id":"new-features-development-version","dir":"Changelog","previous_headings":"","what":"New Features","title":"RandomWalker (development version)","text":"Fix #9 - Add Function rw30() generate 30 random walks 100 steps Fix #17 - Add Function geometric_brownian_motion() generate Geometric Brownian Motion Fix #18 - Add Function random_normal_drift_walk() generate Random Walk Drift Fix #16 - Add Function brownian_motion() generate Brownian Motion Fix #13 - Add Function random_normal_walk() generate Random Walk Fix #30 - Add Function discrete_walk() generate Discrete Random Walk","code":""},{"path":"https://www.spsanderson.com/RandomWalker/news/index.html","id":"minor-improvements-and-fixes-development-version","dir":"Changelog","previous_headings":"","what":"Minor Improvements and Fixes","title":"RandomWalker (development version)","text":"None","code":""}]