Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fwdcontrol using "catch" as quantity #25

Open
piaschuchert opened this issue Jul 7, 2022 · 8 comments
Open

fwdcontrol using "catch" as quantity #25

piaschuchert opened this issue Jul 7, 2022 · 8 comments

Comments

@piaschuchert
Copy link

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

@yvermard
Copy link
Contributor

yvermard commented Jul 7, 2022

Hi, looks like it's coming from your catch.wt that do not have wt for older ages (after age 7 and already quite different friom landing.wt at age 6).
catch(stf1)[,ac(2023)] returns 206 which is the TAC you're asking for? Seems like you should solve catch.wt prb first?
Best

@iagomosqueira
Copy link
Member

Are you referring to the runs in, say, lines 163-164?

ctrl <- fwdControl(data.frame(year=max(years)+1:3,val=c(fsq,TAC,0),quantity=c('f','catch','f')))
stf1  <- fwd(stf0, ctrl=ctrl, sr=srr)

As Youen pointed out there are ages with zero wt. If you run

verify(stock)

you can see that both catch.wt and stock.wt have weights not greater than 0.

@piaschuchert
Copy link
Author

piaschuchert commented Jul 7, 2022 via email

@piaschuchert
Copy link
Author

Dear Iago and Youen,
I did just update the stock object and re-ran the script. However, the error persists. Indeed, it seems that the fields

,Catch=round(c(landings(stf1)[,nyears+2]+discards(stf1)[,nyears+2])) ,Land=round(c(landings(stf1)[,nyears+2])) ,Dis=round(c(discards(stf1)[,nyears+2]))

Catch + Dis seem to add up to the desired catch control, i.e. I want to set the catch control to the TAC of 206 tons, I get Discards 10 tons, total catch 196 tons, and Landings 185 tons (i.e. total catch- discards).

I try to attach the new stock object....
cod7a_forecast.zip

@pdolder
Copy link
Member

pdolder commented Jul 8, 2022 via email

@iagomosqueira
Copy link
Member

The catch target in FLash simply solves for the Fbar that will give that catch. Then the catch.n is split between landings.n and discards.n according to the status quo ratios set by stf().

There is a difference in landings.wt, discards.wt and catch.wt in the older ages and projection years that I think is making it fail in the splitting. catch.wt is 10.2470, while discards.wt and landings.wt are 10.3780. catch.wt is assumed to be a weighted mean of the other two, but that does not hold here. If I set landings.wt and discards.wt in 2023 to be the same as catch.wt, then the result is correct.

> catch(stf1)[,'2023']
An object of class "FLQuant"
, , unit = unique, season = all, area = unique

     year
age   2023
  all 206

units:  NA
> landings(stf1)[,'2023'] + discards(stf1)[,'2023']
An object of class "FLQuant"
, , unit = unique, season = all, area = unique

     year
age   2023
  all 206

units:  NA

Running the projection with FLasher returns the correct total catch but slightly different values for landings and discards. This is because the correction done in a slightly different way, but I will have to look carefully and compare,

If you get the weights set correctly, the results should be as expected.

@iagomosqueira
Copy link
Member

Forgot to add that this was pointed by the calls to compute*() that @pdolder mentioned. Those functions recompute the overal catch, landings and discards slots from the *.,n and *.wt ones.

> catch(stf1)[,'2022']
An object of class "FLQuant"
, , unit = unique, season = all, area = unique

     year
age   2022
  all 172.31

units:  NA
> computeCatch(stf1)[,'2022']
An object of class "FLQuant"
, , unit = unique, season = all, area = unique

     year
age   2022
  all 172.31

units:  NA
> computeCatch(stf1, 'all')$catch[,'2022']
An object of class "FLQuant"
, , unit = unique, season = all, area = unique

     year
age   2022
  all 165.61

units:  NA

> computeCatch(stf1, 'all')$catch.wt[,'2022']
An object of class "FLQuant"
, , unit = unique, season = all, area = unique

    year
age  2022
  0   0.10000
  1   0.28333
  2   1.75133
  3   4.02767
  4   5.95333
  5   7.76067
  6   8.59700
  7  10.37800
  8  10.37800
  9  10.37800
  10 10.37800

units:  NA

The last two commands, with the 'all' option, recalculate the three catch slots from landings and discards. As you can see, the weighted average catch.wt does not match what the stock has.

@piaschuchert
Copy link
Author

Hello,

thanks, I finally got it sorted...
There seems to be something tricky with the first stock object getting results and fitted estimates from the assessment model and then having to re-add the raw values for number at age and weights... The assessment model does not discriminate between landings and discards, the forecast does...

But now I got it finally sorted, thanks a lot!

Pia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants