r2: R-squared between or within groups

Description Usage Arguments Details Value

View source: R/Functions.R

Description

Function for calculating R^2 either within or between groups.

Usage

1
r2(pred, obs, group = NULL)

Arguments

pred

a vector containing numeric predictions (i.e. estimated values).

obs

a vector containing numeric observations (i.e. truth values).

group

An optional group by which to calculate R^2. If left empty. R^2 is calculated between groups.

Details

By specifying a some group in the group argument of this function, R^2 is calculated within groups. Note that this is only meaningful for groups with more than one observation and where variance exists.

Value

calculated R^2 as a single numeric value.


koenniem/MobileSensing documentation built on June 3, 2020, 7:10 p.m.