NiftiResponseFytter¶
-
class
nideconv.nifti.
NiftiResponseFitter
(func_img, sample_rate, mask=None, oversample_design_matrix=20, add_intercept=True, detrend=False, standardize=False, confounds_for_extraction=None, memory=None, **kwargs)[source]¶ Methods
add_confounds
(self, name, confound)Add a timeseries or set of timeseries to the general design matrix as a confound add_event
(self, event_name[, onsets, …])create design matrix for a given event_type. fit
(self[, type, cv, alphas, store_residuals])Regress a created design matrix on the input_data. get_epochs
(self, onsets, interval[, …])Return a matrix corresponding to specific onsets, within a given interval. get_rsq
(self)calculate the rsq of a given fit. predict_from_design_matrix
(self[, X])predict a signal given a design matrix. ridge_regress
(self, \*args, \*\*kwargs)run CV ridge regression instead of ols fit. add_intercept get_basis_functions get_original_signal get_residuals get_standard_errors_timecourse get_t_value_timecourses get_time_to_peak get_timecourses plot_design_matrix plot_model_fit plot_timecourses -
add_confounds
(self, name, confound)¶ Add a timeseries or set of timeseries to the general design matrix as a confound
Parameters: - confound : array
Confound of (n_timepoints) or (n_timepoints, n_confounds)
-
add_event
(self, event_name, onsets=None, basis_set='fir', interval=[0, 10], n_regressors=None, durations=None, covariates=None, **kwargs)¶ create design matrix for a given event_type.
Parameters: - event_name : string
Name of the event_type, used as key to lookup this event_type’s characteristics
- **kwargs : dict
keyward arguments to be internalized by the generated and internalized Event object. Needs to consist of the necessary arguments to create an Event object, see Event constructor method.
-
fit
(self, type='ols', cv=20, alphas=None, store_residuals=False)¶ Regress a created design matrix on the input_data.
Creates internal variables betas, residuals, rank and s. The beta values are then injected into the event_type objects the ResponseFitter contains.
Parameters: - type : string, optional
the type of fit to be done. Options are ‘ols’ for np.linalg.lstsq, ‘ridge’ for CV ridge regression.
-
get_epochs
(self, onsets, interval, remove_incomplete_epochs=True)¶ Return a matrix corresponding to specific onsets, within a given interval. Matrix size is (n_onsets, n_timepoints_within_interval).
Note that any events that are in the ResponseFitter-object will be regressed out before calculating the epochs.
-
get_rsq
(self)[source]¶ calculate the rsq of a given fit. calls predict_from_design_matrix to predict the signal that has been fit
-