variability_components: Compute total, within group and between group variability...

Description Usage Arguments Value Examples

View source: R/common_tools.R

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)

cocoreg documentation built on May 2, 2019, 6:48 a.m.