This function takes a matrix of predictors (X) and a list of TWAS (transcriptome-wide
association studies) weights (weightsList), and calculates the predicted outcomes by
multiplying X by each set of weights in weightsList. The names of the elements
in the output list are derived from the names in weightsList, with "_weights" replaced
by "_predicted".
Arguments
- X
A matrix or data frame of predictors where each row is an observation and each column is a variable.
- weightsList
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 weightsList. The names of the list elements are
derived from the names in weightsList by replacing "_weights" with "_predicted".
Examples
# Assuming `X` is your matrix of predictors and `weightsList` is your list of weights:
predicted_outcomes <- twasPredict(X, weightsList)
#> Error: object 'weightsList' not found
print(predicted_outcomes)
#> Error: object 'predicted_outcomes' not found