Code Monkey home page Code Monkey logo

doc's Introduction

FLR documentation

This repository contains the material for the tutorials on FLR published at http://flr-project.org/doc

Structure

  • Rmd SOURCE rmarkdown documents
  • docs/ html pages to appear on website
  • docs/pdf pdf versions of tutorials
  • docs/R R codee in tutorials
  • Makefile To create html pdf and R files from rmd
  • bibliography.bib BibTeX document available to all documents
  • index.md Markdown file for the docs/index.html file
  • _site.yml rmarkdown::render configuration

Useful links

doc's People

Contributors

agurtzaneurtizberea avatar arinam avatar dorleta avatar drfinlayscott avatar gustavdelius avatar iagomosqueira avatar jaado avatar janjaappoos avatar lauriekell avatar lcitores avatar marguius avatar martacousido avatar niknikos avatar pdolder avatar ssanchezazti avatar yvermard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doc's Issues

Data to objects

Hi,

Are data files for ple4 and ple4indices available to download? Constructing FLQuant and FLStock objects with our data is not easy and having access to data files or a more detailed protocol on how the objects in the ple4 example were constructed would help.

Thanks!

FLBEIA tutorials html links broken

Hi there,
It appears that the html links to only 2/6 FLBEIA tutorials are currently available:

  • Conditioning FLBEIA using Smart Conditioning Functions
  • A simple example on how to use FLBEIA [working]
  • A simple example with multiple dimensions in FLBEIA [working]
  • Using Stock Assessment models in the Management procedure of FLBEIA
  • Testing different Management Strategies in FLBEIA
  • Data Limited MSE in FLBEIA

Maybe a problem with the build?

FLasher tutorial out of date

FLasher Tutorial "Forecasting on the Medium term ..." needs to be updated with the correct years in the examples. Change due to updated ple4 data object.

How insert years

How can I put years not sequential when constructing the FLQuant matrix? I have data from the years 1978 to 1985, after 1993 to 1997 and 2008 to 2011 and I can not build the matrix considering years not sequences.
Thank you for your help

MSE tutorial - getCtrl function issue

Hello,
I try to run the MSE tutorial and found a few small issues. However, one I cannot overcome is the issue with the getCtrl function. There is an error message with the last line in particular, where it says ctrl@trgtArray<-arr0. It seems there is no option in the fwdControl object to add a target array. I used the basic fwdControl function to create an object to get on with the tutorial, however, I believe I need to get something like this target array to proceed with the tutorial in full.

Thanks,

Pia

getCtrl <- function(values, quantity, years, it){
dnms <- list(iter=1:it, year=years, c("min", "val", "max"))
arr0 <- array(NA, dimnames=dnms, dim=unlist(lapply(dnms, length)))
arr0[,,"val"] <- unlist(values)
arr0 <- aperm(arr0, c(2,3,1))
ctrl <- fwdControl(data.frame(year=years, quantity=quantity, val=NA))
ctrl@trgtArray <- arr0
ctrl
}
M

VPA-tutorial: FLXSA- retrospective analyses

Hello,

I am trying to reproduce the VPA tutorial for North Sea Plaice stock using FLXA:

After loading the data, I run the FLXSA function:

library(FLCore)
library(FLAssess)
library(FLXSA)
data(ple4)
data(ple4.indices)
xsa.control <- FLXSA.control()
ple4.xsa    <- FLXSA(ple4, ple4.indices, xsa.control)

and then I want to perform a retrospective analysis using:

retro.years <- 2012:2017 # updated values from online tutorial
ple4.retro <- tapply(retro.years, 1:length(retro.years), function(x){
  window(ple4,end=x)+FLXSA(window(ple4,end=x),ple4.indices)
})

I get the following error:
Error in lapply(assess@index, FLQuant) : negative length vectors are not allowed

It seems like I can't call 2 or more than 2 FLXSA in the same R session. Any idea, on how to perform a retrospective analysis using FLXSA ?

Thanks,

Here is my session info:

R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] FLXSA_2.6.3 FLAssess_2.6.3 FLCore_2.6.14 iterators_1.0.12 lattice_0.20-38
loaded via a namespace (and not attached):
[1] MASS_7.3-51.4 compiler_3.6.2 Matrix_1.2-18 tools_3.6.2 grid_3.6.2 stats4_3.6.2

BUGS in A_quick_introduction_to_FLR

L71 result -> results

L76 I guess I’m a bit slow here but there is nothing “useful” about this FLQuant object, it is just completely random entries? Where would the unit (NA in output) go?

L85 Specifically, it plots the recruit/SSB/catch/harvest of the object, i.e. population-level parameters of the stock. Is this all that the FLStock object does from the component FLQuants? Is there anything else?

L94 I get Error in inherits(a, "SpatialPoints") : argument "a" is missing, with no default

LSM error function In [email protected] - e2

In the LSM function I get an error:

Error in eval (call, parent.frame ()):
dims [product 8] do not match the length of object [10]
In addition: Warning message:
In e1 @ .Data - e2:
longer object length is not a multiple of shorter object length

when I look for where the error is, I find that it is here:

diff <- sum (abs (harvest (stock) [, ac (range (stock) ["maxyear"])] - Fnew))

Thank you for helping me with this error.

Input os datas in FLR

Hello, my name is Luiza Prestes, I would like to use the routine FLR in the R to analyze the effectiveness of management measures adopted for fishing of piramutaba (B. vaillanti) at the mouth of the Amazon River for approximately 35 years. The data available to you are for disembarkation, however, are size classes and centimeters and number of copies per size class for the years 1978, 1979, 1980, 1982, 1983, 1984, 1985, 1993, 1994, 1995, 1996 , 1997, 2008, 2009, 2010, 2011. Is it possible to use this data entry and analyze the MSE?

thanks

loading in spawner/recruit data

Hello,

I am attempting to load in data to do a simple ricker and beverton holt spawner recruit models on some spring chinook data. The data I have is number of spawner fish and coresponding number of recruits (recruits have already been calculated for different ages and added together for each year corresponding to spawners) from 1981-2017. I am having trouble getting the matrix to read in correctly to identify/recognize ssb and rec.

It seems like the "nsher" data is most similar to mine, I have tried to get my CSV data in the same format. But have been unsusccessful.

Can you help me with the code to get this data loaded in FLQuant?

Attached is the code I have so far (some of it working and some of it not) and the csv file I am reading the data in from.
NasonSR.csv
FLR_SpawnerRecruitCode.txt

Thank you!
Katy

multiple of replacement length error

Hi,

On the FLash Medium Term Forecast tutorial I keep having an error at:

sample_years <- sample(dimnames(residuals(ple4_sr))$year, niters * 10, replace = TRUE)

and

multi_rec_residuals[] <- exp(residuals(ple4_sr)[,sample_years])

error is:

Error in do.call("[<-", c(list(x = y), iper, list(value = aperm(unname(value),  : 
  number of items to replace is not a multiple of replacement length

However, the error is not there when I do not multiply niters by 10 when defining sample_years. Why are we multiplying this by 10? Is that for the ages? It doesn't work anyway.
Regards,
Ruben

XSA with missing years

Dear developers of FLR,

firstly, thanks a lot for providing this important tool.
I have a question regarding missing years in the catch-at-age time series for doing an XSA.
We are now trying to set up an XSA for redfish (Sebastes mentella) and have biomass/abundance survey indices and catch-at-age data for ~40 years. However, for 3 years, catch-at-age is missing because we do not have any information regarding length/age distribution of the commercial catches. The survey index does, however, exist for these years.
Can we still compute the XSA with these 3 missing years?

Best regards from the Thünen Institute
Karl

fwdcontrol using "catch" as quantity

I am using fwdcontrol and fwd for short term forecasts. It works quite well, except when I use the "catch" quantity. I use the fsq for the intermediate year, and then want to have a catch restrict on the following year (such as a TAC rollover). However, the output value for catches is different than the one that I use as a value.

I am attaching my stock object and the code I am running. It does include examples how the SSB and F quantities work perfectly, however not the "catch" one.

Any ideas?
FLR issues.zip

XSA by sex

Hello,

I'm new to using the XSA method and I'm trying to apply it by gender (males and females in the same assessment). Is it possible to do it using the FLXSA?

I am looking for similar references, but I have not been successful.

Thanks

MSE loop error in MSE introduction.

When I do the tutorial "An introduction to MSE with FLR": https://flr-project.org/doc/An_introduction_to_MSE_using_FLR.html
I get an error in the final step which is the MSE loop:

set.seed(231) # set seed to ensure comparability between different runs
for(i in vy[-length(vy)]){
  # set up simulations parameters
    ay <- an(i)
    cat(i, " > ")
  flush.console()
    vy0 <- 1:(ay-y0) # data years (positions vector) - one less than current year
    sqy <- (ay-y0-nsqy+1):(ay-y0) # status quo years (positions vector) - one less than current year

  # apply observation error
    oem <- o(stk.om, idx, i, vy0)
    stk.mp <- oem$stk
    idx.mp <- oem$idx
    idx <- oem$idx.om

  # perform assessment
  out.assess <- xsa(stk.mp, idx.mp)
  stk.mp <- out.assess$stk
  
  # apply ICES MSY-like Rule to obtain Ftrgt
  # (note this is not the ICES MSY rule, but is similar)
  flag <- ssb(stk.mp)[,ac(ay-1)]<Bpa
  Ftrgt <- ifelse(flag,ssb(stk.mp)[,ac(ay-1)]*Fmsy/Bpa,Fmsy) 

  # project the perceived stock to get the TAC for ay+1
  fsq.mp <- yearMeans(fbar(stk.mp)[,sqy]) # Use status quo years defined above
  ctrl <- getCtrl(c(fsq.mp, Ftrgt), "f", c(ay, ay+1), it)
  stk.mp <- stf(stk.mp, 2)
  gmean_rec <- c(exp(yearMeans(log(rec(stk.mp)))))
  stk.mp <- fwd(stk.mp, control=ctrl, sr=list(model="mean", params = FLPar(gmean_rec,iter=it)))
  TAC[,ac(ay+1)] <- catch(stk.mp)[,ac(ay+1)]

  # apply the TAC to the operating model stock
  ctrl <- getCtrl(c(TAC[,ac(ay+1)]), "catch", ay+1, it)
  stk.om <- fwd(stk.om, control=ctrl,sr=srbh, sr.residuals = exp(srbh.res), sr.residuals.mult = TRUE)
}

The error is :

2018  > 
 Error in .local(stock, indices, ...) : 
  negative length vectors are not allowed 

It is very annoying and I don't know how to fix it. Could anyone help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.