Skip to contents

This function creates one realisation of bootstrapped data based on dis.data. The default resampling unit is transect.id which may be modified using the argument resample.

Usage

create.bootstrap.data(
  dis.data,
  resample = "transect.id",
  rename = "segment.id",
  stratum = NULL
)

Arguments

dis.data

Original data to be bootstrapped. Requires a column that matches argument resample exactly.

resample

Specifies the resampling unit for bootstrapping, default is transect.id. Must match a column name in dis.data exactly

rename

A vector of column names for which a new column needs to be created for the bootstrapped data. This defaults to segment.id for line transects, however others might be added A new column with new ids will automatically be created for the column listed in resample

stratum

The column name in dis.data that identifies the different strata. The default NULL returns un-stratified bootstrap data. If stratum is specified, this requires a column in dis.data that matches argument stratum exactly

Value

Returns one realisation of bootstrapped distance data. Note that a new column (in addition to those listed under argument rename) is created. If the default for resample is used, a column with new unique ids called transect.id2. Note that a new column is created with renamed bootstrap resamples to preserve the number of unique bootstrap resamples. If the default for resample is used, i.e. transect.id, this new column is called transect.id2. In addition, a new column segment.id2 is created which is required for other bootstrap functions.

Examples

data(dis.data.re)
# run distance analysis to create NHATS
dis.data.re$survey.id<-paste(dis.data.re$season,dis.data.re$impact,sep="")
result<-ddf(dsmodel=~mcds(key="hn", formula=~1), data=dis.data.re, method="ds",
             meta.data=list(width=250))
#> Error in ddf(dsmodel = ~mcds(key = "hn", formula = ~1), data = dis.data.re,     method = "ds", meta.data = list(width = 250)): could not find function "ddf"
dis.data.re<-create.NHAT(dis.data.re,result)
#> Error in which(data$distance <= ddf.obj$meta.data$width): object 'result' not found

# bootstrap data without stratification
bootstrap.data<-create.bootstrap.data(dis.data.re) 
#> Error in is_tibble(dis.data): could not find function "is_tibble"
# boostrap data with stratification (here by survey which is composed of 
# season and impact)
dis.data.re$survey.id<-paste(dis.data.re$season,dis.data.re$impact,sep="")
bootstrap.data.str<-create.bootstrap.data(dis.data.re, stratum = "survey.id") 
#> Error in is_tibble(dis.data): could not find function "is_tibble"