[FLR-list] ssb constraint with FLash

Clara Ulrich clu at aqua.dtu.dk
Mon Oct 27 15:57:59 CET 2014


Great!

I can send all my 7 North Sea stocks if you want more test, since I use this HCR in a lapply loop on all of them ;-)

Clara

-----Original Message-----
From: flr-list-bounces at lists.r-forge.r-project.org [mailto:flr-list-bounces at lists.r-forge.r-project.org] On Behalf Of Iago MOSQUEIRA (JRC)
Sent: 27 October 2014 15:55
To: flr-list at flr-project.org
Subject: Re: [FLR-list] ssb constraint with FLash


Hi,

We might have found the issue but we need to check it a bit more with a couple of different stocks.


Iago

On 27/10/14 15:53, Clara Ulrich wrote:
> Hi Laurie,
> 
> In your example below, you use ssb as a target, not as a minimum. This was working also for me in the previous example, but that is not really what we want? F should be the target, but SSB is just a minimum threshold, exactly like a TAC constraint?
> 
> Clara
> 
> From: flr-list-bounces at lists.r-forge.r-project.org 
> [mailto:flr-list-bounces at lists.r-forge.r-project.org] On Behalf Of 
> laurie
> Sent: 27 October 2014 15:02
> To: flr-list at lists.r-forge.r-project.org
> Subject: Re: [FLR-list] ssb constraint with FLash
> 
> There are a couple of issues neither of which should cause a problem but may point to a bug somewhere.
> The ple4 object differs from the one Clara is using as it start at age 0 not age 1, plus it doesnt come from XSA so the F in the plusgroup is not the same as in plusgrpoup-1.
> It looks like there is a bug in "[" i.e.
> 
> range(ple4[-1])
>       min       max plusgroup   minyear   maxyear   minfbar   maxfbar
>         2        10        -1      1957      2008         2         6
> 
> 
> The following code works as expected, it is a long winded way of constraining SSB. It points in a problem not in the estimation procedure (LU decomposition) but maybe how it is being set up.
> 
> 
> plot(window(stk,start=2006))
> 
> stk=window(iter(MyObj,1),end=2008)
> stk =fwdWindow(stk,eql,end=2010)
> 
> target <-fwdControl(data.frame(year  =c(2009,2009),
>                              val     =c(.3,180000),
>                              #min     =c(NA,180000),
>                              quantity=c("f","ssb")))
> 
> stk.=fwd(stk,ctrl=target ,
>              sr=eql)
> 
> fbar(stk.)[,ac(2009)]
> An object of class "FLQuant"
> , , unit = unique, season = all, area = unique
> 
>      year
> age   2009
>   all 0.21768
> 
> units:  f
>> ssb( stk.)[,ac(2009:2010)]
> An object of class "FLQuant"
> , , unit = unique, season = all, area = unique
> 
>      year
> age   2009   2010
>   all 227124 180000
> 
> units:  NA
> 
> 
> Note that the SSS constraint refers to the SSB at the end of the year if harvest.spwn.
> 
> Laurie
> On 27/10/14 10:36, Clara Ulrich wrote:
> 
> Hej, Thanks for help. I send my object - a stf from North Sea Haddock with 10 iterations.
> 
> 
> 
> Clara
> 
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> 
> From: 
> flr-list-bounces at lists.r-forge.r-project.org<mailto:flr-list-bounces at l
> ists.r-forge.r-project.org> 
> [mailto:flr-list-bounces at lists.r-forge.r-project.org] On Behalf Of 
> laurie
> 
> Sent: 27 October 2014 09:47
> 
> To: flr-list at flr-project.org<mailto:flr-list at flr-project.org>
> 
> Subject: Re: [FLR-list] ssb constraint with FLash
> 
> 
> 
> Is it a bug or poor documentation?
> 
> 
> 
> We used to have  a page on TYFLR with all the different HCRs 
> implemented using FLash. This included the STECF ones with numerous 
> sequential constraints, on F, TAC, SSB etc. I have also implemented 
> some simpler interfaces for fwd. I am currently redoing this see 
> http://rscloud.iccat.int/Tutorials/MSE/hcr.pdf
> 
> 
> 
> As well as being documentation this will also provide a set of tests to make sure no bugs creep in during the winter.
> 
> 
> 
> As Iago says could you provide an example, and if it is not already included in hcr.pdf I will add it. After checking there isnt a bug of course.
> 
> 
> 
> Laurie
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On 27/10/14 09:28, Iago MOSQUEIRA (JRC) wrote:
> 
> Hi,
> 
> 
> 
> I am trying to replicate the issue, using our dear ple4, but I failed
> 
> to do so. If I set a min value for ssb in 2010, which is higher than
> 
> what
> 
> f=0.8 in 2009 would give me, I get as expected a lower F and the right
> 
> ssb, try code below.
> 
> 
> 
> Can you send me your FLStock object?
> 
> 
> 
> Cheers,
> 
> 
> 
> 
> 
> Iago
> 
> 
> 
> 
> 
> library(FLash)
> 
> library(FLAssess)
> 
> 
> 
> data(ple4)
> 
> 
> 
> ple4 <- stf(ple4,3)
> 
> 
> 
> maxF <-fwdControl(data.frame(year=2009,val=0.8,quantity="f")) #  an
> 
> example with high F that decreases biomass a lot
> 
> 
> 
> ple4 <-
> 
> fwd(ple4,ctrl=maxF,sr=list(model="mean",params=FLPar(1)),sr.residuals=
> 
> FLQuant(3500000,dimnames=list(year=2009:2011)))
> 
> 
> 
> fbar(ple4)[,"2009"]
> 
> 
> 
> maxF <-fwdControl(data.frame(year=2009,val=c(0.8,NA),min=c(NA,350000),
> 
> quantity=c("f","ssb")))
> 
> 
> 
> ple4 <-
> 
> fwd(ple4,ctrl=maxF,sr=list(model="mean",params=FLPar(1)),sr.residuals=
> 
> FLQuant(3500000,dimnames=list(year=2009:2011)))
> 
> 
> 
> fbar(ple4)[,"2009"]
> 
> ssb(ple4)[,"2009"]
> 
> ssb(ple4)[,"2010"]
> 
> 
> 
> 
> 
> On 25/10/14 21:35, Clara Ulrich wrote:
> 
> Hi all,
> 
> 
> 
> We are just back from ICES MIXFISH, where we once again made much use
> 
> of FLash power... (still on R 2.15.3 windows 32 bits, we had some
> 
> troubles at the advice meeting in May with using the new FLFleet
> 
> package for R3.1, we haven't tried again - Flash 2.5.0)
> 
> 
> 
> This time we wanted to some SSB-based HCR - Typically, we have a target F with some SSB minimum constraints - for example the biomass must stay above Bpa, or if the biomass is below Bpa, the target is reduced such as SSB should be at least increasing...

> 
> 
> 
> But I kept having troubles making it to work - I had tried this some years ago and it worked OK as far as I remember, but last week I did not manage to get around the problem.
> 
> 
> 
> For example (with target F for 2014, and SSB constraint applying on
> 
> SSB at 1st January 2015 at the end of the fwd year)
> 
> 
> 
> maxF <-fwdControl(data.frame(year=2014,val=0.8,quantity="f")) #  an
> 
> example with high F that decreases biomass a lot Proj <-
> 
> fwd(MyObj,ctrl=maxF,sr=list(model="mean",params=FLPar(1)),sr.residual
> 
> s=FLQuant(3500000,dimnames=list(year=2014:2015)))
> 
> 
> 
> This works :
> 
> fbar(Proj)[,"2014"]
> 
>      An object of class "FLQuant"
> 
>      iters:  10
> 
>      , , unit = unique, season = all, area = unique
> 
>           year
> 
>      age   2014
> 
>        all 0.8(0)
> 
>      units:  f
> 
> 
> 
> ssb(Proj)[,ac(2014:2015)]
> 
>      An object of class "FLQuant"
> 
>      iters:  10
> 
>      , , unit = unique, season = all, area = unique
> 
>           year
> 
>      age   2014      2015
> 
>      all 172983(0)  77323(0)
> 
>      units:  NA
> 
> 
> 
> but this does not work (here an example where the SSB constraint
> 
> should be activated)
> 
> 
> 
> maxF
> 
> <-fwdControl(data.frame(year=2014,val=c(0.8,NA),min=c(NA,150000),
> 
> quantity=c("f","ssb"))) Proj <-
> 
> fwd(MyObj,ctrl=maxF,sr=list(model="mean",params=FLPar(1)),sr.residual
> 
> s=FLQuant(3500000,dimnames=list(year=2014:2015)))
> 
> 
> 
> fbar(Proj)[,"2014"]
> 
>      An object of class "FLQuant"
> 
>      iters:  10
> 
>      , , unit = unique, season = all, area = unique
> 
>           year
> 
>      age   2014
> 
>        all 0.016914(0)
> 
>      units:  f
> 
> 
> 
> ssb(Proj)[,ac(2014:2015)]
> 
>      An object of class "FLQuant"
> 
>      iters:  10
> 
>      , , unit = unique, season = all, area = unique
> 
>           year
> 
>      age   2014      2015
> 
>      all 172983(0) 172983(0)
> 
>      units:  NA
> 
> 
> 
> 
> 
> and this doesn't work either when the SSB is not constraining (e.g.
> 
> SSB limit so low that it is always achieved). Only if I specify ssb
> 
> as a value inn fwdControl does it compute correctly, but that is not
> 
> the idea, it should be a minimum
> 
> 
> 
> 
> 
> I have tried several ways around this but cannot find out... Any idea of what is getting wrong?
> 
> 
> 
> Thanks in advance,
> 
> Cheers
> 
> Clara
> 
> _______________________________________________
> 
> flr-list mailing list
> 
> flr-list at flr-project.org<mailto:flr-list at flr-project.org>
> 
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 
> flr-list mailing list
> 
> flr-list at flr-project.org<mailto:flr-list at flr-project.org>
> 
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
> 
> 
> 
> 
> _______________________________________________
> 
> flr-list mailing list
> 
> flr-list at flr-project.org<mailto:flr-list at flr-project.org>
> 
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
> 
> 
> 
> 
> _______________________________________________
> flr-list mailing list
> flr-list at flr-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
> 


--
Dr Iago Mosqueira

European Commission - Joint Research Center Institute for the Protection and Security of the Citizen (IPSC) Maritime Affairs Unit G04 TP 051, Via Enrico Fermi 2749
I-21027 Ispra (VA), Italy

Office : +39 0332 785413
Fax: +39 0332 789658

iago.mosqueira at jrc.ec.europa.eu

http://fishreg.jrc.ec.europa.eu/home

_______________________________________________
flr-list mailing list
flr-list at flr-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list


More information about the flr-list mailing list