R/05_lfsr.R
min_lfsr_summary.Rd
This function computes the minimum LFSR for each dataset in a fash
object using
the posterior mean and variance instead of sampling-based methods.
min_lfsr_summary(object, smooth_var = NULL, num_cores = 1, deriv = 0)
A fash
object containing the fitted results.
A numeric vector specifying refined x values for evaluation.
If NULL
, defaults to the dataset's original x values.
An integer specifying the number of cores to use for parallel processing.
An integer specifying the order of the derivative to compute.
A data frame containing:
The dataset index.
The minimum LFSR computed for each dataset.
The cumulative false sign rate (FSR).
# Example usage
set.seed(1)
data_list <- list(
data.frame(y = rpois(5, lambda = 5), x = 1:5, offset = 0),
data.frame(y = rpois(5, lambda = 5), x = 1:5, offset = 0)
)
grid <- seq(0, 2, length.out = 10)
fash_obj <- fash(data_list = data_list, Y = "y", smooth_var = "x", grid = grid, likelihood = "poisson", verbose = TRUE)
#> Starting data setup...
#> Completed data setup in 0.00 seconds.
#> Starting likelihood computation...
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
#> Completed likelihood computation in 0.15 seconds.
#> Starting empirical Bayes estimation...
#> Completed empirical Bayes estimation in 0.00 seconds.
#> fash object created successfully.
# Compute min LFSR for all datasets sequentially
result <- min_lfsr_summary(fash_obj, num_cores = 1)
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
print(result)
#> index min_lfsr fsr
#> 1 1 1 1
#> 2 2 1 1
# Compute min LFSR for all datasets in parallel
result_parallel <- min_lfsr_summary(fash_obj, num_cores = 2)
print(result_parallel)
#> index min_lfsr fsr
#> 1 1 1 1
#> 2 2 1 1