plotPC {ramwas} | R Documentation

## Plot Principal component (PC) Values (variation explained) and PC vectors (loadings)

### Description

The function `plotPCvalues` plots PC values (variation explained).
The function `plotPCvectors` plots PC vectors (loadings).

### Usage

    plotPCvalues(values, n = 40, ylim = NULL, col = "blue")
    plotPCvectors(eigenvector, i, col = "blue1")

### Arguments

`values` | Vector of PC values.
`n` | Number of top PCs to plot.
`ylim` | Numeric vectors of length 2, giving the y coordinate range. Exactly as in Plotting Parameters.
`col` | Color of the plotted points.
`eigenvector` | The i-th eigenvector. See `eigen`.
`i` | Indicates loadings of which PC to plot.

### Value

This function creates a PC plot and returns nothing (`NULL`).

### Author(s)

Andrey A Shabalin andrey.shabalin@gmail.com

### See Also

See vignettes: `browseVignettes("ramwas")`.

### Examples

    # Sample data
    # for 1000 observations and 10 samples
    m = 1000
    n = 10
    data = matrix(rnorm(n*m), nrow = m)

    # Covariance and eigenvalue decomposition
    covmat = crossprod(data)
    e = eigen(covmat)

    # Plot PC values
    plotPCvalues(e$values)

    # Plot PC vectors
    plotPCvectors(e$vectors[,1], 1)
    plotPCvectors(e$vectors[,2], 2)

[Package ramwas version 1.4.0 Index]