View source: R/DroppingInterval.R

fold | R Documentation |

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

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

`object` |
an object of class |

`take.sample` |
when |

`sigma.within` |
(optional) numeric value with an assumed within-group/subject standard deviation, or ' |

`silent` |
logical, if |

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.

numeric vector with intervals folded into the fundamental interval

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')

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.