Description Usage Arguments Value Examples
This function is one of the master functions in this package. It simulates and analyzes a single dataset that is over-dispersed in true abundance, N. To do this many times, use an apply function. It's currently simplified and assumes constant abundance, detection, transect length, NO simulated goodness-of-fit metrics. It simulates both point count and distance data and analyses both datasets using both unmarked and optim.
1 2 3 4 5 6 7 8 9 10 11 12 | simulation_function_N(
n_sites = 50,
n_samps = 6,
lambda1 = 5,
lambda2 = 5,
det_prob = 0.42,
sigma = NA,
W = 20,
reps_to_analyze = 3,
return = "results",
savefilename = file.path("set 1", "datasets", "data")
)
|
n_sites |
number of sites (transects) |
n_samps |
number of samples (replicates) per site |
lambda1 |
partial mean abundance at every site (single draw per site that stays constant across samples) |
lambda2 |
partial mean abundance at every replicate (new draw for every sample at every site) |
det_prob |
mean detection probability |
sigma |
detection parameter (meters). Just leave this blank and it will be calculated from det_prob |
W |
transect half-width (meters) |
reps_to_analyze |
the number of samples/replicates to analyze. If NA, it will analyse all replicates in the data. |
return |
What to return from the function call. Currently the only option is 'results'. May change this to only analyze simulated goodness-of-fit metrics. |
savefilename |
The simulated datasets and results ARE saved to file (currently not optional). This provides the path and filename for saving the intermediate steps in the analysis. |
if everything works well, it returns a data.frame with the results of simulating a single dataset, analyzing it in 4 ways, and calculating randomized quantile residuals a la Knape et al. 2018. It also saves a list with the simulated dataset, dataframe of results (minus rqr residual info), and the actual rqr residuals to a savefilename inside the folder path 'working directory'/results/Scenario 2/savefilename. If there is an error, the function returns NA and also saves a file to 'working directory'/Scenario 2/set x/errors with the simulated dataset and the results data.frame but no rq-residuals (it's basically assumed that the rq-residuals were the source of the error.) Similarly, with a warning the function returns the results data.frame and also saves a file to 'working directory'/Scenario 2/set x/warnings with the simulated dataset and the results data.frame but no rq-residuals (it's basically assumed that the rq-residuals were the source of the error.) The user will have to go back and try to calculate rq-residuals from the output later.
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.