construct a baseline model to model noise and other non-event-related sources of variance
Source:R/baseline_model.R
baseline_model.Rd
construct a baseline model to model noise and other non-event-related sources of variance
Arguments
- basis
the basis function type
- degree
the degree of the spline function.
- sframe
sframe a
sampling_frame
object- intercept
whether to include an intercept for each block. Automatically set to
FALSE
when basis == "constant".- nuisance_list
a list of nuisance matrices, one matrix per fMRI block
Examples
## bspline basis with degree = 3. This will produce a design matrix with three
## splines regressor and a constant intercept.
sframe <- sampling_frame(blocklens=c(100,100), TR=2)
bmod <- baseline_model(basis="bs", degree=3, sframe=sframe)
bmod_global <- baseline_model(basis="bs", degree=3,
sframe=sframe, intercept="global")
bmod_nointercept <- baseline_model(basis="bs", degree=3,
sframe=sframe, intercept="none")
stopifnot(ncol(design_matrix(bmod)) == 8)
stopifnot(ncol(design_matrix(bmod_global)) == 7)
stopifnot(ncol(design_matrix(bmod_nointercept)) == 6)
## polynomial with no intercept term
bmod <- baseline_model(basis="poly", degree=3, sframe=sframe, intercept="none")
## a baseline model that only has dummy-coded intercept terms, one per block,
## i.e. to model runwise mean shifts only.
bmod <- baseline_model(basis="constant", degree=1, sframe=sframe)
## global intercept only
bmod <- baseline_model(basis="constant", degree=1, sframe=sframe, intercept="global")
## add an arbitrary nuisance matrix with two columns, i.e. motion regressors,
## physiological noise, etc.
nuismat <- matrix(rnorm(100*2), 100, 2)
bmod <- baseline_model(basis="bs", degree=3, sframe=sframe,
nuisance_list=list(nuismat, nuismat))
stopifnot(ncol(design_matrix(bmod)) == 12)