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

report sparsedist #35

Open
vbartolino opened this issue Nov 7, 2024 · 4 comments
Open

report sparsedist #35

vbartolino opened this issue Nov 7, 2024 · 4 comments

Comments

@vbartolino
Copy link

I do not entirely understand the output from fit$sparsedist
The scale in model_n is different from what I would expect based on obs_mean
Am I thinking wrong?

> fit$sparsedist[1:5,] %>% data.frame()
  year step area data_type function_f component age length obs_mean obs_stddev
1 2008    2 <NA>   asparse     linreg   bt2.rin   4  117.0      1.5         NA
2 2008    2 <NA>   asparse     linreg   bt2.rin  12  121.5      1.5         NA
3 2008    2 <NA>   asparse     linreg   bt2.rin  13  126.5      2.3         NA
4 2008    2 <NA>   asparse     linreg   bt2.rin   5  131.0      1.8         NA
5 2008    2 <NA>   asparse     linreg   bt2.rin   7  131.0      2.0         NA
  obs_n model_sum model_sqsum  model_n
1    NA 177.98198    411.0834 77.05877
2    NA  68.27062    168.8585 27.60227
3    NA  60.21206    148.9279 24.34395
4    NA 104.69718    192.3725 56.98058
5    NA 119.86707    268.4067 53.53113
@lentinj
Copy link
Collaborator

lentinj commented Nov 7, 2024

If a fleet/predator isn't provided (which I don't think you do), then model_n should be the sum of abundance for that year/step/age/length. If fleet/predators are provided, then its the indivduals caught for that year/step/age/length.

There's a missing column, model_mean = model_sum / model_n, that should be comparable to obs_mean. Generating this in g3_fit seems a fairly simple addition.

@willbutler42
Copy link
Collaborator

Hi, fyi, I have added the model_mean column to the output: 59fd1cb.

@lentinj
Copy link
Collaborator

lentinj commented Nov 9, 2024

@willbutler42 thanks!

@vbartolino
Copy link
Author

I noticed a minor issues with this report when I include two distinct sparsedist likelihood components, in my case
(1) individual BT 72 observations (bt1.rin to capture seasonality)
(2) a time series of 24 annual BT (bt2.rin to capture long term trends)

The problem appears when (1) has a name which makes it listed after (2) in fit$sparsedist.

Here the result

individual data bt1.rin and time series bt2.rin OK

> fit$sparsedist %>% filter(component == "bt1.rin") %>% select(year,step,age,obs_mean,model_mean) %>% head(25) %>% data.frame()
   year step age obs_mean model_mean
1  2008    2   4      1.5   1.868525
2  2008    2  12      1.5   2.015113
3  2008    2  13      2.3   2.015124
4  2008    2   5      1.8   1.583205
5  2008    2   7      2.0   1.870232
6  2008    2   6      1.4   1.778922
7  2008    4   8      5.3   4.595219
8  2008    4  17      5.0   4.523513
9  2008    4   7      6.5   4.456400
10 2008    4  11      5.4   4.431778
11 2009    4  12      6.5   4.619059
12 2011    4  23      6.7   4.777515
13 2011    2   3      6.0   2.710815
14 2012    3   6      4.0   3.256975
15 2012    2   8      1.8   2.146811
16 2013    3   3      4.0   3.840378
17 2013    2  20      1.3   2.126861
18 2013    3  11      2.6   3.527726
19 2014    2  11      2.5   2.237870
20 2015    2  13      2.5   2.257318
21 2015    3   6      4.9   3.428736
22 2015    4   3      4.8   4.736945
23 2015    4   3      5.4   4.792316
24 2015    3   9      5.0   3.758631
25 2015    4  11      5.4   5.194392

individual data bt2.rin and time series bt1.rin (the output gets odd)

> fit3$sparsedist %>% filter(component == "bt2.rin") %>% select(year,step,age,obs_mean,model_mean) %>% head(25) %>% data.frame()
   year step age obs_mean model_mean
1    NA    2   4       NA         NA
2    NA    2  12       NA         NA
3    NA    2  13       NA         NA
4    NA    2   5       NA         NA
5    NA    2   7       NA         NA
6    NA    2   6       NA         NA
7    NA    4   8       NA         NA
8    NA    4  17       NA         NA
9    NA    4   7       NA         NA
10   NA    4  11       NA         NA
11   NA    4  12       NA         NA
12   NA    4  23       NA         NA
13   NA    2   3       NA         NA
14   NA    3   6       NA         NA
15   NA    2   8       NA         NA
16   NA    3   3       NA         NA
17   NA    2  20       NA         NA
18   NA    3  11       NA         NA
19 2008    2  11      1.5   2.276591
20 2008    2  13      1.5   2.213743
21 2008    3   6      2.3   2.213783
22 2008    4   3      1.8   1.478098
23 2008    4   3      2.0   1.884802
24 2008    3   9      1.4   1.843897
25 2008    4  11      5.3   4.535867

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

3 participants