View source: R/sampleRealizations.R
sampleRealizations | R Documentation |
This function simulates sampling of multiple realizations of
patches of the species of interest within the grid of locations created with
createPop
. The number of total simulations is
length(n1_vec) x length(popvar) x length(realvar)
sampleRealizations( popdata, sims, n1_vec, avar = NULL, ovar, rvar = NULL, SamplingDesign = "ACS", yvar, y_HT_formula = "y_HT", var_formula = "var_y_HT", m_threshold = NULL, f_max = 2, SampleEstimators = FALSE, SpatStat = TRUE, mChar = TRUE, popvar, realvar = "realization", weights = "S", seed = NA )
popdata |
patch realizations |
sims |
Number of simulations per population. |
n1_vec |
Vector of initial sample size(s) for the initial simple random sample(s) without replacement; can be a single value or vector of values. |
avar |
The total vector of variables ( |
ovar |
Vector of occupancy variables. The total vector of variables ( |
rvar |
Vector of ratio variables. The total vector of variables ( |
SamplingDesign |
A character string supplying the sampling design to use; accepted options included "SRS" (simple random sampling), "ACS" (unrestricted adaptive cluster sampling), and "RACS" (restricted ACS). The default is "ACS". |
yvar |
A string giving the name of the variable of interest, y, in the supplied dataframe popdata. This variable determines the condition under which adaptive cluster sampling takes place. In the dataframe $popdata$ this variable y must be numeric. |
y_HT_formula |
The formula used to estimate the population total: either the Horvitz-Thompson estimator, 'y_HT,' or or the RACS-corrected Horvitz-Thompson estimator, 'y_HT_RACS'. |
var_formula |
The formula used to estimate the variance of the population total: either the Horvitz-Thompson variance estimator, 'var_y_HT', or the RACS-corrected Horvitz-Thompson variance estimator, "var_y_HT_RACS." Defaults to "var_y_HT". |
m_threshold |
threshold value above which to calculate pi_i and pi_j differently. |
f_max |
The maximum number of expanding sets of adjacent units surveyed per primary unit in the adaptive phase of ACS. For more information, see Sauby and Christman (in prep). |
SampleEstimators |
If "TRUE", calculate the sample mean and sample variance for each simulation. Default is FALSE. |
SpatStat |
TRUE or FALSE. If "TRUE", for each simulation calculate Moran's I, and the nugget, sill, and range of the semivariogram. Default is TRUE. |
mChar |
TRUE or FALSE. If "TRUE", for each simulation calculate summary statistics (median, mean, min, and max) for the sample's m values. Also, for each simulation and for the set of unique m values, calculate the same summary statistics. If "FALSE," no summary statistics are calculated. |
popvar |
Categorical variable used to identify different populations. |
realvar |
Variable identifying each realization. Default is "realization" |
weights |
If SpatStat is "TRUE", this is a vector giving
spatial weight matrix styles to use to calculate the Join Count and Moran's I
statistics. Can take on values "W", "B", "C", "U", "S", and "minmax". See
|
seed |
A vector of numbers, equal in length to n1_vec, to set random seeds, if a goal is the ability to reproduce the random sampling. |
saubyadaptiveACSampling
# sims=20 # n1_vec=c(5,10,20,40) # population <- createPop(x_start = 1, x_end = 30, y_start = 1, y_end = 30) # #' avar = NULL # ovar = c( # "Stricta", # "Pusilla", # "Cactus", # "CACA_on_Pusilla", # "CACA_on_Stricta", # "MEPR_on_Pusilla", # "MEPR_on_Stricta", # "Old_Moth_Evidence_Pusilla", # "Old_Moth_Evidence_Stricta" # ) # data(CactusRealizations) # popdata = CactusRealizations # WHY IS THERE ISLAND=NA # simulation_data <- sampleRealizations( # popdata = popdata, # sims = sims, # n1_vec = n1_vec, # avar = avar, # ovar = ovar, # popvar="Island", # yvar="Cactus" # ) # sims=200 # n1_vec=c(75,150,225,300,350) # simulation_data_SRSWOR <- sampleRealizations( # popdata = popdata, # sims = sims, # n1_vec = n1_vec, # avar = avar, # ovar = ovar, # popvar="Island" # )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.