Processes the tmbdat object for a specific dataset, using the provided smoothing variables, standard errors, and precision matrix. This function generates spline basis matrices, penalty matrices, and other quantities required for modeling.

fash_set_tmbdat(
  data_i,
  Si = NULL,
  Omegai = NULL,
  num_basis = 30,
  betaprec = 1e-06,
  order = 2
)

Arguments

data_i

A single dataset extracted from the data_list component of fash_set_data. Must be a list containing y, x, and offset.

Si

A numeric vector representing the standard errors for the dataset.

Omegai

A numeric precision matrix for the dataset.

num_basis

An integer specifying the number of O-Spline basis functions to use for the approximation.

betaprec

A numeric value representing the precision of the fixed effects coefficients.

order

An integer specifying the order of the Integrated Wiener Process (IWP) prior.

Value

A list formatted as a tmbdat object, containing:

y

A numeric vector of response variables for the dataset.

X

A sparse matrix representing the design matrix for fixed effects.

P

A sparse matrix representing the penalty matrix for the spline coefficients.

B

A sparse matrix representing the design matrix for random effects.

offset

A numeric vector of offsets for the dataset.

logPdet

The log determinant of the penalty matrix.

betaprec

The precision for the fixed effects coefficients.

S

The standard errors for the dataset, if provided as Si.

Omega

The precision matrix for the dataset as a sparse matrix, if provided as Omegai.

log_det_Omega

The log determinant of the precision matrix, if Omegai is provided.

Examples

# Example usage
set.seed(1)
Y <- matrix(rnorm(20), nrow = 4, ncol = 5)
smooth_var <- matrix(runif(20), nrow = 4, ncol = 5)
offset <- 1
S <- c(0.5, 0.8, 1.2, 1.0, 0.9)
Omega <- diag(5)
data <- fash_set_data(Y, smooth_var, offset, S, Omega)
tmbdat <- fash_set_tmbdat(data$data_list[[1]], Si = S[[1]], Omegai = Omega)