fold: Folds observed arrival intervals to a fundamental interval

View source: R/DroppingInterval.R

foldR Documentation

Folds observed arrival intervals to a fundamental interval

Description

Folds observed arrival intervals with missed observations back to their most likely fundamental interval

Usage

fold(object, take.sample = F, sigma.within = NA, silent = F)

Arguments

object

an object of class intRvals, usually a result of a call to estinterval

take.sample

when TRUE the number of folds of the fundamental interval is sampled randomly, taking into account the probability weight of each possibility. When FALSE the fold with the highest probability weight is taken.

sigma.within

(optional) numeric value with an assumed within-group/subject standard deviation, or 'auto' to estimate it automatically using partition.

silent

logical, if TRUE print no text to console

Details

Arrival intervals containing missed observations are folded to their most likely fundamental interval according to a fit of the distribution of intervals by estinterval.

There is inherent uncertainty on how many missed arrival events an observed interval contains, and therefore to which fundamental interval it should be folded. Intervals folded to the fundamental can therefore introduce extra unexplained variance.

The default is to fold intervals to the fundamental with the highest probability weight (take.sample = F). Alternatively, randomly sampled intervals can be generated, that take into account the probability weights of each possible fold (take.sample = T).

Intervals x are transformed to their fundamental interval according to

μ+(x-i*μ)/√ i

with i-1 the estimated number of missed observations within the interval. This transformation scales appropriately with the expected broadening of the standard distributions φ(x | i μ,√ i σ) with i in intervalpdf.

When no sigma.within is provided, μ equals the mean arrival rate, estimated by estinterval.

When sigma.within is 'auto', sigma.within is estimated using partition.

When sigma.within is a user-specified numeric value or 'auto', μ is estimated for each group ( as specified in the group argument of estinterval), by maximizing the log-likelihood of intervalpdf, with its data argument equals to the intervals of the group, its sigma argument equal to sigma.within, and its remaining arguments taken from object.

Intervals assigned to the fpp component (see estinterval) are not folded, and return as NA values.

Value

numeric vector with intervals folded into the fundamental interval

Examples

dr=estinterval(goosedrop$interval,group=goosedrop$bout_id)
# fold assuming no within-group variation:
interval.fundamental=fold(dr)
# test whether there is evidence for within-group variation:
partition(dr)$`p<alpha`   #> TRUE
# there is evidence, therefore better to fold
# while accounting for within-group variation:
interval.fundamental=fold(dr,sigma.within='auto')

intRvals documentation built on May 3, 2022, 1:07 a.m.