estimate_betas | R Documentation |
Estimate beta coefficients (regression parameters) from fMRI data using various methods. This function supports different estimation approaches for:
Single-trial beta estimation
Fixed and random effects
Various regularization techniques
Optional HRF estimation
This function estimates betas (regression coefficients) for fixed and random effects in a matrix dataset using various methods.
estimate_betas(x, ...)
## S3 method for class 'latent_dataset'
estimate_betas(
x,
fixed = NULL,
ran,
block,
method = c("mixed", "pls", "pls_global", "ols"),
basemod = NULL,
ncomp = 4,
lambda = 0.01,
prewhiten = FALSE,
...
)
x |
An object of class |
... |
Additional arguments passed to the estimation method |
fixed |
A formula specifying the fixed regressors that model constant effects (i.e., non-varying over trials) |
ran |
A formula specifying the random (trialwise) regressors that model single trial effects |
block |
A formula specifying the block factor |
method |
The regression method for estimating trialwise betas; one of "mixed", "pls", "pls_global", or "ols" (default: "mixed") |
basemod |
A |
ncomp |
Number of PLS components for the "pls" and "pls_global" methods (default: 4) |
lambda |
Lambda parameter (not currently used; default: 0.01) |
prewhiten |
currently experimental, default to |
This is a generic function with methods for different dataset types:
For volumetric fMRI data
For matrix-format data
For dimensionality-reduced data
Available estimation methods include:
Mixed-effects model using rrBLUP
Rank-1 GLM with joint HRF estimation
Least-squares separate estimation
Partial least squares regression
Ordinary least squares
Fractional ridge regression
A list of class "fmri_betas" containing:
Fixed effect coefficients
Random (trial-wise) coefficients
Design matrix for random effects
Design matrix for fixed effects
Design matrix for baseline model
Additional components specific to the estimation method used
A list of class "fmri_betas" containing the following components:
betas_fixed: Matrix representing the fixed effect betas
betas_ran: Matrix representing the random effect betas
design_ran: Design matrix for random effects
design_fixed: Design matrix for fixed effects
design_base: Design matrix for baseline model
Mumford, J. A., et al. (2012). Deconvolving BOLD activation in event-related designs for multivoxel pattern classification analyses. NeuroImage, 59(3), 2636-2643.
Pedregosa, F., et al. (2015). Data-driven HRF estimation for encoding and decoding models. NeuroImage, 104, 209-220.
fmri_dataset
, matrix_dataset
, latent_dataset
matrix_dataset
, baseline_model
Other estimate_betas:
estimate_betas.matrix_dataset()
# Create example data
event_data <- data.frame(
condition = factor(c("A", "B", "A", "B")),
onsets = c(1, 10, 20, 30),
run = c(1, 1, 1, 1)
)
# Create sampling frame and dataset
sframe <- sampling_frame(blocklens = 50, TR = 2)
dset <- matrix_dataset(
matrix(rnorm(100 * 2), 100, 2),
TR = 2,
run_length = 50,
event_table = event_data
)
# Estimate betas using mixed-effects model
betas <- estimate_betas(
dset,
fixed = onset ~ hrf(condition),
ran = onset ~ trialwise(),
block = ~run,
method = "mixed"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.