Learn R Programming

ssMRCD (version 1.1.0)

plot_loadings: Plots of loadings of PCAloc object

Description

Plots of loadings of PCAloc object

Usage

plot_loadings(object, ...)

Value

Returns loading heatmap for component k.

Arguments

object

object of class PCAloc

...

other input arguments, see details.

Details

Additional parameters that can be given to the function are:

textlogical if values should be added as text.
sizepoint size.
tolerancetolerance for rounding to zero.
kinteger, which component scores should be plotted.
groupnamesnames of groups.
varnamesnames of variables.
textrotateangle of text rotation, if included.

Examples

Run this code
# set seed
set.seed(236)

data = matrix(rnorm(2000), ncol = 4)
groups = sample(1:10, 500, replace = TRUE)
W = time_weights(N = 10, c(3,2,1))

# calculate covariance matrices
covs = ssMRCD(data, groups = groups, weights = W, lambda = 0.3)

# sparse PCA
pca = sparsePCAloc(eta = 0.3, gamma = 0.7, cor = FALSE, COVS = covs$MRCDcov,
             n_max = 1000, increase_rho = list(TRUE, 50, 1), trace = FALSE)

# plot score distances
plot_loadings(object = pca,
            k = 1,
            size = 2)

Run the code above in your browser using DataLab