Learn R Programming

EcoVirtual (version 1.1)

randWalk: Random Walk Simulations

Description

Simulates random walk models.

Usage

randWalk(S = 1, step = 1, tmax = 1e+05, x1max = 200, alleq = FALSE)

Arguments

S

number of individuals.

step

step size (number of steps on each time)

tmax

maximum simulation time.

x1max

maximum initial distance from absorption surface.

alleq

logical; if TRUE, all initial distance are equal. if FALSE, initial distances for each individual is a sample between 1 and maximum initial distance(x1max).

Value

'randWalk' returns a graphic with the simulated trajectories of each individual.

'randWalk' also returns an invisible matrix with the distance from de edge for each individual on each time.

Details

Random walk is a stochastic process of a succession of random steps.

Zero is the absorption surface. When an individual simulation reaches zero, it means that the individual is dead.

See http://en.wikipedia.org/wiki/Random_walk.

References

http://en.wikipedia.org/wiki/Random_walk

See Also

extGame, simHub, http://ecovirtual.ib.usp.br

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
randWalk(S=100,step=2,tmax=2e5)
randWalk(S=10,step=1,tmax=1e4, x1max=300, alleq=TRUE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab