Description Usage Arguments Details Value Functions Examples
Finds principal components of a weitrix. If varimax rotation is enabled, these are then rotated to enhance interpretability.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  weitrix_components(
weitrix,
p = 0,
design = ~1,
n_restarts = 3,
max_iter = 1000,
tol = 1e05,
use_varimax = TRUE,
initial = NULL,
verbose = TRUE
)
weitrix_components_seq(
weitrix,
p,
design = ~1,
n_restarts = 3,
max_iter = 1000,
tol = 1e05,
use_varimax = TRUE,
verbose = TRUE
)

weitrix 
A weitrix object, or an object that can be converted to a weitrix
with 
p 
Number of components to find. 
design 
A formula referring to 
n_restarts 
Number of restarts of the iteration to use. 
max_iter 
Maximum iterations. 
tol 
Stop iterating if Rsquared increased by less than this amount in an iteration. 
use_varimax 
Use varimax rotation to enhance interpretability of components. 
initial 
Optional, an initial guess for column components (scores).
Can have fewer columns than 
verbose 
Show messages about the progress of the iterations. 
Note that this is a slow numerical method to solve a gnarly problem, for the case where weights are not uniform. The case of uniform weights or weights that can be written as an outer product of row and column weights is somewhat faster, however there are much faster algorithms for this available elsewhere.
An iterative method is used,
starting from a random initial set of components.
It is possible for this to get stuck at a local minimum.
To ameliorate this, the iteration is initially run n_restarts
times
and the best result used.
This is then iterated further.
Examine all_R2s
in the output to see if this is happening –
if the values are not all nearly identital,
the iteration is sometimes getting stuck at local minima.
Increase n_restarts
to
increase the odds of finding the global minimum.
A "Components" object with the following elements accessible using $
.
row Row matrix, aka loadings. Rows are rows in the weitrix, and columns contain the experimental design (usually just an intercept term), and components.
col Column matrix, aka scores. Rows are columns in the weitrix, and columns contain fitted coefficients for the experimental design, and components.
R2 Weighted R squared statistic. The proportion of total variance explained by the components.
all_R2s R2 statistics from all restarts. This can be used to check how consistently the iteration finds optimal components.
ind_designColumn indices associated with experimental design.
ind_componentsColumn indices associated with components.
For a result comp
,
the original measurements are approximated
by comp$row %*% t(comp$col)
.
weitrix_components_seq
returns a list of Components objects,
with increasing numbers of components from 1 up to p.
weitrix_components
: Find a matrix decomposition with the specified number of components.
weitrix_components_seq
: Produce a sequence of weitrix decompositions with 1 to p components.
1 2 3 4 5 6 7 8 9 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.