Back to the main page.
Bug 3401 - ft_regressconfound produces p-values between 0 and 2
Status | ASSIGNED |
Reported | 2018-01-16 07:39:00 +0100 |
Modified | 2018-01-16 07:43:32 +0100 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P5 normal |
Assigned to: | Arjen Stolk |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Arjen Stolk - 2018-01-16 07:39:42 +0100
This function's main goal was never to compute statistics on the regression weights, but to remove variance attributed to a confound(s). However, there is an undocumented option cfg.statistics that allows calculating the statistical significance of each regressor. Yet, as title of this bug indicates, the output probabilities are typically between 0 and 2, instead of 0 and 1. @Eric, do you know what is wrong in this formulation? dfe = nrpt - nconf; % degrees of freedom err = dat - regr * beta; % err = Y - X * B mse = sum((err).^2)/dfe; % mean squared error covar = diag(regr'*regr)'; % regressor covariance bvar = repmat(mse',1,size(covar,2))./repmat(covar,size(mse,2),1); % beta variance tval = (beta'./sqrt(bvar))'; % betas -> t-values prob = (1-tcdf(tval,dfe))*2; % p-values TEST CODE: freq2 = []; freq2.label = {'1' '2'}; freq2.freq = 1:10; freq2.time = 1:5; freq2.dimord = 'rpt_chan_freq_time'; freq2.powspctrm = randn(20,2,10,5); cfg = []; cfg.confound = randn(20,3); cfg.output = 'beta'; cfg.reject = [1:3]; cfg.statistics = 'yes'; freq2_out = ft_regressconfound(cfg, freq2); min(freq2_out.prob(:)) max(freq2_out.prob(:))