Version: | 1.0.3 |
Date: | 2024-05-13 |
Title: | Simulate a Bus Route Creel Survey of Anglers |
Depends: | R (≥ 3.0.2) |
Imports: | stats, dplyr, ggplot2 |
Description: | Simulate an angler population, sample the simulated population with a user-specified survey times, and calculate metrics from a bus route-type creel survey. |
License: | GPL-3 |
URL: | https://github.com/stevenranney/AnglerCreelSurveySimulation |
BugReports: | https://github.com/stevenranney/AnglerCreelSurveySimulation/issues |
Suggests: | knitr, rmarkdown, testthat |
VignetteBuilder: | knitr |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
NeedsCompilation: | no |
Packaged: | 2024-05-13 21:15:29 UTC; sranney |
Author: | Ranney Steven H. |
Maintainer: | Ranney Steven H. <Steven.Ranney@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-05-14 07:33:39 UTC |
Calculate the Relative Standard Error of a numeric vector
Description
Calculates relative standard error of a vector of numbers.
Usage
calculate_rse(x)
Arguments
x |
The numeric vector of numbers from which relative standard error should be calculated. |
Details
Relative standard error is returned as a proportion. It is sometimes also referred to as "proportional standard error."
Relative standard error is the standard error divided by the mean:
Relative Standard Error = \frac{\frac{s}{\sqrt{n}}}{\bar{x}}
Value
This function returns a single value that is the relative standard error of a vector of numbers.
Author(s)
Steven H. Ranney
References
Malvestuto, S. P. 1996. Sampling the recreational creel. Pages 591-623 in B. R. Murphy and D. W. Willis, editors. Fisheries techniques, 2nd edition. American Fisheries Society, Bethesda, Maryland.
Examples
calculate_rse(rnorm(100, 10, 3))
Conduct multiple simulations of a survey
Description
This function uses make_anglers
and get_total_values
to conduct multiple bus-route or traditional access point creel surveys (from
the number provided to the n_sims
argument) of a population of anglers.
Usage
conduct_multiple_surveys(n_sims, ...)
Arguments
n_sims |
The number of simulations to be conducted in the simulation of interest. |
... |
Arguments to be passed to other subfunctions |
Details
Because this function is merely a wrapper for the simulate_bus_route
code, the user still needs to set start_time
, wait_time
,
n_anglers
, n_sites
, and sampling_prob
as objects. These
can be passed through the ...
argument or through setting wait_time
and others outside of the function call itself.
Value
Estimate catch (Ehat), the catch rate calculated by the ratio of means, the true, observed catch, and the actual catch rate (mean_lambda).
Author(s)
Steven H. Ranney
See Also
Examples
#Simulation 1
start_time <- c(1, 3.5, 6.5)
wait_time <- c(2, 2, 3)
n_anglers <- c(10,10,50)
n_sites <- 3
sampling_prob <- sum(wait_time)/12
mean_catch_rate <- 3
n_sims <- 10
set.seed(256)
conduct_multiple_surveys(n_sims = n_sims, start_time = start_time, wait_time = wait_time,
n_anglers = n_anglers, n_sites = n_sites,
sampling_prob = sampling_prob, mean_catch_rate = mean_catch_rate)
#Simulation 2
start_time <- 0
wait_time <- 8
n_anglers <- 100
n_sites <- 1
sampling_prob <- 8/10
mean_catch_rate <- 2.5
#One survey/week for a year
conduct_multiple_surveys(n_sims = 52, start_time, wait_time, n_anglers, n_sites, sampling_prob,
mean_catch_rate, fishing_day_length = 10)
Calculate within-day variance of estimated effort (Ehat)
Description
This function multiple outputs from simulate_bus_route
to estimate the variance in estimated effort, \widehat{E}
.
Usage
estimate_ehat_variance(data)
Arguments
data |
A dataframe of output from |
Details
The variance in \widehat{E}
is estimated from multiple simulated surveys
on a single theoretical day (Within-day variance of \widehat{E}
. The variance is estimated by
\frac{1}{n(n-1)}\sum(\widehat{T}_{ph}-\overline{\widehat{T}}_{ph})^2
where \widehat{T}_{ph}
is the total estimated party hours for an individual survey
(i.e., \widehat{E}
), and \overline{\widehat{T}}_{ph}
is the mean of the \widehat{E}
,
and n is how many simulations were run. The equation above matches the variables
used in Jones et al. (1990).
Jones et al. (1990) stated that estimating within-day variance would require several crews conducting two or more randomized surveys along a given route on the same day. They use this conservative estimator of variance for building confidence intervals around the estimates of effort.
Value
The variance in estimated effort, Ehat
(\widehat{E}
), from Robson
and Jones (1989) and Jones et al. (1990).
Author(s)
Steven H. Ranney
References
Jones, C. M., D. Robson, D. Otis, S. Gloss. 1990. Use of a computer model to determine the behavior of a new survey estimator of recreational angling. Transactions of the American Fisheries Society 119:41-54.
Robson, D., and C. M. Jones. 1989. The theoretical basis of an access site angler survey design. Biometrics 45:83-98.
Examples
#Set up a simulation to run repeatedly
## Not run:
start_time = c(0, 1.5)
wait_time = c(1, 6.5)
fishing_day_length <- 12
n_anglers = c(50, 300)
n_sites = 2
sampling_prob <- sum(wait_time)/fishing_day_length
mean_catch_rate <- 2.5
# Simulate the creel survey n times
times <- 100
sims <-
matrix(data = NA, nrow = times, ncol = 5) %>%
as.data.frame()
names(sims) = c("Ehat", "catch_rate_ROM", "true_catch", "true_effort", "mean_lambda")
for(i in 1:times){
sims[i, ] <- simulate_bus_route(start_time, wait_time, n_anglers, n_sites,
sampling_prob, mean_catch_rate)
}
estimate_ehat_variance(sims)
## End(Not run)
Conduct a creel survey of a population of anglers at an access site.
Description
This function uses the output from make_anglers
to conduct
a bus-route or traditional access point creel survey of the population of anglers
from make_anglers
and provide clerk-observed counts of anglers and their effort.
Usage
get_total_values(
data,
start_time = NULL,
end_time = NULL,
wait_time = NULL,
sampling_prob = 1,
mean_catch_rate = NULL,
scale = 1,
...
)
Arguments
data |
The dataframe returned from |
start_time |
The start time of the clerk. |
end_time |
the end time of the clerk. |
wait_time |
the wait time of the clerk. |
sampling_prob |
The sampling probability of the survey. The default is
|
mean_catch_rate |
The mean catch rate for the fishery. |
scale |
The scale parameter must be positive and is passed to the |
... |
Arguments to be passed to other functions. |
Details
Total effort is the sum of the trip lengths from data
The total number of anglers is equal to the nrow()
of the
dataframe in data
Catch rates are assigned to anglers based upon the Gamma distribution
with a mean of mean_catch_rate
If both end_time=NULL
and wait_time=NULL
then wait_time
will be 0.5 (one-half hour). If a value is passed to end_time
, then
wait_time
becomes end_time - start_time
.
If start_time=NULL
, then a start_time
is generated from the
uniform distribution between 0
and 11.5
hours into the fishing day.
If end_time=NULL
, then end_time = start_time+wait_time
Incomplete trip effort is observed two ways: 1) by counting anglers
that were at the site for the entire time that the surveyor was at the site
and 2) counting anglers that arrived after the surveyor arrived at the site
but remained at the site after the surveyor left. These anglers are counted
and their effort calculated based upon surveyor start_time
and end_time
.
Completed trip effort is observed two ways: 1) by interviewing anglers
that left while the surveyor was at the site. The surveyor can determine
effort and catch. 2) by interviewing anglers that both arrived and departed
while the surveyor was on site. When wait_time
is short, these cases are
are rare; however, when wait_time
is long (e.g., all day), then these
cases are much more likely.
Trip lengths of observed trips (both incomplete and complete) are
scaled by the sampling_prob
value. The sampling_prob
is used to estimate
effort and catch.
Author(s)
Steven H. Ranney
References
Pollock, K. H., C. M. Jones, and T. L. Brown. 1994. Angler survey methods and their applications in fisheries management. American Fisheries Society, Special Publication 25, Bethesda, Maryland.
Examples
library(dplyr)
set.seed(256)
start_time = .001 #start of fishing day
end_time = 12 #end of fishing day
mean_catch_rate = 0.1 #this will cause VERY few fish to be caught!
make_anglers(100) %>%
get_total_values(start_time = start_time,
end_time = end_time, mean_catch_rate = mean_catch_rate)
start_time = .001 #start of fishing day
end_time = 6 #halfway through the fishing day
sampling_prob = .5 #this needs to be .5 because we are sampling only 50% of the fishing day
mean_catch_rate = 0.1 #this will cause VERY few fish to be caught!
make_anglers(100) %>%
get_total_values(start_time = start_time, end_time = end_time,
sampling_prob = sampling_prob, mean_catch_rate = mean_catch_rate)
Create a population of anglers.
Description
Creates a population of n_anglers
with trip length and fishing day length provided by the user.
Usage
make_anglers(
n_anglers = 100,
mean_trip_length = 3.88,
fishing_day_length = 12,
scale = 1
)
Arguments
n_anglers |
The number of anglers in the population |
mean_trip_length |
The mean trip length to be used in the function. |
fishing_day_length |
The fishing day length to be used in the function. Anglers are not be allowed to be fishing past this day length. The default here is set to 12 hours, which may not be a suitable day length for fisheries at higher latitudes (i.e., sunrise-sunset is > 12 hours) or during shorter seasons. |
scale |
The scale parameter must be positive and is passed to the |
Details
All trip lengths will be limited so that anglers have finished their
fishing trip by the end of the fishing day. The function uses a while
loop to ensure that the number of anglers = n_anglers
provided in the
function argument. fishing_day_length
is passed to the argument. The
default is set to 12 hours.
starttimes
are assigned by the uniform (runif
) distribution
triplengths
are assigned by the gamma distribution where the
default mean value comes from the 2008 Lake Roosevelt Fisheries Evaluation Program data.
Value
A data frame called that includes variables start_time
, trip_length
,
and departure_time
. Summing the trip_length
field returns the true
fishing effort.
Author(s)
Steven H. Ranney
Examples
make_anglers(100, mean_trip_length = 4, fishing_day_length = 10)
#make_anglers(10000)
Simulate a bus route survey
Description
This function uses the output from make_anglers
and
get_total_values
to conduct a bus-route or traditional access point
creel survey of the population of anglers from make_anglers
and
provide clerk-observed counts of anglers and their effort.
Usage
simulate_bus_route(
start_time,
wait_time,
n_anglers,
n_sites,
sampling_prob = 1,
mean_catch_rate,
...
)
Arguments
start_time |
The start time of the surveyor at each site. This can be a
vector of start times to simulate a bus route or one |
wait_time |
The wait time of the surveyor at each site. This can be a
vector of wait times to simulate a bus route or one |
n_anglers |
the number of anglers at each site, either a vector or a single number for single sites |
n_sites |
The number of sites being visited. |
sampling_prob |
What is the sampling probability for the survey? If all
sites will be visited during the first or second half of the fishing day,
|
mean_catch_rate |
The mean catch rate for the fishery |
... |
Arguments to be passed to other subfunctions, specifically to the
|
Details
Effort and catch are estimated from the the Bus Route Estimator equation in Robson and Jones (1989), Jones and Robson (1991; eqn. 1) and Pollock et al. 1994.
The bus route estimator is
\widehat{E} = T\sum\limits_{i=1}^n{\frac{1}{w_{i}}}\sum\limits_{j=1}^m{\frac{e_{ij}}{\pi_{j}}}
where E = estimated total party-hours of effort; T = total time
to complete a full circuit of the route, including traveling and waiting;
w_i
= waiting time at the i^{th}
site
(where i = 1, ..., n sites); e_{ij}
=
total time that the j^{th}
car is parked at the i^{th}
site while the agent is at that site (where j = 1, ..., n sites).
Catch rate is calculated from the Ratio of Means equation (see Malvestuto (1996) and Jones and Pollock (2012) for discussions).
The Ratio of means is calculated by
\widehat{R_1} = \frac{\sum\limits_{i=1}^n{c_i/n}}{\sum\limits_{i=1}^n{L_i/n}}
where c_i
is the catch for the i^{th}
sampling unit
and L_i
is the length of the fishing trip at the time of the
interview. For incomplete surveys, L_i
represents in incomplete
trip.
Value
Estimated effort (Ehat
) from the bus route estimator, the catch rate
calculated by the ratio of means, the total catch from all anglers, the total effort
from all anglers, and the actual catch rate (mean_lambda).
Author(s)
Steven H. Ranney
References
Jones, C. M., and D. Robson. 1991. Improving precision in angler surveys: traditional access design versus bus route design. American Fisheries Society Symposium 12:177-188.
Jones, C. M., and K. H. Pollock. 2012. Recreational survey methods: estimation of effort, harvest, and released catch. Pages 883-919 in A. V. Zale, D. L. Parrish, and T. M. Sutton, editors. Fisheries Techniques, 3rd edition. American Fisheries Society, Bethesda, Maryland.
Malvestuto, S. P. 1996. Sampling the recreational creel. Pages 591-623 in B. R. Murphy and D. W. Willis, editors. Fisheries techniques, 2nd edition. American Fisheries Society, Bethesda, Maryland.
Pollock, K. H., C. M. Jones, and T. L. Brown. 1994. Angler survey methods and their applications in fisheries management. American Fisheries Society, Special Publication 25, Bethesda, Maryland.
Robson, D., and C. M. Jones. 1989. The theoretical basis of an access site angler survey design. Biometrics 45:83-98.
See Also
Examples
# To simulate one bus route survey that takes place in the morning, these values are used
#start time at access sites
startTimeAM <- c(1, 2,3,4,5)
#wait time at access sites
waitTimeAM <- c(.5, .5, .5, .5, 2)
#the number of anglers that will visit access site throughout the day
nanglersAM <- c(10,10,10,10,50)
# the number of sites to be visited
nsitesAM <- 5
# the sampling probability. Here it is .5 because we are only conducting this
# survey during the first 50% of the fishing day
sampling_prob <- .5
# the mean catch rate. Here it is 2.5 which equals 2.5 fish/hour
mean_catch_rate <- 2.5
simulate_bus_route(start_time = startTimeAM, wait_time = waitTimeAM, n_anglers = nanglersAM,
n_sites = nsitesAM, sampling_prob = sampling_prob, mean_catch_rate = mean_catch_rate)
# To simulate one traditional access point survey where the creel clerk arrives,
# counts anglers, and interviews anglers that have completed their trips
start_time = 0.001
wait_time = 8
#nanglers can be informed by previously-collected data
n_anglers = 1000
n_sites = 1
# sampling probability here is 8/12 because we are staying at the access site
# for 8 hours of a 12-hour fishing day. To adjust the fishing day length, an
# additional 'fishing_day_length' argument needs to be passed to this function.
sampling_prob <- (8/12)
# the mean catch rate.
mean_catch_rate <- 5
simulate_bus_route(start_time, wait_time, n_anglers, n_sites, sampling_prob, mean_catch_rate)