Learn R Programming

cocoreg (version 0.1.1)

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

Description

The function used the definition: gvar = tvar - wgvar

Usage

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

Run this code
vec <- rnorm(10)
grp <- rep(c("a","b","c"), c(3,3,4))
variability_components(vec, grp, ss)

Run the code above in your browser using DataLab