PCA.LOADINGS OpenBI
Principal components' loadings: how much each variable weighs in each.
Group: Many variables at once. OpenBI’s own: DAX has no function of this name.
Syntax
PCA.LOADINGS ( <table>, <name1>, <expression1>, <name2>, <expression2> [, <name3>, <expression3>] … )
| Parameter | Type | Description |
|---|---|---|
table | Table | The rows to analyse: a table of the model or any table expression. |
name1 | Text | The first variable's name, a text in quotes. |
expression1 | Expression evaluated for each row | The first variable's number for each row. |
name2 | Text repeatable | The next variable's name; two or more variables in all. |
expression2 | Expression repeatable, evaluated for each row | The next variable's number for each row. |
Returns
Table. A row a variable: Variable, then PC1, PC2 … with the variable's weight in each component.
Remarks
- The weights say what a component is made of: a large weight, positive or negative, means the variable counts for much in it. Variables whose weights share a sign move together along it.
- Each component's weights have squares that add up to 1. Their sign is set so that the largest weight is positive; R's prcomp may show a component with every sign the other way, which is the same component.
- A weight times the square root of its component's eigenvalue (Std deviation in
PCA.COMPONENTS) is the variable's correlation with the component. - Every variable is first put on one scale: how many standard deviations each row lies above or below that variable's mean. Liters and kroner then weigh alike, and a change of units changes nothing.
- A row where any variable is blank is left out. A variable must be a number on every row (text is an error, even text that reads as a number), and one that is the same on every row is an error too.
Compared with DAX
An OpenBI function: DAX has none like it, so a measure or query that uses it works in OpenBI only, not in Power BI or Analysis Services.
Examples
What the beers' components are made of
PC1 weighs the three alike: it is "more of everything". PC2 sets bitterness against strength.
EVALUATE
VAR Beers =
DATATABLE (
"Beer", STRING, "Strength", DOUBLE, "Bitterness", INTEGER, "Price", INTEGER,
{
{ "Lettøl", 2.5, 15, 30 }, { "Pils", 4.7, 25, 38 }, { "Lager", 5.0, 22, 40 },
{ "Pale ale", 5.5, 40, 55 }, { "IPA", 6.5, 65, 64 }, { "Stout", 7.0, 45, 70 }
}
)
RETURN
PCA.LOADINGS ( Beers, "Strength", [Strength], "Bitterness", [Bitterness], "Price", [Price] )
| Variable | PC1 | PC2 | PC3 |
|---|---|---|---|
| Strength | 0.57636205031225 | -0.597797524300152 | -0.557175831224282 |
| Bitterness | 0.565677869582819 | 0.783912919769902 | -0.255908347034775 |
| Price | 0.589758708985382 | -0.167686177601007 | 0.789978487692836 |
Countries
PC1 is size (people and GDP); PC2 is mostly GDP per person.
EVALUATE
PCA.LOADINGS ( Countries, "People", Countries[People], "GDP", Countries[GDP], "GDP per person", [GDP per person] )
| Variable | PC1 | PC2 | PC3 |
|---|---|---|---|
| People | 0.664788883296279 | -0.364224850356616 | -0.652223887195483 |
| GDP | 0.715435583758026 | 0.0591848750939726 | 0.696167419557195 |
| GDP per person | 0.214959684914401 | 0.929428538911309 | -0.299924865455817 |