Description Usage Arguments Details Value See Also Examples
Performs Principle Component Analysis (PCA) on a specified data set and subset of indicators or aggregation groups. Returns weights corresponding to the first principal component, i.e the weights that maximise the variance explained by the linear combination of indicators.
1 2 3 4 5 6 7 8 9 |
COIN |
An input object. The function can handle either the COIN object, or a data frame.
The data frame should have each column as an indicator, and an optional column |
dset |
If input is a COIN object, this specifies which data set in |
icodes |
An optional character vector of indicator codes to subset the indicator data. Usefully, can also refer to an aggregation group name, and data will be sub-setted accordingly. NOTE does not work with multiple aggregate group names. |
aglev |
The aggregation level to take indicator data from. Integer from 1 (indicator level) to N (top aggregation level, typically the index). |
by_groups |
If |
nowarnings |
If |
out2 |
If the input is a COIN object, this controls where to send the output. If |
Note that getPCA()
is simply a quick wrapper for stats::prcomp()
which makes PCA on COINs quicker.
See COINr online documentation for more details and examples.
If out2 = "COIN"
, results are appended to the COIN object. Specifically:
A new set of PCA weights is added to .$Parameters$Weights
A list is added to .$Analysis
containing PCA weights (loadings) of the first principle component, and the output of stats::prcomp, for each
aggregation group found in the targeted level.
If out2 = "list"
the same outputs are contained in a list.
stats::prcomp Principle component analysis
1 2 3 4 5 6 7 8 9 | # build ASEM COIN
ASEM <- assemble(IndData = ASEMIndData, IndMeta = ASEMIndMeta,
AggMeta = ASEMAggMeta)
# get PCA results for pillar groups inside "Sust" (sustainability) sub-index
# (warnings about missing data are suppressed)
PCAres <- getPCA(ASEM, dset = "Raw", icodes = "Sust",
aglev = 1, nowarnings = TRUE, out2 = "list")
# summarise PCA results for Social pillar
summary(PCAres$PCAresults$Social$PCAres)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.