A random walk is a mathematical formalization of a path that consists in a succession of random steps. A random walk can be a Markov chain or process; it can be on a graph or a group. Random walks can model randomized processes, in fields such as: ecology, economics, psychology, computer science, physics, chemistry, and biology.
Questions tagged [random-walk]
248 questions
3
votes
4 answers
Random walk series between start-end values and within minimum/maximum limits
How can i generate a random walk data between a start-end values
while not passing over the maximum value and not going under the minimum value?
Here is my attempt to do this but for some reason sometimes the series goes over the max or under the…

RaduS
- 2,465
- 9
- 44
- 65
3
votes
1 answer
Python for loop only saves the last loop in my 2-d array
I am producing one dimensional random walks and I want my for loop to save the maximum distance from the origin that has been reached so far, as time progresses. 5 random walks are produced.
This is my code:
for j in range(5):
r = rand(10000)
…

nikfilippas
- 105
- 2
- 11
3
votes
2 answers
How to decide the step size when using Metropolis–Hastings algorithm
I have a simple question regarding to Metropolis–Hastings algorithm.
Suppose the distribution only has one variable x and the value range of x is s=[-2^31,2^31].
In the sampling process, I need to propose a new value of x and then decide whether…

Dingbao Xie
- 716
- 9
- 21
3
votes
1 answer
Random Walk on Bipartite Graph with Gremlin
I would like to rank items according to a given users preference (items liked by the user) based on a random walk on a directed bipartite graph using gremlin in groovy.
The graph has the following basic structure:
[User1] ---'likes'---> [ItemA]…

Faber
- 1,504
- 2
- 13
- 21
3
votes
2 answers
How to verify if a vector has a value at a certain index
In a "self-avoiding random walk" situation, I have a 2-dimensional vector with a configuration of step-coordinates. I want to be able to check if a certain site has been occupied, but the problem is that the axis can be zero, so checking if the…

NictraSavios
- 502
- 2
- 9
- 29
3
votes
1 answer
Calculate correlation of data generated by function in R
I have created the following function in R:
timeseriesmodel <- function(N, x0, delta, variance) {
z<-cumsum(rnorm(n=N, mean=0, sd=sqrt(variance)))
t<-1:N
x<-x0+t*delta+z
return(x)}
This function returns a vector 'x' of…

Radda
- 51
- 3
3
votes
1 answer
vrtest package: extended text answers?
I ran a Variance Ratio test using the vrtest package (and the Lo.Mac command). My problem is that R just provides me with the computed test statistics and not with the frontier value of the test, the p values etc. Does someone know how to do this?…

Geraldine
- 47
- 2
2
votes
1 answer
Dynamic Programming - Given num K, how many ways to get from (0,0) to (x,y)?
A robot is moving in the (x~y) coordinate system according to a plan that was attached to him prior to his start.
The robot always starts at (0, 0) and only understands 4 commands -
WEST - (x-1, y)
SUD - (x, y-1)
OST - (x+1, y)
NORD - (x, y+1)
Every…

natik
- 21
- 3
2
votes
1 answer
Efficient controlled random walks in gremlin
Goal
The objective is to efficiently generate random walks on a relatively large graph with uneven probabilities of going through edges depending on their type.
Configuration
Ubuntu VM, 23Go RAM
JanusGraph 0.6.1 full
Local graph (default…

GregoirePelegrin
- 1,206
- 2
- 7
- 23
2
votes
3 answers
Generating a 1D random walk with random module
I was trying to generate a random walk in 1D just with the random module. If a position at a certain moment is x, then the next position can be x+1 or x-1 with equal probability. I need to find the final position after 100 moves (start=0).
I have…

12666727b9
- 1,133
- 1
- 8
- 22
2
votes
1 answer
More efficient self-avoiding freely-jointed chain in 3D?
I am trying to create a simple self-avoiding freely-jointed chain. The chain part is already completed, it starts at a given point in 3D space (e.g. [0,0,0]). I then generate a new point by randomizing two spherical coordinates θ, φ (the radius is…

Teddi
- 21
- 2
2
votes
0 answers
Improving performance of algorithm for random walk
I have been recently working with graph, specifically in detecting community structure in graph, and this requires me to program random walks.
I have ran my code several times but all of them show a very slow performance of the random walkers.…

Quang Dũng Đinh
- 41
- 3
2
votes
1 answer
Histogram of the 1D-random walk in Julia
This is a simulation of 100 1D-random "walkers" each taking 100 "steps" in either one direction or another by +1/-1.
using Plots
init = 0
walkers = 100
walk_length = 100
walks = cumsum(vcat(fill(init, 1, walkers), # initial state
…

Struggling_Student
- 454
- 3
- 17
2
votes
3 answers
Simulate a two-dimensional random walk in a grid in R and plot with ggplot
I was looking for a simple code that could simulate a two-dimensional random walk in a grid (using R), and then plot the data using ggplot.
In particular, I was interested to a random walk from few position (5 points) in a 2D grid to the center of…

CafféSospeso
- 1,101
- 3
- 11
- 28
2
votes
1 answer
Finding the mean time to reach a given threshold for random walk in python
I have a code for a random walk of 10000 steps. I then had to repeat the simulation 12 times and save each in a separate text file, which I have done. I have now been given a task, to find on average, how many steps it takes for the random walk to…

Rhys11
- 33
- 1
- 3