Extend a FLR object along the year dimension and set future assumed values
Source:R/genericMethods.R
, R/FLStock.R
fwdWindow.Rd
Objects to be projected into the future are extended until an end year, and the values of certain quantities, usually assume constant, are set following different mechanisms.
Examples
data(ple4)
# Use mean of last three years and extend until 2020
fut <- fwdWindow(ple4, end=2020)
# Check values on catch.wt
catch.wt(fut)[, ac(2015:2020)]
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 2015 2016 2017 2018 2019 2020
#> 1 0.026000 0.048000 0.051034 0.041678 0.041678 0.041678
#> 2 0.080271 0.083793 0.085895 0.083320 0.083320 0.083320
#> 3 0.161845 0.157402 0.158552 0.159266 0.159266 0.159266
#> 4 0.257901 0.243039 0.218409 0.239783 0.239783 0.239783
#> 5 0.325621 0.298878 0.314393 0.312964 0.312964 0.312964
#> 6 0.393707 0.352469 0.386271 0.377482 0.377482 0.377482
#> 7 0.461250 0.422309 0.437717 0.440425 0.440425 0.440425
#> 8 0.480815 0.465186 0.531501 0.492501 0.492501 0.492501
#> 9 0.581978 0.555971 0.641979 0.593309 0.593309 0.593309
#> 10 0.599938 0.683933 0.734886 0.672919 0.672919 0.672919
#>
#> units: kg
# Use mean of the 2010:2015 period
fut <- fwdWindow(ple4, end=2020, years=2010:2015)
# Use last three years mean, but last five for 'wt'
fut <- fwdWindow(ple4, end=2020, nsq=3, years=list(wt=5))
stock.wt(fut)[, ac(2013:2020)]
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 2013 2014 2015 2016 2017 2018 2019 2020
#> 1 0.0430 0.0480 0.0240 0.0300 0.0320 0.0354 0.0354 0.0354
#> 2 0.1070 0.1040 0.0650 0.0660 0.0690 0.0822 0.0822 0.0822
#> 3 0.1530 0.1580 0.1200 0.1170 0.1320 0.1360 0.1360 0.1360
#> 4 0.2080 0.2020 0.2070 0.1980 0.1810 0.1992 0.1992 0.1992
#> 5 0.3200 0.3120 0.2790 0.2600 0.2700 0.2882 0.2882 0.2882
#> 6 0.3540 0.3800 0.3230 0.3290 0.3330 0.3438 0.3438 0.3438
#> 7 0.4340 0.4390 0.3790 0.3800 0.3590 0.3982 0.3982 0.3982
#> 8 0.4930 0.4840 0.4350 0.4340 0.4580 0.4608 0.4608 0.4608
#> 9 0.6620 0.4580 0.4650 0.4790 0.4760 0.5080 0.5080 0.5080
#> 10 0.4680 0.6150 0.4570 0.5140 0.5570 0.5222 0.5222 0.5222
#>
#> units: kg
catch.sel(fut)[, ac(2013:2020)]
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 2013 2014 2015 2016 2017 2018 2019 2020
#> 1 0.371582 0.574650 0.674177 0.485580 0.268807 0.472493 0.472493 0.472493
#> 2 0.727648 0.817662 0.848662 0.775415 0.659347 0.759736 0.759736 0.759736
#> 3 1.000000 1.000000 0.997872 1.000000 1.000000 1.000000 1.000000 1.000000
#> 4 0.921248 0.974274 1.000000 0.966840 0.901408 0.955721 0.955721 0.955721
#> 5 0.770034 0.777282 0.780296 0.775554 0.763304 0.773407 0.773407 0.773407
#> 6 0.553585 0.547440 0.546097 0.556122 0.570028 0.558043 0.558043 0.558043
#> 7 0.317959 0.360592 0.384355 0.363367 0.320835 0.355771 0.355771 0.355771
#> 8 0.187146 0.217980 0.230463 0.203954 0.163486 0.198758 0.198758 0.198758
#> 9 0.121437 0.123710 0.117807 0.101872 0.083357 0.100739 0.100739 0.100739
#> 10 0.121437 0.123710 0.117807 0.101872 0.083357 0.100739 0.100739 0.100739
#>
#> units: NA
# Resample from last years for 'wt'
fut <- fwdWindow(ple4, end=2020, nsq=3, fun=c(wt='sample'))
# Years to resample can be different for 'catch.sel'
fut <- fwdWindow(ple4, end=2020, nsq=3,
fun=c(wt='sample', catch.sel='sample'), years=c(wt=10, catch.sel=5))
# 'wt' slot has been resampled,
stock.wt(fut)[, ac(2015:2020)]
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 2015 2016 2017 2018 2019 2020
#> 1 0.024 0.030 0.032 0.024 0.053 0.053
#> 2 0.065 0.066 0.069 0.065 0.116 0.116
#> 3 0.120 0.117 0.132 0.120 0.179 0.179
#> 4 0.207 0.198 0.181 0.207 0.340 0.340
#> 5 0.279 0.260 0.270 0.279 0.361 0.361
#> 6 0.323 0.329 0.333 0.323 0.401 0.401
#> 7 0.379 0.380 0.359 0.379 0.448 0.448
#> 8 0.435 0.434 0.458 0.435 0.572 0.572
#> 9 0.465 0.479 0.476 0.465 0.568 0.568
#> 10 0.457 0.514 0.557 0.457 0.655 0.655
#>
#> units: kg
# while others have used a 3 year average
catch.sel(fut)[, ac(2015:2020)]
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 2015 2016 2017 2018 2019 2020
#> 1 0.674177 0.485580 0.268807 0.674177 0.574650 0.371582
#> 2 0.848662 0.775415 0.659347 0.848662 0.817662 0.727648
#> 3 0.997872 1.000000 1.000000 0.997872 1.000000 1.000000
#> 4 1.000000 0.966840 0.901408 1.000000 0.974274 0.921248
#> 5 0.780296 0.775554 0.763304 0.780296 0.777282 0.770034
#> 6 0.546097 0.556122 0.570028 0.546097 0.547440 0.553585
#> 7 0.384355 0.363367 0.320835 0.384355 0.360592 0.317959
#> 8 0.230463 0.203954 0.163486 0.230463 0.217980 0.187146
#> 9 0.117807 0.101872 0.083357 0.117807 0.123710 0.121437
#> 10 0.117807 0.101872 0.083357 0.117807 0.123710 0.121437
#>
#> units: NA