Skip to contents

This function calculates predicted values based on the provided methyl_surro object. If any probes (rows) are completely missing, their values are set to zero, and a count of these probes is stored. Columns (samples) with any missing values are removed, and a count of these is also recorded. The function aligns and multiplies the weights with the methylation matrix, adds the intercept if specified, and applies the specified transformation to the results.

Usage

surro_calc(methyl_surro, transform = c("linear", "count", "probability"))

Arguments

methyl_surro

An object of class methyl_surro.

transform

A character string specifying the transformation to apply. It can be "linear", "count", or "probability".

Value

A named vector of predicted values with names corresponding to the sample names in the methylation matrix.

Examples

# Load \code{methyl_surro} Object
data(beta_matrix_comp, package = "MethylSurroGetR")

# Generating Surrogate Estimates from Linear Model Weights
pred_lin <- surro_calc(methyl_surro = methyl_surro_comp,
                       transform = "linear")
print(pred_lin)
#>    samp1    samp2    samp3    samp4    samp5 
#> 1.197718 1.200473 1.206967 1.199796 1.198156