variability_components: Compute total, within group and between group variability using fun

Description

The function used the definition: gvar = tvar - wgvar

Usage

1
variability_components(vec, grp, fun)

Arguments

vec

[1,M] numeric, Data vector

grp

[1,M] integer/character vector, Some grouping of vec

fun

function, Function to use when quantifying the variability

Value

A list with elements:

tvar:

Total variability

bgvar:

Between groups variability, tvar - sum(wgvar_*)

wgvar_<groupname>:

Within group variability for each group

wg_rel:

sum(wgvar)/tvar

bg_rel:

bgvar/tvar

Examples

1
2
3
vec <- rnorm(10)
grp <- rep(c("a","b","c"), c(3,3,4))
variability_components(vec, grp, ss)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.