Home > NoiseTools > nt_repeatability.m

# nt_repeatability

## PURPOSE

[score]=nt_repeatability(x,demean_flag) - repeatability score

## SYNOPSIS

function score=nt_repeatability(x,demean_flag)

## DESCRIPTION

     [score]=nt_repeatability(x,demean_flag) - repeatability score

      score: ratio of power of mean to total power

      x: data (time * channels * repeats)
      demean_flag: 0: no demean, 1: demean, 2: remove mean
      of e

      If no out argument is given, plot result.

## CROSS-REFERENCE INFORMATION

This function calls:

- nt_demean [y,mn]=nt_demean(x,w) - remove weighted mean over cols
- nt_demean2 y=nt_demean2(x,w) - remove mean of each row and page
- nt_unfold y=nt_fold(x) - unfold 3D to 2D

This function is called by:

- nt_qca [squares,quads,D]=nt_qca(x,npcs,nsmooth,nquads) - maximize induced power using quadratic component analysis
- nt_qca2 [square,quad,square2,quad2,D]=nt_qca(x,npcs,nsmooth) - maximize induced power using quadratic component analysis

## SOURCE CODE

    0001 function score=nt_repeatability(x,demean_flag)
    0002 % [score]=nt_repeatability(x,demean_flag) - repeatability score
    0003 %
    0004 %  score: ratio of power of mean to total power
    0005 %
    0006 %  x: data (time * channels * repeats)
    0007 %  demean_flag: 0: no demean, 1: demean, 2: remove mean
    0008 %  of e
    0009 %
    0010 %  If no out argument is given, plot result.
    0011
    0012 if nargin<1; error('!'); end
    0013 if ndims(x)~=3; error('data must be 3D'); end
    0014
    0015 if nargin<2 || isempty(demean_flag)
    0016     demean_flag=1;
    0017 end
    0018
    0019 if demean_flag==1
    0020     x=nt_demean(x);
    0021 elseif demean_flag==2
    0022     x=nt_demean2(x);
    0023 end
    0024
    0025 score=mean(mean(x,3).^2)./mean(nt_unfold(x.^2));
    0026
    0027 if nargout == 0 ;
    0028     plot(score); xlabel('component'); ylabel('score'); title('repeatability');
    0029     score=[];
    0030 end
    0031