r4ss / r4ss

files for r4ss package
https://r4ss.github.io/r4ss/
38 stars 35 forks source link

add note to caption for figures representing data excluded from the likelihood (lambda = 0) #510

Open iantaylor-NOAA opened 3 years ago

iantaylor-NOAA commented 3 years ago

It's useful to see fits to data that aren't included in the likelihood, but it's not clear from the plots which might have lambda = 0. It should be straightforward to use the tables of likelihoods returned by SS_output() to add a note like "[Excluded from likelihood]" at the beginning of the caption, where it would be noticeable.

Please comment if you have any suggestions or concerns about this proposal.

kellijohnson-NOAA commented 3 years ago

Is there a line type or some way on the figure that we could delineate between fitted and solely observational data? Then, if any observational only data are present we could include a sentence in the figure caption using paste(..., ifelse()) or something like that.

iantaylor-NOAA commented 3 years ago

@kellijohnson-NOAA good point about observational data. Unfortunately treatment of solely observational data entered in the model with negative fleet number is complex and also treated differently for each data type.

For compositional data, separate plots with "Ghost" in the caption are created. This originated with the practice of fitting conditional age-at-length data and while providing the corresponding marginal age comps which were excluded from the likelihood to see the implied fit. For index observations, models like Pacific Hake sometime include dummy observations for years with no index in order to produce an expected value for all years. In that case, you wouldn't want the dummy observation shown on the plot, even with a different plot character or line type. But it would be nice to have the option to see real observations that got excluded. I just looked at the SSplotDiscard() function and it appears that there's no accounting for excluded observations (which have model$discard$Use == 0).

Your question reminds me that for the 2013 Shortspine Thornyhead assessment, I hacked together the figure below to designate data excluded from the model by plotting observations from a model with all data included and added a shaded box on top of it to show the years excluded from the final model. It would be great to have an option to do this automatically and also show the implied fit to those data on the same figure as the data which are included in the model. However, I don't see being able to work on something like that until months from now.

In contrast, when all observations of a data are excluded via lambda = 0, the change in caption should be really easy.

image