The random_displacement_walk function generates a single random walk in 2 dimensions (x, y),
where each step is a random displacement in both x and y directions, sampled from the provided
displacement and distance spaces. The walk disregards steps where both x and y displacements are zero.
random_displacement_walk(
.num_walks = 25,
.seed = NULL,
.n = 100,
.distance_space = c(0, 1, 2, 3, 4),
.displacement = c(-1, 1),
.dimensions = 1
)A tibble with columns depending on the number of dimensions:
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 tibble includes attributes for the function parameters.
An integer specifying the number of random walks to generate. Default is 25.
An optional value to set the random seed. If NULL, no seed is set. Default is NULL.
The number of steps in the walk. Must be >= 0. Default is 100.
A numeric vector of possible step distances. Default is c(0, 1, 2, 3, 4).
A numeric vector of possible step directions. Default is c(-1, 1).
An integer specifying the number of dimensions (1, 2, or 3). Default is 1.
Steven P. Sanderson II, MPH
Other Generator Functions:
brownian_motion(),
custom_walk(),
discrete_walk(),
double_pendulum_walk(),
geometric_brownian_motion(),
random_beta_walk(),
random_binomial_walk(),
random_cauchy_walk(),
random_chisquared_walk(),
random_exponential_walk(),
random_f_walk(),
random_gamma_walk(),
random_geometric_walk(),
random_hypergeometric_walk(),
random_logistic_walk(),
random_lognormal_walk(),
random_multinomial_walk(),
random_negbinomial_walk(),
random_normal_drift_walk(),
random_normal_walk(),
random_poisson_walk(),
random_smirnov_walk(),
random_t_walk(),
random_uniform_walk(),
random_weibull_walk(),
random_wilcox_walk(),
random_wilcoxon_sr_walk()
Other Discrete Distribution:
discrete_walk(),
random_binomial_walk(),
random_geometric_walk(),
random_hypergeometric_walk(),
random_multinomial_walk(),
random_negbinomial_walk(),
random_poisson_walk(),
random_smirnov_walk(),
random_wilcox_walk(),
random_wilcoxon_sr_walk()
random_displacement_walk(.n = 10, .seed = Sys.Date())
Run the code above in your browser using DataLab