tokami / TropFishR

Tropical Fisheries Analysis with R
24 stars 19 forks source link

demo file excel #42

Open quangvanvo opened 2 years ago

quangvanvo commented 2 years ago

Please share the demo file in excel for each in data Quang

quangvanvo commented 2 years ago

The ELEFAN not run, Please help


setwd("D:/R/Lyson/Comque") LScomque = read.csv("D:/R/Lyson/Comque/lfq3.csv", header=T, sep = ",") dates <- colnames(LScomque)[-1] dates <- strsplit(dates, "X") dates <- unlist(lapply(dates, function(x) x[2])) dates <- as.Date(dates, "%Y-%d-%m") lfq5 <- list(dates = dates, midLengths = lfqCq$lengthClass, catch = as.matrix(LScomque[,-1])) class(lfq5) <- "LScomque" lfq5$catch[is.na(lfq5$catch)] <- 0 plot(lfq5, Fname = "catch")

synthetic lfq data example

setwd("D:/R/Lyson/Comque") data("lfq5") plot(lfq5, Fname="catch")

ELEFAN_SA (takes approximately 2 minutes)

output <- ELEFAN_SA(lfq5, SA_time = 60*2, seasonalised = TRUE, MA = 11, init_par = list(Linf = 75, K = 0.5, t_anchor = 0.5, C = 0.5, ts = 0.5), low_par = list(Linf = 70, K = 0.3, t_anchor = 0, C = 0, ts = 0), up_par = list(Linf = 90, K = 0.7, t_anchor = 1, C = 1, ts = 1)) output$par output$Rn_max

view fit

plot(output)

or

plot(output, draw = FALSE) lfqFitCurves(output, col=1, par=output$par, draw=TRUE)$ESP

compare to original parameters

tmp <- lfqFitCurves(output, col=4, lty=1, par=list(Linf=80, K=0.5, t_anchor=0.25, C=0.75, ts=0.5), draw=TRUE) tmp$fESP output$Rn_max