


Compute jackknife estimates of the mean and standard deviation of input data x Usage: [m,jsd]=jackknife(x) Inputs: x : data in the form samples x trials Outputs: m : estimate of the mean (across trials) jsd: jackknife estimate of the standard deviation (across trials)


0001 function [m,jsd]=jackknife(x) 0002 % Compute jackknife estimates of the mean and standard deviation of input data x 0003 % Usage: [m,jsd]=jackknife(x) 0004 % 0005 % Inputs: 0006 % x : data in the form samples x trials 0007 % 0008 % Outputs: 0009 % m : estimate of the mean (across trials) 0010 % jsd: jackknife estimate of the standard deviation (across trials) 0011 0012 [N,C]=size(x); 0013 if C==1; error('Need multiple trials'); end; 0014 m=mean(x,2); 0015 theta=zeros(N,C); 0016 for tr=1:C; 0017 i=setdiff([1:C],tr); 0018 y=mean(x(:,i),2); 0019 theta(:,tr)=C*m-(C-1)*y; 0020 end; 0021 jm=mean(theta,2); 0022 jm=repmat(jm,[1 C]); 0023 jsd=sqrt(sum((theta-jm).^2,2)/(C-1));