afni_lm: Set up an fMRI linear model for AFNI's 3dDeconvolve

View source: R/afni.R

afni_lmR Documentation

Set up an fMRI linear model for AFNI's 3dDeconvolve

Description

This function prepares an fMRI linear model for AFNI's 3dDeconvolve tool. It takes an fmri_model object, an fmri_dataset object, and various options to control the fitting process.

Usage

afni_lm(
  fmri_mod,
  dataset,
  working_dir = ".",
  polort = -1,
  jobs = 1,
  censor = NULL,
  options = list()
)

Arguments

fmri_mod

An fmri_model object containing the event and baseline models

dataset

An fmri_dataset object containing the scan data and other necessary information

working_dir

The working directory (default is the current directory)

polort

The number of polynomial baseline regressors (default is to suppress 'polort')

jobs

The number of jobs to use with '3dDeconvolve' (default is 1)

censor

A list of censoring vectors, one per run, or a single vector equal to the total number of scans (default is NULL)

options

A list of options to be sent to 3dDeconvolve (default is an empty list)

Value

An afni_lm_spec object containing the fitted model, dataset, working directory, options, and command

Examples

etab <- data.frame(onset=c(1,30,15,25), fac=factor(c("A", "B", "A", "B")), 
run=c(1,1,2,2))
dset <- fmri_dataset(scans=c("s1.nii", "s2.nii"), mask="mask.nii", TR=1, 
run_length=c(50,50), event_table=etab)

emodel <- event_model(onset ~ hrf(fac), block = ~ run, data=etab, 
sampling_frame=dset$sampling_frame)
bmodel <- baseline_model("bs", degree=4, sframe=dset$sampling_frame)
fmod <- fmri_model(emodel, bmodel)
alm <- afni_lm(fmod, dset, jobs=2, options=list(tout=TRUE, errts="residuals.nii.gz"))

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