Commit 87b7bb9e by patrick.lambert

### with a new computeOgive

parent 10525849
 ... @@ -39,6 +39,7 @@ vonBertalanffyInverse = function(L, L0, Linf, K){ ... @@ -39,6 +39,7 @@ vonBertalanffyInverse = function(L, L0, Linf, K){ # von Bertalanffy increment # von Bertalanffy increment # pas cohérent avec la temperature effet sur le coeff de croissance mais ca marche # pas cohérent avec la temperature effet sur le coeff de croissance mais ca marche vonBertalanffyIncrement = function(nStep, L0, Linf, K, timeStepDuration, sigma, withTempEffect=FALSE, TrefAtSea = c(9.876946, 13.489854, 15.891487, 11.554104) ){ vonBertalanffyIncrement = function(nStep, L0, Linf, K, timeStepDuration, sigma, withTempEffect=FALSE, TrefAtSea = c(9.876946, 13.489854, 15.891487, 11.554104) ){ tempEffect = temperatureEffect( TrefAtSea , 3, 17, 26) tempEffect = temperatureEffect( TrefAtSea , 3, 17, 26) L = matrix(nrow = nStep + 1) L = matrix(nrow = nStep + 1) ... @@ -156,8 +157,24 @@ vonBertalanffyWithRandomVector = function(L, Linf, K, timeStepDuration, randomVe ... @@ -156,8 +157,24 @@ vonBertalanffyWithRandomVector = function(L, Linf, K, timeStepDuration, randomVe return(L) return(L) } } computeOgive = function(lengthTrajectories, lengthAtMaturity){ ogive <- lengthTrajectories %>% group_by(age) %>% summarise(nTotal = n()) %>% left_join(lengthTrajectories %>% group_by(age) %>% filter(L >= lengthAtMaturity) %>% summarise(taller = n(), .groups = 'drop'), by = 'age') %>% replace_na(list(taller = 0)) %>% mutate(mature = c(0,diff(taller)), immature = nTotal - cumsum(mature), p = if_else(mature + immature > 0 , mature / (mature + immature), 1)) %>% select(age, p) return(ogive) } computeOgive = function(lengthTrajectories, lengthAtMaturity) { # deprecated computeOgive3 = function(lengthTrajectories, lengthAtMaturity) { ogive <- ogive <- lengthTrajectories %>% lengthTrajectories %>% group_by(age) %>% group_by(age) %>% ... ...