TCA (version 1.0.0)

tcasub: Subsetting features from a TCA model

Description

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

Usage

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

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.

debug

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

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.

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.

Examples

Run this code
# NOT RUN {
data <- test_data(50, 20, 3, 0, 0, 0.01)
tca.mdl <- tca(data$X, data$W)
tca.mdl.subset <- tcasub(tca.mdl, rownames(data$X)[1:10])
y <- matrix(rexp(50, rate=.1), ncol=1)
# run tcareg test with an outcome y:
res <- tcareg(data$X[1:10,], tca.mdl.subset, y, test = "joint", save_results = FALSE)

# }

Run the code above in your browser using DataLab