fmri_lm | R Documentation |
This function fits a linear regression model for fMRI data analysis using the specified model formula, block structure, and dataset. The model can be fit using either a runwise or chunkwise data splitting strategy, and robust fitting can be enabled if desired.
fmri_lm(
formula,
block,
baseline_model = NULL,
dataset,
durations = 0,
drop_empty = TRUE,
robust = FALSE,
strategy = c("runwise", "chunkwise"),
nchunks = 10,
...
)
formula |
The model formula for experimental events. |
block |
The model formula for block structure. |
baseline_model |
(Optional) A |
dataset |
An |
durations |
A vector of event durations. Default is |
drop_empty |
Logical. Whether to remove factor levels with zero size. Default is |
robust |
Logical. Whether to use robust fitting. Default is |
strategy |
The data splitting strategy, either |
nchunks |
Number of data chunks when strategy is |
... |
Additional arguments. |
A fitted linear regression model for fMRI data analysis.
fmri_dataset
, fmri_lm_fit
facedes <- subset(read.table(system.file("extdata", "face_design.txt", package = "fmrireg"),
header=TRUE), face_gen != "n/a")
facedes$face_gen <- droplevels(factor(facedes$face_gen))
sframe <- sampling_frame(rep(430/2,6), TR=2)
ev <- event_model(onset ~ hrf(face_gen, basis="gaussian"), data=facedes,
block= ~ run, sampling_frame=sframe)
globonsets <- global_onsets(sframe, facedes$onset, blockids(ev))
reg1_signal <- regressor(globonsets[facedes$face_gen == "male"], hrf=HRF_GAUSSIAN)
reg2_signal <- regressor(globonsets[facedes$face_gen == "female"], hrf=HRF_GAUSSIAN)
time <- samples(sframe, global=TRUE)
y1 <- evaluate(reg1_signal, time)*1.5
y2 <- evaluate(reg2_signal, time)*3.0
y <- y1+y2
ys1 <- y + rnorm(length(y), sd=.02)
ys2 <- y + rnorm(length(y), sd=.02)
h <<- gen_hrf(hrf_bspline, N=7, span=25)
dset <- matrix_dataset(cbind(ys1,ys2), TR=2, run_length=sframe$blocklens, event_table=facedes)
flm <- fmri_lm(onset ~ hrf(face_gen, basis=gen_hrf(hrf_bspline, N=7, span=25)), block = ~ run,
strategy="chunkwise", nchunks=1, dataset=dset)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.