create.bootcount.data: Aggregate bootstrapped distance data into count data

View source: R/create.bootcount.data.R

create.bootcount.dataR Documentation

Aggregate bootstrapped distance data into count data

Description

This function creates a new data set where dis.data is aggregated for each visit to a segment. For bootstrapped data, the column with the ids for visits to a segment is segment.id2 which is created by create.bootstrap.data using the default for argument rename. The sum of the estimated number of individuals for each segment from dis.data$NHAT is given in the column NHAT in the new data. All other columns from the observation layer should be discarded. This is achieved by specifying the columns that should be retained using the argument column.numbers. Generally, all columns from the segment and higher levels should be kept. If the default is used, column.numbers=NULL, the columns distance, object, size, distbegin and distend from the observation level are automatically discarded. Note that for those columns from the observation layer that are kept, only the first recorded value will be transferred.

Usage

create.bootcount.data(dis.data, column.numbers = NULL)

Arguments

dis.data

Data frame containing distance data (one row for each detection). Expects a column NHAT, i.e. size of detection divided by its probability of detection (see create.NHAT) and that and that ids in segment.id2 are unique regardless of what resampled transect they belong to.

column.numbers

Optional argument: vector of integers indicating which columns other than NHAT from dis.data should be retained in the returned data.

Value

This function returns bootstrapped count data that is suited for second stage count modelling of distance sampling data. The data includes the columns NHAT and area which are the response and the offset required by functions concerned with second stage modelling from this package.

Examples

data(dis.data.re)
# bootstrap data without stratification
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))
dis.data.re<-create.NHAT(dis.data.re,result)

bootstrap.data<-create.bootstrap.data(dis.data.re) 

bootcount.data<-create.bootcount.data(bootstrap.data)


lindesaysh/MRSea documentation built on April 5, 2024, 4:39 p.m.