Skip to content

Commit

Permalink
update site and fix minor errors
Browse files Browse the repository at this point in the history
  • Loading branch information
spsanderson committed Jul 19, 2024
1 parent 95b3ed9 commit c498d73
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 35 deletions.
2 changes: 1 addition & 1 deletion R/auto-rw30.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ rw30 <- function() {
attr(walks_long, "mu") <- mu
attr(walks_long, "sd") <- sd
attr(walks_long, "fns") <- "rw30"
attr(res, "dimension") <- 1
attr(walks_long, "dimension") <- 1

return(walks_long)
}
18 changes: 9 additions & 9 deletions R/gen-brown-motion.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ brownian_motion <- function(.num_walks = 10, .n = 100, .delta_time = 1,
colnames(rand_matrix) <- 1:num_sims

# Get the Brownian Motion and convert to price paths
ret <- apply(rbind(rep(initial_value, num_sims), rand_matrix), 2, cumsum)
res <- apply(rbind(rep(initial_value, num_sims), rand_matrix), 2, cumsum)

# Return
if (return_tibble){
ret <- ret |>
res <- res |>
dplyr::as_tibble() |>
dplyr::mutate(t = 1:(t+1)) |>
tidyr::pivot_longer(-t) |>
Expand All @@ -99,13 +99,13 @@ brownian_motion <- function(.num_walks = 10, .n = 100, .delta_time = 1,
}

# Return ----
attr(ret, "n") <- .n
attr(ret, "num_walks") <- .num_walks
attr(ret, "delta_time") <- .delta_time
attr(ret, "initial_value") <- .initial_value
attr(ret, "return_tibble") <- .return_tibble
attr(ret, "fns") <- "brownian_motion"
attr(res, "n") <- .n
attr(res, "num_walks") <- .num_walks
attr(res, "delta_time") <- .delta_time
attr(res, "initial_value") <- .initial_value
attr(res, "return_tibble") <- .return_tibble
attr(res, "fns") <- "brownian_motion"
attr(res, "dimension") <- 1

return(ret)
return(res)
}
20 changes: 10 additions & 10 deletions R/gen-geom-brown-motion.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ geometric_brownian_motion <- function(.num_walks = 25, .n = 100,

# Return
if (return_tibble){
ret <- ret |>
res <- res |>
dplyr::as_tibble() |>
dplyr::mutate(t = 1:(t+1)) |>
tidyr::pivot_longer(-t) |>
Expand All @@ -116,15 +116,15 @@ geometric_brownian_motion <- function(.num_walks = 25, .n = 100,
dplyr::arrange(walk_number, x)
}

attr(ret, "n") <- .n
attr(ret, "num_walks") <- .num_walks
attr(ret, "mean") <- .mu
attr(ret, "sigma") <- .sigma
attr(ret, "initial_value") <- .initial_value
attr(ret, "delta_time") <- .delta_time
attr(ret, "return_tibble") <- .return_tibble
attr(ret, "fns") <- "geometric_brownian_motion"
attr(res, "n") <- .n
attr(res, "num_walks") <- .num_walks
attr(res, "mean") <- .mu
attr(res, "sigma") <- .sigma
attr(res, "initial_value") <- .initial_value
attr(res, "delta_time") <- .delta_time
attr(res, "return_tibble") <- .return_tibble
attr(res, "fns") <- "geometric_brownian_motion"
attr(res, "dimension") <- 1

return(ret)
return(res)
}
2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pkgdown: 2.1.0
pkgdown_sha: ~
articles:
getting-started: getting-started.html
last_built: 2024-07-19T21:36Z
last_built: 2024-07-19T21:52Z
urls:
reference: https://www.spsanderson.com/RandomWalker/reference
article: https://www.spsanderson.com/RandomWalker/articles
Binary file modified docs/reference/Rplot001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 20 additions & 7 deletions docs/reference/brownian_motion.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/geometric_brownian_motion.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/reference/random_normal_drift_walk-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions docs/reference/random_normal_drift_walk.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/reference/rw30-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions docs/reference/rw30.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

0 comments on commit c498d73

Please sign in to comment.