partition: Estimate within-group variation

View source: R/DroppingInterval.R

partitionR Documentation

Estimate within-group variation

Description

Estimate within-group variation in interval length

Usage

partition(x, conf.level = 0.9, alpha = 0.05, silent = F)

Arguments

x

object inheriting from class intRvals

conf.level

confidence level passed to function fundamental, used in selecting fundamental intervals

alpha

significance level for differences within and between groups or subjects

silent

logical, if TRUE print no text to console

Details

Within- and between-group variation is estimated on the subset of fundamental intervals only.

The subset of fundamental intervals is selected using fundamental.

We calculate sigma.within = s_w n_{ind}/(n_{ind}+1) with s_w the uncorrected sample standard deviation of within-group centered values (obtained from subtracting the group's mean value from each observation value), and n_{ind}/(n_{ind}+1) Bessel's correction with n_{ind} the average number of repeated measures per group. Significance of within-group variation is determined by testing for a random effect of group against a constant null model (van de Pol & Wright 2009), using the R-package lme4 (Bates et al. 2015).

Value

A logical atomic vector indicating which intervals are fundamental.

sigma.within

within-group standard deviation in interval length, estimated on fundamental intervals with repeated measures only

sigma

the total standard deviation in interval length, copied from x$sigma

p.within

p-value form a likelihood-ratio test indicating whether there is evidence for a random effect of group or subject

n.within

average number of intervals per group

n.total

total number of intervals

n.repeat

number of fundamental intervals with repeated measures, the size of the dataset on which sigma.within was estimated

p<alpha

logical. Whether there was significant evidence for a difference in within- and between-group/subject variance

References

van de Pol, M. & Wright, J. (2009). A simple method for distinguishing within- versus between-subject effects using mixed models. Animal Behaviour, 77, 753-758.

Bates, D., M\"achler, M., Bolker, B.M. & Walker, S.C. (2015). Fitting linear mixed-effects models using lme4. Journal of Statistical Software, 67, 1-48.

Examples

# select the group of intervals observed on Terschelling island
dropset=goosedrop[goosedrop$site=="terschelling",]
# estimate an interval model, with separate within- and between-group variation:
dr=estinterval(data=dropset$interval,group = dropset$bout_id)
# plot the model fit:
plot(dr)
# estimate within-group variation, and its significance:
output=partition(dr)
# print within-group standard deviation:
output$sigma.within
# is the model including within-group standard deviation signicant,
# relative to a null model without separate within-group sd,
# at the specified confidence level alpha?
output$`p<alpha`  #> TRUE

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