Package 'AnglerCreelSurveySimulation'

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

Help Index


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:

RelativeStandardError=snxˉ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))

Check that start, wait, or end times for a surveyor are provided and reasonable

Description

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.

Usage

check_times(
  start_time = NULL,
  wait_time = NULL,
  end_time = NULL,
  fishing_day_length = NULL
)

Arguments

start_time

The start time of the clerk. An int between 0 and fishing_day_length. The default is NULL.

wait_time

the wait time of the clerk. The default is NULL. The default is NULL

end_time

the end time of the clerk. An int between 0 and fishing_day_length. The default is NULL.

fishing_day_length

the total length of the fishing day, in hours, as int. 0800hrs to 2000hrs = fishing_day_length of 12 hours.

Details

Two of the three start_time, wait_time, or end_time must be provided. The third will be calculated.

Author(s)

Steven H. Ranney

Examples

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)

Conduct multiple simulations of a survey

Description

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.

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 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.

Value

Estimate catch (E^\widehat{E}), the catch rate calculated by the ratio of means, the true, observed catch, and the actual catch rate (λ\overline{\lambda}).

Author(s)

Steven H. Ranney

See Also

make_anglers

check_times

get_total_values

simulate_bus_route

Examples

#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)

Calculate within-day variance of estimated effort (Ehat)

Description

This function multiple outputs from simulate_bus_route to estimate the variance in estimated effort, E^\widehat{E}.

Usage

estimate_ehat_variance(data)

Arguments

data

A dataframe of output from simulate_bus_route.

Details

The total variance in E^\widehat{E} is estimated from multiple simulated surveys on a single theoretical day. The variance is estimated by

1n(n1)(T^phT^ph)2\frac{1}{n(n-1)}\sum(\widehat{T}_{ph}-\overline{\widehat{T}}_{ph})^2

where T^ph\widehat{T}_{ph} is the total estimated party hours for an individual survey (i.e., E^\widehat{E}), and T^ph\overline{\widehat{T}}_{ph} is the mean of the E^\widehat{E}, 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.

Value

The total variance in estimated effort, Ehat (E^\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,
  circuit_time = 8,
  fishing_day_length = NULL,
  mean_catch_rate = NULL,
  scale = 1,
  ...
)

Arguments

data

A dataframe returned from make_anglers

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 rgamma function to randomly generate angler trip lengths

...

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 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.

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!
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)

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. 3.88 is the default. The default is from data from the 2008 Lake Roosevelt (WA) Fishing Evaluation Program.

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 rgamma function to randomly generate angler trip lengths

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,
  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 startTime to simulate a traditional access survey.

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 waitTime to simulate a traditional access survey.

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 make_anglers function, including mean_trip_length and fishing_day_length.

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

E^=Ti=1n1wij=1meij\widehat{E} = T\sum\limits_{i=1}^n{\frac{1}{w_{i}}}\sum\limits_{j=1}^m{e_{ij}}

where E = estimated total party-hours of effort; T = total time to complete a full circuit of the route, including traveling and waiting; wiw_i = waiting time at the ithi^{th} site (where i = 1, ..., n sites); eije_{ij} = total time that the jthj^{th} car is parked at the ithi^{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

R1^=i=1nci/ni=1nLi/n\widehat{R_1} = \frac{\sum\limits_{i=1}^n{c_i/n}}{\sum\limits_{i=1}^n{L_i/n}}

where cic_i is the catch for the ithi^{th} sampling unit and LiL_i is the length of the fishing trip at the time of the interview. For incomplete surveys, LiL_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

make_anglers

get_total_values

Examples

# 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)