Learn R Programming

FlywayNet (version 0.1.0)

generate_trajectories: Generate trajectories of birds.

Description

Generate trajectories of birds. A bird trajectory specifies, at each time step, the state of the bird: a site number in 1...S, 0 for flying, -1 for dead and NA for unknown. If partial trajectories (positions of birds are not known until the horizon specified in migration structure) are provided with the argument traj, they are simulated until a time limit defined by the argument end_time.

Usage

generate_trajectories(migr, traj = NULL, end_time = migr$horizon)

Arguments

migr

A migration structure (attributes site_name, initial_state, flight_duration, death_probability, transition_law_param, sojourn_law_param, sojourn_law_type are used).

traj

Partial trajectories, matrix N x (horizon+1) that are going to be extended in time. If NULL, it is initialized from migr structure.

end_time

Time until which simulation is required. If NULL, it is initialized with migr horizon.

Value

A trajectory matrix N x (horizon+1) defining a trajectory for each bird. A trajectory for one bird, specifies at each time step (from 0 to horizon) the state of the bird. Incomplete trajectories finishing with NA are returned if the argument end_time is set a value above migr horizon.

Examples

Run this code
# NOT RUN {
migr <- generate_toy_migration()
traj <- generate_trajectories( migr )
# }

Run the code above in your browser using DataLab