Get Plot of Negative Log Likelihood Values
get_nLL_plot.RdExtracts, weights, and visualises all negative log-likelihood (nLL) components from one or more SPoRC model runs. Likelihood weights stored in the data list are applied to the relevant components (catch, indices, recruitment, tagging, fishing mortality) before plotting, so reported values reflect the actual contribution of each component to the joint nLL. Components with a value of zero are silently excluded from both the plot and table.
Arguments
- data
List of length
n_models, where each element is a SPoRC data list. Likelihood weights are extracted fromWt_Catch,Wt_F,Wt_Rec,Wt_Tagging,Wt_SrvIdx, andWt_FishIdx.- rep
List of length
n_models, where each element is a SPoRC report list (i.e. the output ofobj$report()after optimisation). The following nLL components are extracted:jnLL,h_nLL,M_nLL,rec_region_prop_nLL,Rec_nLL,Init_Rec_nLL,sel_nLL,conv_fish_tag_nLL,Catch_nLL,Fmort_nLL,srv_q_nLL,fish_q_nLL,SrvIdx_nLL,FishIdx_nLL,TagRep_nLL,Movement_nLL,SrvAgeComps_nLL,FishAgeComps_nLL,SrvLenComps_nLL,FishLenComps_nLL, and the population-specific counterpartsCatch_pop_nLL,FishIdx_pop_nLL,SrvIdx_pop_nLL,FishAgeComps_pop_nLL,FishLenComps_pop_nLL,SrvAgeComps_pop_nLL,SrvLenComps_pop_nLL. Missing components are handled viasafe_extract.- model_names
Character vector of length
n_modelsgiving display names for each model run. Used as facet labels on the bar chart.
Value
A list of two objects:
- [[1]] nLL_plot
A stacked bar chart (
ggplot) with one facet per model. Bars show the weighted nLL contribution of each component, coloured by component type (Prior, Penalty, Catch, Index, Age, Length, Tagging, jnLL). Components with value 0 are excluded.- [[2]] table_plot
A
ggdrawtable (viagridExtraandcowplot) showing weighted nLL values in wide format, with one column per non-zero component and one row per model.