This function performs the full FASH pipeline, including data setup, likelihood computation,
empirical Bayes estimation, and outputs a structured fash
object.
fash(
Y = NULL,
smooth_var = NULL,
offset = 0,
S = NULL,
Omega = NULL,
data_list = NULL,
grid = seq(0, 2, length.out = 10),
likelihood = "gaussian",
num_basis = 30,
betaprec = 1e-06,
order = 2,
pred_step = 1,
penalty = 1,
num_cores = 1,
verbose = FALSE
)
Either a numeric matrix of response variables or a character string specifying the column name in data_list
for response variables.
A numeric matrix, vector, or a character string specifying the column name in data_list
for smoothing variables.
A numeric matrix, vector, scalar, or a character string specifying the column name in data_list
for offset variables.
A numeric matrix, vector, scalar, or list representing the standard errors of Y
. Or a character string specifying the column name in data_list
for SD.
Either a list of precision matrices (one for each dataset) or a single precision matrix (shared across all datasets).
A list of data frames, where each data frame corresponds to a single dataset.
A numeric vector representing the grid of PSD (Predictive Standard Deviation) values.
A character string specifying the likelihood function to use. Options are `gaussian` and `poisson`.
An integer specifying the number of O-Spline basis functions.
A numeric value representing the precision of the fixed effects coefficients.
An integer specifying the order of the Integrated Wiener Process (IWP) prior.
A numeric value specifying the prediction step size.
A numeric value representing the lambda value for the Dirichlet prior.
An integer specifying the number of cores to use for parallel processing.
A logical value. If TRUE
, shows progress messages and timing for each step.
A fash
object containing:
prior_weights
Estimated prior weights for PSD values.
posterior_weights
Posterior weight matrix of PSD values.
psd_grid
PSD grid values.
lfdr
Local false discovery rate for each dataset.
settings
A list of settings used in the FASH pipeline.
fash_data
A structured list of data components.
L_matrix
Likelihood matrix used in the FASH pipeline.
eb_result
Empirical Bayes estimation results.
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)
result <- fash(data_list = data_list, Y = "y", smooth_var = "x", offset = "offset", 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.14 seconds.
#> Starting empirical Bayes estimation...
#> Completed empirical Bayes estimation in 0.00 seconds.
#> fash object created successfully.
print(result)
#> Fitted fash Object
#> -------------------
#> Number of datasets: 2
#> Likelihood: poisson
#> Number of PSD grid values: 10 (initial), 1 (non-trivial)
#> Order of Integrated Wiener Process (IWP): 2