Using the output of impute_mip_data, principal component analysis will be condcuted and the resultant components returned, with the variance in the data explained by each component and the loadings of each component also returned.

pca_mip_data(dat)

Arguments

dat

output of impute_mip_data

Value

Invisibly returns a list of class `prcomp` with the following components

  • "sdev" the standard deviations of the principal components (i.e., the square roots of the eigenvalues of the covariance/correlation matrix, though the calculation is actually done with the singular values of the data matrix).

  • "rotation" the matrix of variable loadings (i.e., a matrix whose columns contain the eigenvectors). The function princomp returns this in the element loadings.

  • "center, scale" the centering and scaling used

  • "x" the value of the rotated data (the centred data multiplied by the rotation matrix) is returned. Hence, cov(x) is the diagonal matrix diag(sdev^2).

  • "var" the variance in the data explained by each component

  • "loadings" the loadings of each component

  • "dat" the raw data used to conduct pca

Examples

dat <- dummy_data() dat <- filter_misc(dat = dat) dat <- filter_coverage(dat = dat, min_coverage = 2) dat <- melt_mip_data(dat = dat) dat <- impute_mip_data(dat = dat) pca <- pca_mip_data(dat = dat)