R/moma-R6.R
moma_R6.Rd
During initialization of an SFPCA
object, R
calls the C++
-side function, cpp_multirank_BIC_grid_search
,
and wraps the results returned. The SFPCA
object also records
penalty levels and selection schemes of tuning parameters. Several
helper methods are provivded to facilitate access to results.
Initialization is delegated to moma_sfpca
.
The following table lists the supported methods for
R6 objects generated by moma_*pca
, moma_*cca
and moma_*lda
family of functions.
get_mat_by_index | interpolate | ||||||
print | plot | ||||||
X_project | Y_project | left_project | |||||
moma_*pca | Yes | Yes | |||||
Yes | Yes | Yes | |||||
moma_*cca | Yes | Yes | Yes | ||||
Yes | Yes | moma_*lda | |||||
Yes | Yes | Yes | Yes | ||||
get_mat_by_index |
center,scale
The attributes "scaled:center
" and "scaled:scale
"
of function scale
. The numeric centering and scalings
used (if any) of the data matrix.
grid_result
A 5-D list containing the results evaluated on the parameter grid.
select_scheme_list
A list with elements
select_scheme_alpha_u
, select_scheme_alpha_v
,
select_scheme_lambda_u
, select_scheme_lambda_v
.
Each of them is either 0 or 1. 0 stands for grid search
and 1 stands for BIC search. Please see the select_scheme
argument in the function moma_sfpca
.
get_mat_by_index
For moma_*pca
: alpha_u
, alpha_v
,
lambda_u
, lambda_v
.
For moma_*cca
and moma_*lda
: alpha_x
,
alpha_y
, lambda_x
, lambda_y
.
Indices of the parameters in the paramter grid, which have
been specified during initialization.
Obtain the right and left penalized sigular vectors
located by the set of
indices (alpha_u
, alpha_v
, lambda_u
,
lambda_v
) or (alpha_x
,
alpha_y
, lambda_x
, lambda_y
). Penalized
sigular vectors are packed into matrices U
and V
.
For moma_*pca
, it is a list containing U
,
V
, d
, chosen_lambda_u
, chosen_lambda_u
,
chosen_lambda_v
, chosen_alpha_u
,
chosen_alpha_v
.
For moma_*lda
, it is a list containing X_PC_loadings
,
Y_group_scores
, d
, chosen_lambda_x
,
chosen_lambda_y
, chosen_alpha_x
,
chosen_alpha_y
.
For moma_*cca
, it is a list containing X_PC_loadings
,
Y_PC_loadings
, d
, chosen_lambda_x
,
chosen_lambda_y
, chosen_alpha_x
,
chosen_alpha_y
.
*_project
For left_project
(available for moma_*pca
):
newX
, alpha_u
,
alpha_v
, lambda_u
, lambda_v
.
For X_project
(available for moma_*cca
and
moma_*lda
)): newX
, alpha_x
,
alpha_y
, lambda_x
, lambda_y
.
For Y_project
(available for moma_*cca
):
newY
, alpha_x
,
alpha_y
, lambda_x
, lambda_y
.
newX
or newY
is a new raw data matrix
(un-centered and un-scaled) of
an appropriate number of columns. (alpha_u
,
alpha_v
, lambda_u
, lambda_v
)
or (alpha_x
,
alpha_y
, lambda_x
, lambda_y
) is the set of
indices to locate the penalalized singular vectors used to form
the basis of the low dimensional space.
Project the new data into the space spaned by the penalized left singular vectors, after scaling and centering as needed.
A list containing the scaled and centered data (as needed)
scaled_data
and the projected data proj_data
.
interpolate
alpha_u
, alpha_v
,
lambda_u
, lambda_v
, exact
.
exact
is a logical scalar. (alpha_u
,
alpha_v
, lambda_u
, lambda_v
) is the
set of new paramters of interest.
When exact = TRUE
, a new solution will be calculated
exactly with the parameters set to (alpha_u
,
alpha_v
, lambda_u
, lambda_v
).
When exact = FALSE
, an approximate solution
will be given by taking the average of two solutions
whose parameters' values are "closest" to the ones
specified by the user.
For a set of new parameters, give an approximate solution of SFPCA based on pre-calculated solutions, or just perform exact calculation.
A list containing the exact (if exact = TURE
has been
used) or approximate solution (if exact = FALSE
has
been used) solution U
and V
.
print
Display tuning parameters and selection schemes.
plot
Start a Shiny application and visualize penalized singular vectors and projected data.