src.uf_toolbox.
uf_designmat
(EEG, varargin)Parameters: 


Returns:  Returns the EEG structure with the additional fields in EEG.unfold

Return type:  EEGstruct 
src.uf_toolbox.
uf_timeexpandDesignmat
(EEG, varargin)Parameters: 


Returns: 

src.uf_toolbox.
uf_glmfit
(EEG, varargin)Parameters: 


Returns:  array (nchan x ntime x npred) (ntime could be ntimesplines, nfourierbasis or samples) 
Return type:  EEG.unfold.beta 
src.uf_toolbox.
uf_condense
(EEG, varargin)Condense results in new structure. Apply timebasis (if necessary). Returns an “ufresult”structure that contains the predictor betas over time and accompanying information. This structure is further used in all plotting functions. This function also applies the time basis (if you specified something else than the default ‘stick’ in uf_timeexpandDesignmat() )
Parameters: 


Returns:  ufresult.beta= (nchans x time x parameters) ufresult.beta_nodc = (nchans x time x parameters) (only if unfold=0 or 1) ufresult.param = (struct size: parameters) each field contains the values of the respective parameter. ufresult.unfold = EEG.unfold ufresult.times = EEG.times ufresult.chanlocs = EEG.chanlocs 
Example:
ufresult = uf_condense(EEG)
ufresult.param(X): * name: name of the variable, e.g.: ‘continuousA’ * value: value of the predictor, e.g. ‘50’ * event: event of the variable, e.g.: ‘eventA’
src.uf_toolbox.
uf_continuousArtifactDetect
(EEG, varargin)Reject commonly recorded artifactual potentials (c.r.a.p.)
Note: This is an ERPLAB function that was heavily altered by Benedikt Ehinger to be included in the unfold toolbox. In particular, I removed all the filterfeatures and changed the input parser. Please cite the ERPLAB toolbox if you use this function (reference below). Benedikt Ehinger & Olaf Dimigen
There are a number of common artifacts that you will see in nearly every EEG data file. These include eyeblinks, slow voltage changes (caused mostly by skin potentials), muscle activity (from moving the head or tensing up the muscles in the face or neck), horizontal eye movements, and various types of C.R.A.P. (Commonly Recorded Artifactual Potentials).
Although we usually perform artifact rejection on the segmented data, it’s a good idea to examine the raw unsegmented EEG data first. You can usually identify patterns of artifacts, make sure there were no errors in the file, etc., more easily with the raw data [1].
crap.m allows you to automatically identify large peaktopeak differences or extreme amplitude values, within a moving window, across your continuous EEG dataset. After performing crap.m, artifactual segments will be rejected and replaced by a ‘boundary’ event code.
Parameters: 


Example
winrej = uf_continuousArtifactDetect(EEG)
ERP Boot Camp: Data Analysis Tutorials. Emily S. Kappenman, Marissa L. Gamble, and Steven J. Luck. UC Davis
This function is part of ERPLAB Toolbox Author: Javier LopezCalderon Center for Mind and Brain University of California, Davis, Davis, CA 2009
src.uf_toolbox.
uf_continuousArtifactExclude
(EEG, varargin)Parameters: 


Returns:  EEGStructure * unfold.X: All elements between the fromto pairs got set to 0 
src.uf_toolbox.
uf_epoch
(EEG, varargin)Parameters: 


Returns:  Epoched EEG file to cfg.timelimits 
src.uf_toolbox.
uf_glmfit_nodc
(EEG, varargin)Simple function to do massive univariate linear model. The function expects EEG.data to be (CHAN,TIME,EPOCH) with EPOCH the same number as EEG.unfold.X.
It is recommended to use uf_epoch for epoching, because you need to remove rows from EEG.unfold.X if the epoching function removed trials. Also cleaning of data is taken care of in uf_epoch
Parameters:  cfg.method – (default pinv) ‘glmnet’,’pinv’,’matlab’,’lsmr’ are available. See the uf_glmfit function for further information. By making use of pinv, the linear model needs to be solved only once and can be applied to all electrodes. The other solves iteratively solve for each electtrode. 

Returns:  Returns a matrix (channel x pnts x predictors) of betas saved into EEG.devon.beta 
src.uf_toolbox.
uf_imputeMissing
(EEG, varargin)Parameters:  cfg.method –


Returns:  EEG.unfold.X in which missing NANvalues were imputed (‘marginal’, ‘mean’, ‘median’) or in which the events with missing predictor information were removed (‘drop’), which means put to 0 
Example
EEG = uf_imputeMissing(EEG)
src.uf_toolbox.
uf_designmat_addcol
(EEG, newcol, label)Parameters: 


Returns:  EEGStruct * unfold.Xdc added column * unfold.colnames added label 
src.uf_toolbox.
uf_designmat_spline
(EEG, varargin)Helper function to generate splinepart of designmatrix
Returns: 
spl: Same as EEG.unfold.spline{end} nanlist: the paramValues that were nan (same as ‘isnan(spl.paramValues)’ ) 

Example
EEG = dc_designmat_spline(EEG,’name’,’splineA’,’paramValues’,[EEG.event.splineB],’nsplines’,10,’splinespacing’,’linear’); EEG = dc_designmat_spline(EEG,’name’,’splineB’,’paramValues’,[EEG.event.splineB],’knotsequence’,linspace(0,2*pi,15),’splinefunction’,’cyclical’);
src.uf_toolbox.
uf_predictContinuous
(ufresult, varargin)This is similar to a predict function, but does not add the marginal of the other parameters. For this please make use of uf_addmarginals().
Because modelestimates / parameters are defined for each timepoint and electrode and can also encompass multiple betas (in the case of spline predictors), this becomes non trivial and thus this function. Note that this will overwrite the ufresult.beta field
Parameters: 


Returns:  Betas with evaluated betas at specified continuous values. 
You calculated for a continuous variable “parameterA” a beta of 3. You want to know what the predicted signal of parameterA = [10,20,30] is. You call the function:
ufresult = uf_predictContinuous(ufresult,’predictAt’,{{‘parameterA’,[10 20 30]}}
The output then would be the respective values 30,60 and 90.
src.uf_toolbox.
uf_addmarginal
(ufresult, varargin)add the marginal of the other predictors (i.e. continuous & spline predictors) to the beta estimates. Important: If dummycoded (i.e. noneffect coded) predictors and interactions exist, they are NOT added to the marginal effect. I.e. the output of the method returns the average ERP evaluated at the average of all spline/continuous predictors, keeping the categorical/interaction structure untouched.
Parameters: 


Example For instance the model 1 + cat(facA) + continuousB has the betas: intercept, facA==1, continuousBSlope
The beta output of uf_condense(uf_glmfit) mean the following: intercept: response with facA = 0 and continuousB = 0 facA==1 : differential effect of facA == 1 (against facA==0) continuousBslope: the slope of continous B
Using uf_predictContinuous, we evaluate the continuous parameter at [0 50 100] The beta output of uf_predictContinuous mean the following: intercept: same as before facA==1 : same as before continuousB@0 : the differential effect if continuous B is 0 continuousB@50 : the differential effect if continuous B is 50 continuousB@100: the differential effect if continuous B is 100
Using uf_addmarginal, the average response is added to all predictors.
intercept: the response of facA==0 AND continuousB@mean(continuousB) intercept: the response of facA==1 AND continuousB@mean(continuousB) continuousB@0 : the response of facA==0 if continuous B is 0 continuousB@50 : the response of facA==0 if continuous B is 50 continuousB@100: the response of facA==0 if continuous B is 100
Note that mean(continuousB) does not need to be a number we evaluated in the uf_predictContinuous step.
src.uf_toolbox.
uf_unfold2csv
(ufresult, varargin)Parameters: 


Returns:  Each observation (voltage/beta) has one row, channels, predictors etc. gets one column 
Return type:  DataTable in the “tidy”format 
Example
uftable = uf_unfold2csv(ufresult,’filename’,’output.csv’)
src.uf_toolbox.
uf_plotEventCorrmat
(EEG, varargin)Parameters: 


Returns:  correlationMatrix 
Example
uf_plotEventCorrmat(EEG)
src.uf_toolbox.
uf_plotEventHistogram
(EEG, varargin)Parameters:  cfg.eventtypes – Restrict the histogram to a specific eventtypes 

Return:
src.uf_toolbox.
uf_plotDesignmat
(EEG, varargin)Plots the designmatrix If the matrix is very large (the timeexpanded/Xdc matrix) we do not plot everything, but only the middle 60s. In addition (for timeexpand) we plot the events as horizontal lines.
Parameters: 


src.uf_toolbox.
uf_plotParam
(ufresult, varargin)predictor, where there are multiple lines for each predictor
‘ufresult’ needs to contain the ‘ufresult’ structure, the output from uf_condense()
Uses the ‘gramm’toolbox for plotting
Parameters: 


Returns:  All ‘subplot’ axes that were generated 
Return type:  allAxesInFigure 
src.uf_toolbox.
uf_plotParam2d
(ufresult, varargin)Parameters: 


Example: uf_plotParam2d(‘plotParam’,’continuosPredictorA’)
src.uf_toolbox.
uf_plotParamTopo
(ufresult, varargin)Parameters: 


Returns:  structure of all plotting axes. 
src.uf_toolbox.
uf_plot2nd
(d2nd, varargin)This function allows to plot multiple subjects at the same time the function requires the data to be in the following format: ufresult.beta(CHAN,TIME,PARAM,SUBJECT)
Each line is one subject, its possible to calculate confidence intervals
Parameters: 


Returns:  nothing 
Example
uf_plot2nd(ufresult2nd,’channel’,2)