tcasub: Subsetting features from a TCA model

Description Usage Arguments Details Value Examples

View source: R/TCA.R

Description

Extracts from a fitted TCA model (i.e. a value returned by the function tca) a subset of the features.

Usage

1
tcasub(tca.mdl, features, log_file = "TCA.log", debug = FALSE, verbose = TRUE)

Arguments

tca.mdl

The value returned by applying the function tca to some data matrixX.

features

A vector with the identifiers of the features to extract (as they appear in the rows of X).

log_file

A path to an output log file. Note that if the file log_file already exists then logs will be appended to the end of the file. Set log_file to NULL to prevent output from being saved into a file; note that if verbose == FALSE then no output file will be generated regardless of the value of log_file.

debug

A logical value indicating whether to set the logger to a more detailed debug level; set debug to TRUE before reporting issues.

verbose

A logical value indicating whether to print logs.

Details

This function allows to extract a subset of the features from a fitted TCA model (i.e. from a value returned by the function tca). This allows, for example, to extract and then perform post-hoc tests on only a small set of candidate features (e.g., using the function tcareg), without the need to run tca again for fitting the model to the candidate features.

Value

A list with the estimated parameters of the model for the given set of features.

W

Equals to tca.mdl$W

mus_hat

A q by k matrix which is a subset of the matrix tca.mdl$mus_hat, where q is the number of features in the argument features.

sigmas_hat

A q by k matrix which is a subset of the matrix tca.mdl$sigmas_hat, where q is the number of features in the argument features.

tau_hat

Equals to tca.mdl$tau_hat

gammas_hat

A q by k*p1 matrix which is a subset of the matrix tca.mdl$gammas_hat, where q is the number of features in the argument features.

deltas_hat

A q by p2 matrix which is a subset of the matrix tca.mdl$deltas_hat, where q is the number of features in the argument features.

gammas_hat_pvals

A q by k*p1 matrix which is a subset of the matrix tca.mdl$gammas_hat_pvals, where q is the number of features in the argument features. Note that if tca.mdl$gammas_hat_pvals == NULL then gammas_hat_pvals is also set to NULL.

gammas_hat_pvals.joint

A q by p1 matrix which is a subset of the matrix tca.mdl$gammas_hat_pvals.joint, where q is the number of features in the argument features. Note that if tca.mdl$gammas_hat_pvals.joint == NULL then gammas_hat_pvals is also set to NULL.

deltas_hat_pvals

A q by p2 matrix which is a subset of the matrix tca.mdl$deltas_hat_pvals, where q is the number of features in the argument features. Note that if tca.mdl$deltas_hat_pvals == NULL then deltas_hat_pvals is also set to NULL.

Examples

1
2
3
4
5
6
7
data <- test_data(50, 20, 3, 0, 0, 0.01)
tca.mdl <- tca(X = data$X, W = data$W)
tca.mdl.subset <- tcasub(tca.mdl, rownames(data$X)[1:10])
y <- matrix(rexp(50, rate=.1), ncol=1)
rownames(y) <- rownames(data$W)
# run tcareg test with an outcome y:
res <- tcareg(data$X[1:10,], tca.mdl.subset, y, test = "joint")

TCA documentation built on Feb. 15, 2021, 1:07 a.m.