Skip to contents

This function performs robust estimation of slope and intercept matrices based on residuals from a signal reconstruction model. It bins the data using either absolute or percentile-based methods, computes robust covariance matrices for each bin, and fits robust linear models to estimate the relationship between covariance values and bin midpoints.

Usage

SlopEstimation(
  Res,
  count_thre,
  bin_num = 30,
  bin_method = "percentile",
  z_thre = 3,
  ...
)

Arguments

Res

A result object created by CreateRes, containing raw signal matrix R, unmixing matrix A, and detector information.

count_thre

An integer specifying the minimum number of data points required in a bin to perform covariance estimation.

bin_num

An integer specifying the number of bins to divide the data into. Default is 30.

bin_method

A character string specifying the binning method. Must be either "absolute" or "percentile". Default is "percentile".

z_thre

A numeric threshold for removing outliers based on z-scores of the first column of matrix B. Default is 3.

...

Additional arguments passed to internal functions (currently unused).

Value

The updated Res object with the following fields added:

bin_mids

Midpoints of each bin used for slope estimation.

bin_counts

Number of data points in each bin.

cov_matrices

Robust covariance matrices computed for each bin.

interceptMtx

Matrix of intercepts estimated from robust linear models.

slopMtx

Matrix of slopes estimated from robust linear models.

par

A list containing binning parameters used in the estimation.

Examples

if (FALSE) { # \dontrun{
Res <- CreateRes("F1", R, A)
Res <- SlopEstimation(Res, count_thre = 30, bin_num = 30, bin_method = "percentile")
} # }