-
Notifications
You must be signed in to change notification settings - Fork 3
/
ui.R
218 lines (212 loc) · 14.1 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
library(shiny)
library(shinyBS)
#shinyUI(
fluidPage(
titlePanel("The Natural Mortality Tool: Empirical Estimators of Natural Mortality (M)"),
h5(p(em("This tool employs various empirical estimators of natural mortality."))),
h5(p(em("As the user enters values for the below input parameters, estimates will be displayed in the main panel."))),
h5(p(em("Uncertainty can also be added to the estimates by chosing a coefficient of variation (CV) value and error distribution type."))),
h5(p(em("Downloaded R objects (.DMP) can be loaded directly into R or, if using the R terminal, drag and drop in."))),
br(),
h4(p("Do you have any suggested methods to add? Please submit an issue with the recommendation" ,tags$a(href="https://github.com/shcaba/Natural-Mortality-Tool/issues", "here"))),
h4(p("References for each included method can be found",tags$a(href="javascript:window.open('References_M.html', '_blank','width=600,height=400')", "here"))),
h4(p("Please cite this tool as", em("Cope, JM and Hamel, OS. 2022. Upgrading from M version 0.2: An application-based method for practical estimation, evaluation and uncertainty characterization of natural mortality. Fisheries Research 256",tags$a(href="https://doi.org/10.1016/j.fishres.2022.106493", "https://doi.org/10.1016/j.fishres.2022.106493")))),
sidebarLayout(
sidebarPanel(
conditionalPanel(
condition="input.conditionedPanels==1",
h3("Parameters inputs"),
h5(p(em("Provide a value for the CV and choose an error type to add additional uncertainty to the point estimates. The CV will be applied to all methods."))),
h5(p(em("CV = 0 means only point estimates will be reported"))),
fluidRow(column(width=6,numericInput("M_CV", "CV in M", value=0,min=0, max=10, step=0.1)),
column(width=6,selectInput("M_CV_type","Error type",c("lognormal","normal")))),
h5(p(em("Provide inputs below. You do not need values for all inputs; natural mortality will only be estimated for a given methods when all input requirements are met."))),
h5(p(em("Scientific name calls the FishLife M estimator"))),
h5(p(em("Input requirements for other methods can be found",tags$a(href="javascript:window.open('Method_inputs.html', '_blank','width=600,height=400')", "here")))),
textInput("Genspp","Scientific name",value=""),
fluidRow(column(width=6,numericInput("Amax", "Longevity (yrs):", value=NA,min=0.1, max=300, step=0.1)),
column(width=6,numericInput("Linf","VBGF Linf (in cm):", value=NA,min=1, max=10000, step=0.01))),
fluidRow(column(6,numericInput("k_vbgf", "VBGF k:", value=NA,min = 0.001, max = 1,step=0.01)),
column(width=6,numericInput("t0", "VBGF t0", value=NA,min = -15, max = 15,step=0.01))),
fluidRow(column(width=6,numericInput("Age_in","Age (yr) specified for Chen-Wat:", value=NA,min=0.1, max=300, step=0.01)),
column(width=6,numericInput("Lt_in", "Length (cm) specified for Gislason", value=NA,min = 0, max = 10000,step=0.01))),
bsTooltip("Age_in", "Enter an age to get the age-specific estimate of M from the Chen and Watanabe 1989 method. See the age-specific estimates of M to get all ages.",
"right", options = list(container = "body")),
bsTooltip("Lt_in", "Enter an length (in cm) to get the length-specific estimate of M from the Gislason et al. 2010 method. See the age-specific estimates of M to get the length-coverted age-specific estimates from this method.",
"right", options = list(container = "body")),
fluidRow(column(6,numericInput("Amat","Age at 50% maturity (yrs)", value=NA,min = 0.01, max = 100,step=0.01)),
column(width=6,numericInput("Temp","Water temp. (in C):" , value=NA,min = 0.001, max = 60,step=0.01))),
fluidRow(column(6,numericInput("Winf","VBGF Winf (in g):", value=NA,min = 0, max = 100000,step=0.1)),
column(width=6,numericInput("kw","VBGF kw: ", value=NA,min = 0.001, max = 5,step=0.01))),
bsTooltip("Winf", "Winf is the asymptotic weight used in the weight-based version of the von Bertalanffy equation used in Pauly 1980.",
"right", options = list(container = "body")),
bsTooltip("kw", "kw is the growth coefficient of weight-based version of the von Bertalanffy equation used in Pauly 1980.",
"right", options = list(container = "body")),
fluidRow(column(6,numericInput("Wdry","Total dry weight (in g):" ,value=NA,min = 0.01, max = 1000000,step=0.01)),
column(width=6,numericInput("Wwet","Total wet weight (in g):" ,value=NA,min = 0.01, max = 1000000,step=0.01))),
bsTooltip("Wdry", "An estimate of M is provided for the specific dry weight provided.",
"right", options = list(container = "body")),
bsTooltip("Wwet", "An estimate of M is provided for the specific wet weight provided",
"right", options = list(container = "body")),
fluidRow(column(width=6,numericInput("GSI","Gonadosomatic index (GSI):",value=NA,min = 0, max = 1,step=0.001)),
column(width=6,textInput("User_M","User M input:",value=""))),
bsTooltip("GSI", "The GSI is calculated as gonad weight/total body weight.",
"right", options = list(container = "body")),
bsTooltip("User_M", "Examples of user input are values used in past analyses (e.g., from stock assessments) or other sources. You can add as many as you want, just separate the entries by commas.",
"right", options = list(container = "body")),
),
conditionalPanel(
condition="input.conditionedPanels==2",
h3("Composite M: method weighting"),
h5(p(em("Allows for weighting of the contribution of each method in the composite M distribution"))),
h5("Values range from 0 to 1. A value of 0 removes the contribution; a value of 1 is full weighting."),
h5("Default values are based on redundancies of methods using similar information. For instance, of the three longevity-based methods, two given a weight of 0.25 and one a weight of 0.5, so all weighted together equal 1."),
h5("The prior sample number generates a prior based on the number of specified samples. This value also defines the binwidth in the density plot, thus lower sample numbers will give a more diffuse prior."),
wellPanel(
fluidRow(
column(6,numericInput("FishLife","FishLife",value=1,min = 0, max = 1,step=0.001))
),
# h5("Uses longevity")
fluidRow(
column(6,numericInput("Then_nls","Then_nls",value=0.25,min = 0, max = 1,step=0.001)),
column(6,numericInput("Then_lm","Then_lm",value=0.25,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("Hamel_Amax","Hamel_Amax",value=0.5,min = 0, max = 1,step=0.001)),
column(6,numericInput("Chen_Wat","Chen-Wat",value=0.333,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("ZM_AC_pel","ZM_AC_pel",value=0,min = 0, max = 1,step=0.001)),
column(6,numericInput("ZM_AC_dem","ZM_AC_dem",value=0,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("Then_VBGF","Then_VBGF",value=0.25,min = 0, max = 1,step=0.001)),
column(6,numericInput("Hamel_VBGF","Hamel_k",value=0.5,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("Jensen_VBGF_1","Jensen_k 1",value=0.25,min = 0, max = 1,step=0.001)),
column(6,numericInput("Jensen_VBGF_2","Jensen_k 2",value=0.0,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("Gislason","Gislason",value=0.333,min = 0, max = 1,step=0.001)),
column(6,numericInput("Charnov","Charnov",value=0.333,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("Pauly_lt","Pauly_lt",value=0.5,min = 0, max = 1,step=0.001)),
column(6,numericInput("Roff","Roff",value=0.5,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("Jensen_Amat","Jensen_Amat",value=0.5,min = 0, max = 1,step=0.001)),
column(6,numericInput("Ri_Ef_Amat","Ri_Ef_Amat",value=0.5,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("Pauly_wt","Pauly_wt",value=0.5,min = 0, max = 1,step=0.001)),
column(6,numericInput("McGl","McC&Gil",value=0.5,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("PnW","PnW",value=0.5,min = 0, max = 1,step=0.001)),
column(6,numericInput("Lorenzen","Lorenzen",value=1,min = 0, max = 1,step=0.001))
),
fluidRow(
column(6,numericInput("Gonosoma","GSI",value=1,min = 0, max = 1,step=0.001)),
column(6,numericInput("UserM_wt","User M",value=1,min = 0, max = 1,step=0.001))
),
h5(p(em("M prior control parameters"))),
fluidRow(
column(6,numericInput("samp.num","Prior sample #",value=1000000,min = 0, max = 10000000,step=1)),
column(6,numericInput("ad.bw","Bandwidth multiplier",value=1,min = 0.0001, max = 100,step=0.01))),
h4(p("Composite M prior downloads")),
h5(p(em("Downloads are DMP files that can be loaded directly into R"))),
h5(p(em("Higher sample sizes create a composite distribution truer to the component distributions"))),
h5(p(em("Adjusting bandwidth >1 creates a more diffuse composite distribution"))),
fluidRow(
column(6,downloadButton('downloadMcompositedist', 'Based on sample-sized')),
column(6,downloadButton('downloadMcompositedistupdated', 'Bandwidth-adjusted')))
)
),
conditionalPanel(
h3("Composite M: inverse variance weighting"),
h5("This approach (Hamel 2015; Hamel and Cope 2022) uses the variance of each method to weight the composite prior of M"),
condition="input.conditionedPanels==3",wellPanel(uiOutput("Mchoicelist"),
actionButton("selectall","Select All"),
br(),
br(),
actionButton("run_HCprior","Run composite",icon("circle-play"),style="font-size:110%;border:2px solid;background:#ffffcc"),
br(),
br(),
downloadButton('downloadHCpior', 'Download M prior object'),
h5(em("The downloaded object has summary statistics for the composite M distribution."))
)
)
),
#end sidebar
mainPanel(
tabsetPanel(
tabPanel("M by method",
h4("Natural mortality (M) estimates by method"),
h5("Legend color indicate inputs used by each method."),
h5("Downloadable R object contains paramter inputs, estimted M point estimates, and age-specific M values."),
plotOutput("Mplot"),
h4("Natural mortality (M) point estimates"),
fluidRow(
column(4,tableOutput("Mtable")),
column(4,tableOutput("Mtable2")),
column(4,tableOutput("MtableUser")),
),
downloadButton('downloadMplots', 'Download M values plot'),
downloadButton('downloadMs', 'Download M table csv file'),
downloadButton('downloadMandPs', 'Download parameter inputs and M values R object'),
br(),
br(),
br(),
h4("Natural mortality (M) by age"),
plotOutput("Mplot_ages"),
downloadButton('downloadMplot_ages', 'Download M at age plot'),
downloadButton('downloadCW_M_a', 'Download age-specific M values csv file'),
value=1
),
tabPanel("Composite M: User weighted",
h4("Method density and weights"),
h5("When no uncertainty is expressed, point estimates with weights are shown"),
h5("When uncertainty is expressed, the distribution of each method is given, with its frequency (determined by the weighting) plotted on the y-axis"),
plotOutput("Mdistplots"),
downloadButton('downloadMdensityplots', 'Download M density plot'),
downloadButton('downloadMdistvals', 'Download M density inputs as R object'),
br(),
br(),
br(),
h4("Composite natural mortality"),
h5(p(em("Blue vertical line indicates median value"))),
h5(p(em("First composite M object is based on the number of specified samples"))),
h5(p(em("Second composite M object is based on th adjusted bandwidth"))),
plotOutput("Mcomposite"),
downloadButton('downloadMcompositedensityplot', 'Download composite M density plot'),
# downloadButton('downloadMcompositedist', 'Download composite M as R object'),
# downloadButton('downloadMcompositedistupdated', 'Download bandwidth-adjusted composite M as R object'),
value=2
),
tabPanel("Composite M: Inverse variance",
h4("Hamel and Cope (2022) inverse weighting method"),
h5("This approach uses the variance of each method to weight the composite prior of M"),
tableOutput("HC_Mtable"),
# plotOutput("Mdistplots"),
# downloadButton('downloadMdensityplots', 'Download M density plot'),
# downloadButton('downloadMdistvals', 'Download M density inputs as R object'),
# br(),
# br(),
# br(),
# h4("Composite natural mortality"),
# h5(p(em("Blue vertical line indicates median value"))),
# h5(p(em("First composite M object is based on the number of specified samples"))),
# h5(p(em("Second composite M object is based on th adjusted bandwidth"))),
# plotOutput("Mcomposite"),
# downloadButton('downloadMcompositedensityplot', 'Download composite M density plot'),
# # downloadButton('downloadMcompositedist', 'Download composite M as R object'),
# # downloadButton('downloadMcompositedistupdated', 'Download bandwidth-adjusted composite M as R object'),
value=3
),
id="conditionedPanels"
)
)
)
)