Title: | Simulate a Bus Route Creel Survey of Anglers |
---|---|
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. |
Authors: | Ranney Steven H. [aut, cre] |
Maintainer: | Ranney Steven H. <[email protected]> |
License: | GPL-3 |
Version: | 1.0.5 |
Built: | 2025-03-01 05:07:20 UTC |
Source: | https://github.com/stevenranney/anglercreelsurveysimulation |
Calculates relative standard error of a vector of numbers.
calculate_rse(x)
calculate_rse(x)
x |
The numeric vector of numbers from which relative standard error should be calculated. |
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:
This function returns a single value that is the relative standard error of a vector of numbers.
Steven H. Ranney
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.
calculate_rse(rnorm(100, 10, 3))
calculate_rse(rnorm(100, 10, 3))
This is a helper function used in get_total_value
to check that
surveyor for start_time
, wait_time
, end_time
,
and fishing_day_length
are valid.
check_times( start_time = NULL, wait_time = NULL, end_time = NULL, fishing_day_length = NULL )
check_times( start_time = NULL, wait_time = NULL, end_time = NULL, fishing_day_length = NULL )
start_time |
The start time of the clerk. An |
wait_time |
the wait time of the clerk. The default is |
end_time |
the end time of the clerk. An |
fishing_day_length |
the total length of the fishing day, in hours, as |
Two of the three start_time
, wait_time
, or end_time
must be
provided. The third will be calculated.
Steven H. Ranney
library(dplyr) set.seed(256) start_time <- NULL end_time <- NULL wait_time <- NULL # Will return error ## Not run: check_times(start_time = start_time, end_time = end_time, wait_time = wait_time, fishing_day_length = 12) ## End(Not run) start_time <- 2 end_time <- NULL wait_time <- NULL # Will return an error ## Not run: check_times(start_time = start_time, end_time = end_time, wait_time = wait_time, fishing_day_length = 8) ## End(Not run) start_time <- 2 end_time <- 6 wait_time <- NULL fishing_day_length <- 8 check_times(start_time = start_time, end_time = end_time, wait_time = wait_time, fishing_day_length = 8)
library(dplyr) set.seed(256) start_time <- NULL end_time <- NULL wait_time <- NULL # Will return error ## Not run: check_times(start_time = start_time, end_time = end_time, wait_time = wait_time, fishing_day_length = 12) ## End(Not run) start_time <- 2 end_time <- NULL wait_time <- NULL # Will return an error ## Not run: check_times(start_time = start_time, end_time = end_time, wait_time = wait_time, fishing_day_length = 8) ## End(Not run) start_time <- 2 end_time <- 6 wait_time <- NULL fishing_day_length <- 8 check_times(start_time = start_time, end_time = end_time, wait_time = wait_time, fishing_day_length = 8)
This function leverages make_anglers
, get_total_values
,
and simulate_bus_route
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.
conduct_multiple_surveys(n_sims, ...)
conduct_multiple_surveys(n_sims, ...)
n_sims |
The number of simulations to be conducted in the simulation of interest. |
... |
Arguments to be passed to other subfunctions |
Because this function is merely a wrapper for the simulate_bus_route
code, the user still needs to set two of start_time
, wait_time
, and end_time
,
n_anglers
, n_sites
, and fishing_day_length
as objects. These
can be passed through the ...
argument.
Estimate catch (), the catch rate calculated by the ratio of means,
the true, observed catch, and the actual catch rate (
).
Steven H. Ranney
#Simulation 1 start_time <- c(1, 3.5, 5.75) wait_time <- c(2, 2, 1) n_anglers <- c(10,10,50) n_sites <- 3 fishing_day_length <- 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, mean_catch_rate = mean_catch_rate, fishing_day_length = fishing_day_length) #Simulation 2 start_time <- 0 wait_time <- 8 n_anglers <- 100 n_sites <- 1 fishing_day_length <- 10 mean_catch_rate <- 2.5 #One survey/week for a year conduct_multiple_surveys(n_sims = 52, start_time = start_time, wait_time = wait_time, n_anglers = n_anglers, n_sites = n_sites, mean_catch_rate, fishing_day_length = fishing_day_length)
#Simulation 1 start_time <- c(1, 3.5, 5.75) wait_time <- c(2, 2, 1) n_anglers <- c(10,10,50) n_sites <- 3 fishing_day_length <- 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, mean_catch_rate = mean_catch_rate, fishing_day_length = fishing_day_length) #Simulation 2 start_time <- 0 wait_time <- 8 n_anglers <- 100 n_sites <- 1 fishing_day_length <- 10 mean_catch_rate <- 2.5 #One survey/week for a year conduct_multiple_surveys(n_sims = 52, start_time = start_time, wait_time = wait_time, n_anglers = n_anglers, n_sites = n_sites, mean_catch_rate, fishing_day_length = fishing_day_length)
This function multiple outputs from simulate_bus_route
to estimate the variance in estimated effort, .
estimate_ehat_variance(data)
estimate_ehat_variance(data)
data |
A dataframe of output from |
The total variance in is estimated from multiple simulated surveys
on a single theoretical day. The variance is estimated by
where is the total estimated party hours for an individual survey
(i.e.,
), and
is the mean of the
,
and n is how many simulations were run. The equation above matches the variables
used in Robson and Jones (1989) and 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. Thus, this is total variance. They use this conservative estimator of variance for building confidence intervals around the estimates of effort.
The total variance in estimated effort, Ehat
(), from Robson
and Jones (1989) and Jones et al. (1990).
Steven H. Ranney
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.
#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)
#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)
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.
get_total_values( data, start_time = NULL, end_time = NULL, wait_time = NULL, circuit_time = 8, fishing_day_length = NULL, mean_catch_rate = NULL, scale = 1, ... )
get_total_values( data, start_time = NULL, end_time = NULL, wait_time = NULL, circuit_time = 8, fishing_day_length = NULL, mean_catch_rate = NULL, scale = 1, ... )
data |
A 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. |
circuit_time |
The total time it takes a surveyor to complete their sampling circuit. |
fishing_day_length |
The length of the fishing day, in hours. |
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. |
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 fishing_day_length - 0.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
and 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.
Steven H. Ranney
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.
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! fishing_day_length <- 12 make_anglers(100) %>% get_total_values(start_time = start_time, end_time = end_time, mean_catch_rate = mean_catch_rate, fishing_day_length = fishing_day_length) start_time <- .001 #start of fishing day end_time <- 6 #halfway through the fishing day mean_catch_rate <- 0.1 #this will cause VERY few fish to be caught! fishing_day_length <- 12 make_anglers(100) %>% get_total_values(start_time = start_time, end_time = end_time, mean_catch_rate = mean_catch_rate, fishing_day_length = fishing_day_length)
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! fishing_day_length <- 12 make_anglers(100) %>% get_total_values(start_time = start_time, end_time = end_time, mean_catch_rate = mean_catch_rate, fishing_day_length = fishing_day_length) start_time <- .001 #start of fishing day end_time <- 6 #halfway through the fishing day mean_catch_rate <- 0.1 #this will cause VERY few fish to be caught! fishing_day_length <- 12 make_anglers(100) %>% get_total_values(start_time = start_time, end_time = end_time, mean_catch_rate = mean_catch_rate, fishing_day_length = fishing_day_length)
Creates a population of n_anglers
with trip length and fishing day length provided by the user.
make_anglers( n_anglers = 100, mean_trip_length = 3.88, fishing_day_length = 12, scale = 1 )
make_anglers( n_anglers = 100, mean_trip_length = 3.88, fishing_day_length = 12, scale = 1 )
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 |
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.
A data frame called that includes variables start_time
, trip_length
,
and departure_time
. Summing the trip_length
field returns the true
fishing effort.
Steven H. Ranney
make_anglers(100, mean_trip_length = 4, fishing_day_length = 10) #make_anglers(10000)
make_anglers(100, mean_trip_length = 4, fishing_day_length = 10) #make_anglers(10000)
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.
simulate_bus_route( start_time, wait_time, n_anglers, n_sites, mean_catch_rate, ... )
simulate_bus_route( start_time, wait_time, n_anglers, n_sites, mean_catch_rate, ... )
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. |
mean_catch_rate |
The mean catch rate for the fishery |
... |
Arguments to be passed to other subfunctions, specifically to the
|
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
where E = estimated total party-hours of effort; T = total time
to complete a full circuit of the route, including traveling and waiting;
= waiting time at the
site
(where i = 1, ..., n sites);
=
total time that the
car is parked at the
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
where is the catch for the
sampling unit
and
is the length of the fishing trip at the time of the
interview. For incomplete surveys,
represents in incomplete
trip.
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).
Steven H. Ranney
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.
# To simulate one bus route survey that takes place in the morning, these values are used #start time at access sites start_time_am <- c(1, 2,3,4,5) wait_time_am <- c(.5, .5, .5, .5, 2) n_anglers_am <- c(10,10,10,10,50) n_sites_am <- 5 mean_catch_rate <- 2.5 fishing_day_length <- 12 simulate_bus_route(start_time = start_time_am, wait_time = wait_time_am, n_anglers = n_anglers_am, n_sites = n_sites_am, mean_catch_rate = mean_catch_rate, fishing_day_length) # 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 n_anglers = 1000 n_sites = 1 mean_catch_rate <- 5 fishing_day_length <- 12 simulate_bus_route(start_time = start_time, wait_time = wait_time, n_anglers = n_anglers, n_sites = n_sites, mean_catch_rate = mean_catch_rate, fishing_day_length = fishing_day_length)
# To simulate one bus route survey that takes place in the morning, these values are used #start time at access sites start_time_am <- c(1, 2,3,4,5) wait_time_am <- c(.5, .5, .5, .5, 2) n_anglers_am <- c(10,10,10,10,50) n_sites_am <- 5 mean_catch_rate <- 2.5 fishing_day_length <- 12 simulate_bus_route(start_time = start_time_am, wait_time = wait_time_am, n_anglers = n_anglers_am, n_sites = n_sites_am, mean_catch_rate = mean_catch_rate, fishing_day_length) # 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 n_anglers = 1000 n_sites = 1 mean_catch_rate <- 5 fishing_day_length <- 12 simulate_bus_route(start_time = start_time, wait_time = wait_time, n_anglers = n_anglers, n_sites = n_sites, mean_catch_rate = mean_catch_rate, fishing_day_length = fishing_day_length)