Given a set of ages and parameters, calculate the migration age schedule based on the Rogers and Castro formula.
Choose between a 7,9,11 or 13 parameter model.

`mig_calculate_rc(ages, pars)`

## Arguments

ages |
numeric. A vector of ages for migration rates to be calculated. |

pars |
numeric. A named list of parameters. See below for details. |

## Details

In the full 13 parameter model, the migration rate at age x, \(m(x)\) is defined as
$$m(x) = a1*exp(-1*alpha1*x) + a2*exp(-1*alpha2*(x - mu2) - exp(-1*lambda2*(x - mu2))) + a3*exp(-1*alpha3*(x - 3) - exp(-1*lambda3*(x - mu3))) + a4*exp(lambda4*x) + c$$

The first, second, third and fourth pieces of the equation represent pre-working age, working age, retirement and post-retirement age patterns, respectively.
Models with less parameters gradually remove terms at the older ages. Parameters in each family are:

pre-working age: a1, alpha1

working age: a2, alpha2, mu2, lambda2

retirement: a3, alpha3, mu3, lambda3

post retirement: a4, lambda4

For a specific family to be included, values for all parameters in that family must be specified.

## References

Rogers A, Castro LJ (1981).
*Model migration schedules*.
RR-81-030.

## Examples

```
if (FALSE) {
pars <- c(a1= 0.09, alpha1= 0.1, a2= 0.2,
alpha2= 0.1, mu2= 21, lambda2= 0.39, a3= 0.001,
alpha3= 1, mu3= 67, lambda3= 0.6, c= 0.01)
ages <- 0:75
mx <- mig_calculate_rc(ages = ages, pars = pars)
plot(ages, mx, type = 'l')
}
```