Dear group
I am trying out the code to derive the sampling distribution of pairwise differences in estimated density using the bootstrap as in this vignette. Unfortunately, I seem to be having a problem with the “bootdht” function when applying it to my data and model (it works fine using the example datasets of the vignette). My data is for one species and one area across 4 different survey years. If have used the different years as Region.Label to have stratified results. I am using formula = ~size to accommodate the cluster size bias that was clearly observed for this species. My model:BSDPPWS_hn_t81_size <- ds (data=BSDPPWS,
truncation=81,
key="hn",
adjustment=NULL,
convert_units=conversion.factor,
formula=~size)
The problem arises when using the bootdht function, for example:est.bootn <- bootdht(model=BSDPPWS_hn_t81_size,
flatfile=BSDPPWS,
summary_fun=bootdht_Nhat_summarize,
convert_units=conversion.factor,
sample_fraction=1,
nboot=10, cores=1)
*Note: nboot was set low for trying out the code
Est.bootn is then returned as a data.frame with 0 columns and 0 rows
I don't have any problems obtaining the results from my model using the conventional summary() function.
I can see a difference between my model object and those of
the example datasets: my model$dht is a list[3}(S3:dht) and includes individuals,
as well as clusters and Expected.S. The example dataset only include individuals.
Could something be going wrong there when calling the boothdt function?
Finally, for another dataset where estimation was derived via multiple call to ds(), I would also like to compare density differences using bootstrapping. In the limitations sections of the vignette it is stated “However, based upon the provided code, it should be clear how to produce replicate density estimates via bootdht() and then difference them with a single line of code.” Would this be achieved by merging the bootdht() results from the two different models into one outcome dataframe and then running the remaining code as is?
Many thanks in advance for your support!
Milou
ClusterExercise
that ships with the Distance package).bootdht_Nhat_summarize
function, if those abundances do not exist, code might return a data.frame with 0 columns and 0 rows). Recognize there is a companion summary function
bootdht_Dhat_summarize
for use when inference is based around density estimates.Distance
package, I mean updating from Github, rather than updating from CRAN. For a Github update, use these two lines of code:
Region.Label
that begin with letters that appear in the alphabet before
T. We hope to get the bug sorted, but meanwhile follow this advice when naming your strata for analysis.