estimate_betas.fmri_dataset: #' @export estimate_betas.fmri_mem_dataset <-...

View source: R/fmri_betas.R

estimate_betas.fmri_datasetR Documentation

#' @export estimate_betas.fmri_mem_dataset <- function(x,fixed=NULL, ran, block, method=c("mixed", "pls", "pls_searchlight", "pls_global", "ols"), basemod=NULL, radius=8, niter=8, ncomp=4, lambda=.01,...) estimate_betas.fmri_dataset(x,fixed,ran,block, method, basemod, radius, niter,ncomp, lambda,...) Estimate betas for an fMRI dataset

Description

This function estimates betas (regression coefficients) for fixed and random effects in an fMRI dataset using various methods.

Usage

## S3 method for class 'fmri_dataset'
estimate_betas(
  x,
  fixed = NULL,
  ran,
  block,
  method = c("mixed", "pls", "pls_searchlight", "pls_global", "ols"),
  basemod = NULL,
  radius = 8,
  niter = 8,
  ncomp = 4,
  lambda = 0.01,
  ...
)

Arguments

x

An object of class fmri_dataset representing the fMRI dataset

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_searchlight", "pls_global", or "ols" (default: "mixed")

basemod

A baseline_model instance to regress out of data before beta estimation (default: NULL)

radius

The radius in mm for the pls_searchlight approach (default: 8)

niter

Number of searchlight iterations for the "pls_searchlight" method (default: 8)

ncomp

Number of PLS components for the "pls", "pls_searchlight", and "pls_global" methods (default: 4)

lambda

Lambda parameter (not currently used; default: 0.01)

...

Additional arguments passed to the estimation method

Details

The method argument allows for several beta estimation approaches:

  • "mixed": Uses a linear mixed-effects modeling of trialwise random effects as implemented in the rrBLUP package.

  • "pls": Uses separate partial least squares for each voxel to estimate trialwise betas.

  • "pls_searchlight": Estimates PLS solutions over searchlight windows and averages the beta estimates.

  • "pls_global": Estimates a single multiresponse PLS solution, where the Y matrix is the full data matrix.

  • "ols": Ordinary least squares estimate of betas – no regularization.

Value

A list of class "fmri_betas" containing the following components:

  • betas_fixed: NeuroVec object representing the fixed effect betas

  • betas_ran: NeuroVec object 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

  • basemod: Baseline model object

  • fixed_model: Fixed effect model object

  • ran_model: Random effect model object

See Also

fmri_dataset, baseline_model

Examples

facedes <- read.table(system.file("extdata", "face_design.txt", package = "fmrireg"), header=TRUE)
facedes$frun <- factor(facedes$run)
scans <- paste0("rscan0", 1:6, ".nii")

dset <- fmri_dataset(scans=scans,mask="mask.nii",TR=1.5,run_length=rep(436,6),event_table=facedes)
fixed = onset ~ hrf(run)
ran = onset ~ trialwise()
block = ~ run

betas <- estimate_betas(dset, fixed=fixed, ran=ran, block=block 

bbuchsbaum/fmrireg documentation built on May 16, 2023, 10:56 a.m.