The kernel function presently used in GR3D is only based on basin accessibility (linked to distance between basins) even if a generic formulation including basin attractivity (related to basin size) and fish ability (based on fish length) is proposed in @rougier2015.

The kernel function presently used in GR3D is only based on basin accessibility (linked to distance between basins) even if a generic formulation including basin attractiveness (related to basin size) and fish ability (based on fish length) is proposed in @rougier2015.

The first step is to compute for a departure $j_1$ the weight of each destination basin $j_2$ using:

The first step is to compute for a departure $j_1$ the weight of each destination basin $j_2$ using:

where $D_{j_1\rightarrow j_2}$ is the distance between the departure and destination basins, $\alpha_0$ and $\alpha_1$ are the kernel parameters, $\mu_D$ and $\sigma_D$ are the mean and standard deviation between inter basin distances.

where $D_{j_1\rightarrow j_2}$ is the distance between the departure and destination basins, $\alpha_0$ and $\alpha_1$ are the kernel parameters, $\mu_D$ and $\sigma_D$ are the mean and standard deviation between inter basin distances.

The last two parameters were introduced to standardise distance when accessibility is combining with attractivity and ability. When only considering only accessibility, $\mu_D$ and $\sigma_D$ are simply linked to the distance a strayer can reach. There is no need to be changed when the basins network (number and location of basins) changes. Definitively, the definition as mean and standard deviation of distances is confusing.

The last two parameters were introduced to standardise distance when accessibility is combining with attractiveness and ability. When only considering only accessibility, $\mu_D$ and $\sigma_D$ are simply linked to the distance strayer can reach. There is no need to be changed when the basins network (number and location of basins) changes. Definitely, the definition as mean and standard deviation of distances is confusing.

The sum of weights for the departure basin $j_1$ is: $$w_{j_1} = \sum_{j_2 \neq j_1} {w_{j_1\rightarrow j_2}}$$

The sum of weights for the departure basin $j_1$ is: $$w_{j_1} = \sum_{j_2 \neq j_1} {w_{j_1\rightarrow j_2}}$$

A strayers' mortality is added by considering a "death basin" with a constant weight $w_{death}$. The probability $p_{j_1 \rightarrow j_2}$ for a strayer to reach a destination basin $j_2$ from departure basin $j_1$ is

A strayers mortality is added by considering a "death basin" with a constant weight $w_{death}$. The probability $p_{j_1 \rightarrow j_2}$ for strayer to reach a destination basin $j_2$ from the departure basin $j_1$ is

$$ \#\# Two metrics to qualify the straying The strayers mortality rate $sm_{j_1}$ from a departure basin calculate the portion of fish that ends in the death basin. It is given by:

## Two metrics to qualify the straying

The strayers mortality rate $sm_{j_1}$ from a departure basin caculate the portion of fish that ends in the death basin. It is given by:

# set_caption(ft, 'Examples of distance (in km) between departure and destination basins')

```

```{r}

```{r}

alpha0 = -2.9

alpha0 = -2.9

alpha1 = 19.7

alpha1 = 19.7

meanInterDistance = 300

meanInterDistance = 300

standardDeviationInterDistance = 978

standardDeviationInterDistance = 978

WDeathBasin = .4

WDeathBasinRougier2005 = .4

```

```

The kernel parameters for Atlantic Area application defined by @rougier2015 were $\alpha_0$ = `r alpha0`, $\alpha_1$ = `r alpha1`, $\mu_D$ = `r meanInterDistance` km and $\sigma_D$ = `r standardDeviationInterDistance` km. The death basin weight was $r$ = `r WDeathBasin`.

The kernel parameters for Atlantic Area application defined by @rougier2015 were $\alpha_0$ = `r alpha0`, $\alpha_1$ = `r alpha1`, $\mu_D$ = `r meanInterDistance` km and $\sigma_D$ = `r standardDeviationInterDistance` km. The death basin weight was $r$ = `r WDeathBasinRougier2005`.

```{r}

```{r drawKernelFunctionAA, echo = FALSE, warning = FALSE, include = TRUE, fig.cap = "Kernel function for AA application"}

In Rougier et al. (2015) application, the mean of weight sums is `r round(meanW_AARouguier2015,2)` for a death basin weight of `r round(WDeathBasinRougier2005,2)`. In the present AA application, the mean of weigth sums becomes `r round(meanW_AA,2)`. To keep in concordance with the previous application, the weight of the death basin is now `r round(WDeathBasinAA, 2)`.

Strayers from basins at the distribution edge experience a higher mortality rate (Figure \@ref(fig:strayerMortalityAA)) that means if these basins are colonised they will contribute less to settlements in other basins. No trend is detected in the strayer efficiency except at the extreme northern range of the distribution (Figure \@ref(fig:stayerEfficiencyAA)). More or less if all basins are populated, every basin will receive strayers. Nevertheless there is a particular spot around latitude 43°c.

```{r strayerMortalityAA, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of the mortality rate according to the latitude of the departure basin in the AA zone"}

```{r strayerMortalityAA, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of the mortality rate according to the latitude of the departure basin in the AA zone"}

resultAA %>% ggplot(aes(x = latitude, y = sm_departure)) +

resultAA %>% ggplot(aes(x = latitude, y = sm_departure)) +

geom_point() +

geom_point() +

labs(x = "departure latitude (°)", y = "strayer mortality rate")

labs(x = "departure latitude (°)", y = "strayer mortality rate")

```{r stayerEfficiencyAA, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of the strayers' efficiency according to the latitude of the destination basin in the AA zone"}

```{r stayerEfficiencyAA, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of the strayers' efficiency according to the latitude of the destination basin in the AA zone"}

resultAA %>% ggplot(aes(x = latitude, y = se_destination)) +

resultAA %>% ggplot(aes(x = latitude, y = se_destination)) +

geom_point() +

geom_point() +

labs(x="destination latitude (°)", y = "strayer efficiency")

labs(x = "destination latitude (°)", y = "strayer efficiency") +

```{r strayerMortalityNEA, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of strayers mortality according to depature basin latitude in the NEA zone"}

The strayer mortality for NEA zone displayed high values for latitudes close to 37° and higher than 42.5 with literally no survival after 50° (Figure \@ref(fig:strayerMortalityNEA). Low values of efficiency are calculated at the range of the distribution (Figure \@ref(fig:strayerEfficiencyLatitudeNEA).

```{r strayerMortalityNEA, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of strayers mortality according to departure basin latitude in the NEA zone"}

resultNEA %>% ggplot(aes(x = latitude, y = sm_departure)) +

resultNEA %>% ggplot(aes(x = latitude, y = sm_departure)) +

geom_point() +

geom_point() +

labs(x = "departure latitude (°)", y = "strayer mortality rate")

labs(x = "departure latitude (°)", y = "strayer mortality rate")

```{r strayerEfficiencyLatitudeNEA, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of strayers efficiency according to destination basin latitude in the NEA zone"}

```{r strayerEfficiencyLatitudeNEA, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of strayers efficiency according to destination basin latitude in the NEA zone"}

resultNEA %>% ggplot(aes(x = latitude, y = se_destination)) +

resultNEA %>% ggplot(aes(x = latitude, y = se_destination)) +

geom_point() + labs(x = "destination latitude (°)", y = "strayer's efficiency")

geom_point() + labs(x = "destination latitude (°)", y = "strayer's efficiency")

```{r smFakeUniverse, echo =FALSE, warning = FALSE, include = TRUE, fig.cap = "Evolution of strayer mortality according to latitude departure"}

Let a virtual basin with `r nbBasin` basins equally spaced by `r distBetweenBasin`. Figures \@ref(fig:smFake) and \@ref(fig:seFake) present the response in terms of strayers mortality and strayers efficiency.

```{r smFake, echo =FALSE, warning = FALSE, include = TRUE, fig.cap = "Evolution of strayer mortality according to latitude departure"}

```{r smSampledUniverse, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of strayer mortality according to latitude departure" }

Now we only consider a random sampling of `r nrow(basinSampling)` basins. The consequences of this sampling are presented in figures \@ref(fig :smSampled) and \@ref(fig:seSampled).

ggplot(aes(x=latitude_departure, y = sm_departure)) + geom_point() + labs(x='latitude rank', y = 'strayer mortality rate') +

ggplot(aes(x=latitude_departure, y = sm_departure)) + geom_point() + labs(x='latitude rank', y = 'strayer mortality rate') +

xlim(0,150) + ylim(0.0,.2)

xlim(0,150) + ylim(0.0,.2)

```

```

```{r se_SampledUniverse, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of strayer efficiency according to latitude departure" }

```{r seSampled, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of strayer efficiency according to departure latitude with HaDiad kernel function"}

ggplot(aes(x=latitude_destination, y = se_destination)) + geom_point() + labs(x = 'latitude rank', y = 'strayer efficiency') +

ggplot(aes(x = latitude_destination, y = se_destination)) + geom_point() + labs(x = 'latitude rank', y = 'strayer efficiency') +

xlim(0,150) + ylim(0.0,0.1)

xlim(0,150) + ylim(0.0,0.1)

```

```

# Comparison with HaDiaD formulation

\#Comparison with HyDiaD formulation

In HyDiad the kernel function in an extended negative exponential of the distance between basins. Mortality of strayers is simulated with a mortality coefficient according to inter-basin distances (\@ref(fig:smFunctionHaDiaD). Resulting strayer mortality pattern is presented in \@ref(fig : smHaDiaD).

```{r HaDiaD, echo =FALSE, warning = FALSE, include = TRUE}

```{r smFunctionHaDiaD, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of mortality efficiency according to departure latitude with HaDiad kernel function"}

ggplot(aes(x= distance, y =strayerMortalityRate)) + geom_point()

ggplot(aes(x = distance, y = strayerMortalityRate)) + geom_line()

```

```{r smHaDiaD, echo =FALSE, warning = FALSE, include = TRUE, fig.cap="Evolution of mortality efficiency according to departure latitude with HaDiad kernel function"}

# ggplot(aes(x = latitude_destination, y = se_destination)) + geom_point()

#

```

```

# Conclusion

# Conclusion

The strayer mortality increases at the edge of the distribution.

The strayer mortality increases at the edge of the distribution.

The selection of basins impacts the strayers mortality. It is probably safer to considered a constant rate rather a death basin. It is a priority to improve the coverage of the area by increasing the number of basins considered.

The selection of basins impacts the strayers mortality. It is probably safer to consider a constant rate rather a death basin. It is a priority to improve the coverage of the area by increasing the number of basins considered.

The logit function to compute the basin weights introduces a plateau for the short distance that leads to a random destination in the departure vicinity.

**Steps to calibrate online the process**

- determine the kernel function (to fit the median and maximum distances for strayers);

- calculate the destination basins weights for each departure basin;

- calculate the sum of destination basins weights for each departure basin;

The logit function to compute the basin weights introduces a plateau for the short distance that leads to random destination in the the departure vicinity

- fix the death basin weight to the mean of these sums.