vignettes/baseline_model.Rmd
baseline_model.Rmd
An “baseline model” refers to the set of regressors used to capture variance associated with noise signals in the fMRI time-series data. These regressors are not formed by convolving a hemodynamic response with event onsets, but rather directly model sources of variance in the data. Low-frequency baseline trends are often modeled with a set of basis functions, such as b-splines, polynomial regressors, or a Fourier basis. Nuisance trends can also be derived from the data itself, for example, the global signal mean, motion parameters, or estimated noise components via PCA or ICA.
TR <- 2
sframe <- sampling_frame(blocklens=c(100,100), TR)
bmodel <- baseline_model(basis="bs", degree=5, sframe=sframe)
## [1] "baseline_bs_5 : matrix"
## baseline_model
## name: baseline_bs_5
## basis type: bs
## degree: 5
## drift columns: 10
## constant columns: 2
## nuisance columns: 0
## total columns: 12
## design_matrix:
## # A tibble: 200 x 12
## constant_1 constant_2 base_bs1_block_1 base_bs2_block_1 base_bs3_block_1
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 0 0 0 0
## 2 1 0 0.0485 0.000990 0.0000101
## 3 1 0 0.0931 0.00384 0.0000792
## 4 1 0 0.134 0.00837 0.000262
## 5 1 0 0.171 0.0144 0.000607
## 6 1 0 0.205 0.0218 0.00116
## 7 1 0 0.236 0.0304 0.00196
## 8 1 0 0.264 0.0401 0.00305
## 9 1 0 0.288 0.0507 0.00446
## 10 1 0 0.310 0.0621 0.00621
## # … with 190 more rows, and 7 more variables: base_bs4_block_1 <dbl>,
## # base_bs5_block_1 <dbl>, base_bs1_block_2 <dbl>,
## # base_bs2_block_2 <dbl>, base_bs3_block_2 <dbl>,
## # base_bs4_block_2 <dbl>, base_bs5_block_2 <dbl>
## [1] "baseline_poly_5 : matrix"
In addition to structured basis sets, we can also add arbitrary signals to the baseline model. Such signals are also organized by block on the assumption that nuisance signals are often block-specific and “reset” across scans. To add a set of nusiance variables to the baseline model, then, they should be split by block and placed in a list
.
TR <- 2
sframe <- sampling_frame(blocklens=c(100,100), TR)
## generate two arbitrary nusiance signals.
nuis1 <- rnorm(100*2)
nuis2 <- rnorm(100*2)
## construct a set of data.frames, each with two columns (nuis1 and nuis2)
nuislist <- split(as.data.frame(cbind(nuis1, nuis2)), blockids(sframe))
bmodel <- baseline_model(basis="bs", degree=5, sframe=sframe, nuisance_list=nuislist)
## [1] "baseline_bs_5 : matrix"
## [1] "nuisance : dgCMatrix"
## $constant
## fmri_term: block_term
## Term Name: constant
## Num Rows: 200
## Num Columns: 2
##
## $baseline_bs_5
## fmri_term: baseline_term
## Term Name: baseline_bs_5
## Num Rows: 200
## Num Columns: 10
##
## $nuisance
## fmri_term: baseline_term
## Term Name: nuisance
## Num Rows: 200
## Num Columns: 4