withinCov: Within-class Covariance Matrix

Description Usage Arguments Details Author(s) See Also Examples

View source: R/withinCov.R

Description

Calculates the within-class covariance matrix

Usage

1
  withinCov(variables, group, div_by_n = FALSE)

Arguments

variables

matrix or data frame with explanatory variables (No missing values are allowed)

group

vector or factor with group memberships (No missing values are allowed)

div_by_n

logical indicating division by number of observations

Details

When div_by_n=TRUE the covariance matrices are divided by n (number of observations), otherwise they are divided by n-1

Author(s)

Gaston Sanchez

See Also

withinSS, betweenCov, totalCov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
  # load iris dataset
  data(iris)

  # within-class covariance matrix (dividing by n-1)
  withinCov(iris[,1:4], iris[,5])

  # within-class covariance matrix (dividing by n)
  withinCov(iris[,1:4], iris[,5], div_by_n=TRUE)
  
## End(Not run)

gastonstat/DiscriMiner documentation built on Feb. 27, 2021, 4:58 a.m.