fold {intRvals} | R 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 |
take.sample |
when |
sigma.within |
(optional) numeric value with an assumed within-group/subject standard deviation, or ' |
silent |
logical, if |
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
\mu+(x-i*\mu)/\sqrt 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 \phi(x | i \mu,\sqrt i \sigma)
with i
in intervalpdf.
When no sigma.within
is provided, \mu
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
', \mu
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')