Synthetic data
From Poldracklab Wiki
It is often useful to create synthetic fMRI datasets, in order to test analysis approaches to ensure that they are behaving as expected. I have created a MATLAB program called fakedata.m that provides this functionality. The usage is as follows:
[data]=fakedata(files,noise_sd,roi,desmtx,beta,smoothing,filestem,ar_weight)
function to create a timeseries based on a single image
with signal injected according to a particular design matrix and parameters
requires SPM2/99 in the matlab path (may work with spm5, but has not been tested)
arguments:
files - the basis file for the timeseries (usually a single 3D fMRI image)
- if [] is passed, a gui window will appear to allow choice of files
noise_sd - SD of gaussian noise, as a % of mean signal
roi - the region to inject the signal into can be specified in two ways:
1 - name of a mask file that specifies the voxels into which the
signal should be injected - this mask can be binary or can be
continuous with max of 1
2 - a 1 X 4 vector containing an MNI location and radius
(e.g., [-32 12 20 5] for a 5mm sphere at [-32 12 20]
NB: THIS WILL LIKELY CRASH UNLESS THE BASE IMAGE IS IN MNI SPACE
desmtx - design matrix for signal injection (e.g. xX.X from SPM.mat)
- desmtx is N x C matrix (N=% observations by C=% regressors)
beta - matrix of weightings for each column of design matrix
- beta is C x 1 matrix (C=% of regressors)
smoothing - FWHM of spatial smoothing filter to apply to the signal
before injection (will write smoothed version of mask to disk)
if smoothing is not specified, default is no smoothing
filestem - stem for filename for synthetic data files
(set to [] to prevent creating output files)
ar_weight - optional parameter for AR1 model, takes values from 0-1,
- higher parameter results in greater temporal autocorrelation
- default is 0.7, which gives a reasonable falloff
This creates a timeseries with signal injected as specified by the design matrix and beta matrix.
