Skip to contents

This function takes a matrix of predictors (X) and a list of TWAS (transcriptome-wide association studies) weights (weights_list), and calculates the predicted outcomes by multiplying X by each set of weights in weights_list. The names of the elements in the output list are derived from the names in weights_list, with "_weights" replaced by "_predicted".

Usage

twas_predict(X, weights_list)

Arguments

X

A matrix or data frame of predictors where each row is an observation and each column is a variable.

weights_list

A list of numeric vectors representing the weights for each predictor. The names of the list elements should follow the pattern [outcome]_weights, where [outcome] is the name of the outcome variable that the weights are associated with.

Value

A named list of numeric vectors, where each vector is the predicted outcome for the corresponding set of weights in weights_list. The names of the list elements are derived from the names in weights_list by replacing "_weights" with "_predicted".

Examples

# Assuming `X` is your matrix of predictors and `weights_list` is your list of weights:
predicted_outcomes <- twas_predict(X, weights_list)
#> Error: object 'weights_list' not found
print(predicted_outcomes)
#> Error: object 'predicted_outcomes' not found