Plotting Functions #36
Replies: 5 comments 21 replies
-
I am not sure if each of these should be different functions that are callable or should be called inside a main plotting function that calls one from some argument, like |
Beta Was this translation helpful? Give feedback.
-
@spsanderson, I started with the basic visualization function. It works with all the different functions in the package. EDIT: I edited the caption to reflect the chosen function.
And here's what the plots look like:
And the rest of the functions with the default settings (walk_number_as_numeric = TRUE):
I would start by creating the other plot types individually. And after that, I would see whether it would make sense to combine them or not. What do you think? |
Beta Was this translation helpful? Give feedback.
-
Here are the functions that return more than just > head(discrete_walk(), 1)
# A tibble: 1 × 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
> head(random_normal_walk(), 1)
# A tibble: 1 × 7
walk_number x y cum_sum cum_prod cum_min cum_max
<fct> <int> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 1 -0.118 -0.118 0 -0.118 -0.118 Maybe it is a design flaw to have these other columns returned, maybe it should really only be Then whatever column is passed as What do you think on that? |
Beta Was this translation helpful? Give feedback.
-
I just pushed a fix
…On Tue, Jul 30, 2024 at 3:22 PM Antti Rask ***@***.***> wrote:
I tested the functions after you made the updates.
brownian_motion(), discrete_walk(), geometric_brownian_motion(),
random_normal_walk(), and rw30() seem to be working fine.
random_normal_drift_walk() seems to be causing problems. I get this error
message:
Error in random_normal_drift_walk() : object 'initial_value' not found
Called from:
rand_walk_helper(dplyr::ungroup(dplyr::arrange(dplyr::select(dplyr::mutate(tidyr::pivot_longer(walks_tibble,
cols = -x, names_to = "walk_number", values_to = "y"), walk_number =
factor(walk_number,
levels = 1:num_walks)), walk_number, x, y, dplyr::everything()),
walk_number, x)), .value = initial_value)
This from the debugger:
function (.data, .value)
{
initial_value = as.numeric(.value)
df <- dplyr::ungroup(dplyr::mutate(dplyr::group_by(.data,
walk_number), cum_sum = initial_value + cumsum(y), cum_prod =
initial_value *
cumprod(1 + y), cum_min = initial_value + cummin(y),
cum_max = initial_value + cummax(y), cum_mean = initial_value +
cmean(y)))
return(df)
}
In other news, cumulative mean looks good to me (with random_normal_walk()
and discrete_walk()):
image.png (view on web)
<https://github.com/user-attachments/assets/fc4e1cee-293c-483c-bde3-e61eecae9246>
—
Reply to this email directly, view it on GitHub
<#36 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPCNS7F7HEQNHG5I7LTEVTZO7RZDAVCNFSM6AAAAABLIPM3CKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMJZGQYTIMI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
--
Steven P Sanderson II, MPH
Amazon Author Profile
<https://www.amazon.com/stores/Steven-P.-Sanderson/author/B0CZ157DHK?ref_=pe_2466670_811284380&isDramIntegrated=true&shoppingPortalEnabled=true>
Book on Lulu <http://goo.gl/lmrlFI>
Personal Site <http://www.spsanderson.com>
|
Beta Was this translation helpful? Give feedback.
-
site and main/developement branches are up to date :) |
Beta Was this translation helpful? Give feedback.
-
This package is in need of some nice plots that can either be ggplot2 or plotly plots, interactivity is nice. Since this package will have in the future support to generate 3D walks I think plotly would be good to have, where 1D and 2D plots are made with ggplot2 and exported as
.interactive
via ggplotly and 3D walks are just made in plotly.Here are some ideas as an issue
#33
Here are some ideas from code to viz:
And compliment of
walks %in% ...
Beta Was this translation helpful? Give feedback.
All reactions