Pca

scalaglm.Pca
See thePca companion object
case class Pca(mat: DMD, colNames: Seq[String])

Principal components analysis

Computed using SVD of the centred data matrix rather than from the spectral decomposition of the covariance matrix. eg. More like the R function "prcomp" than the R function "princomp".

NOTE: .loadings are transposed relative to the PCA function in Breeze

Value parameters

colNames

Sequence of column names of mat

mat

Data matrix with rows corresponding to observations and columns corresponding to variables

Attributes

Returns

An object of type Pca with methods such as .loadings, .scores, .sdev and .summary

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def plots: Figure

Diagnostic plots for the PCA

Diagnostic plots for the PCA

Attributes

def summary: Unit

Prints a summary of the PCA to console

Prints a summary of the PCA to console

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

val SVD: SVD[DenseMatrix[Double], DenseVector[Double]]

Breeze SVD object for the centred data matrix

Breeze SVD object for the centred data matrix

Attributes

lazy val cumuvar: DenseVector[Double]

Cumulative variance of the principal components

Cumulative variance of the principal components

Attributes

val loadings: DenseMatrix[Double]

Loadings/rotation matrix. Note that this is the TRANSPOSE of the corresponding Breeze method. But this is the usual way the rotations are reported. See how the .summary method labels the rows and columns if you are confused.

Loadings/rotation matrix. Note that this is the TRANSPOSE of the corresponding Breeze method. But this is the usual way the rotations are reported. See how the .summary method labels the rows and columns if you are confused.

Attributes

val n: Int

Number of observations

Number of observations

Attributes

val names: List[String]

Column names (as a List)

Column names (as a List)

Attributes

val p: Int

Number of variables

Number of variables

Attributes

lazy val propvar: DenseVector[Double]

Proportion of variance explained by each principal component

Proportion of variance explained by each principal component

Attributes

lazy val scores: DenseMatrix[Double]

n x p matrix of scores - the rotated data

n x p matrix of scores - the rotated data

Attributes

val sdev: DenseVector[Double]

Standard deviations of the principal components

Standard deviations of the principal components

Attributes

lazy val totVar: Double

The total variance of the principal components

The total variance of the principal components

Attributes

lazy val variance: DenseVector[Double]

Variances of the principal components

Variances of the principal components

Attributes

val x: DenseMatrix[Double]

Centred data matrix

Centred data matrix

Attributes

val xBar: DenseVector[Double]

Column means (for centring)

Column means (for centring)

Attributes