# migrate: Migrate In bthe/rgadget: R package for Gadget models

## Description

If more than one area is defined the user can define migration between the areas. The migration procedure is the same as in MULTSPEC. The migration is defined and takes place in every timestep and it is assumed to be constant for all years. This means that the porportion that migrates from area i to j can be different between different timesteps (seasons) but they are fixed between observations (years). Migration at timestep t is defined by the user as an nxn transition matrix P_t := [p_ij] where p_ij is the proportion moving from area j to area i, ignoring other processes. For P to be a transition matrix sum_i p_ij = 1, for each j. The vector of abundance for all areas at time t is therefore:

N_t = P_t N_{t-1}

In a two area example this would mean that if N_1,t-1 is a matrix containing the abundance in numbers in area 1 at timestep t before migration and N_2,t-1 is the same number for area 2, the numbers after migration will be

N_{1,t} = p_{11}\cdot N_{1,t-1} + p_{12}\cdot N_{2,t-1}

N_{2,t} = p_{21}\cdot N_{2,t-1}+ p_{22}\cdot N_{2,t-1}

## Usage

 1 migrate(N, M) 

## Arguments

 N An array containing substock abundance by area (first dimension) and other variables M an array with migration matricies

## Value

the migrated substock abundance array