├── madr.m ├── cohend.m ├── idealf.m ├── deciles.m ├── winmean.m ├── ksstat.m ├── tm.m ├── hd.m ├── winvar.m ├── mapd.m ├── winsample.m ├── wincov.m ├── l2dci.m ├── cliffdelta.m ├── binomci.m ├── bootse.m ├── find_onset.m ├── hdpbci.m ├── mapd_eeg.m ├── disker.m ├── ksstat_fig.m ├── hdci.m ├── yuen.m ├── summary_hd.m ├── hdi.m ├── akerd.m ├── decilespbci.m ├── mi50it.m ├── qhat.m ├── yuend.m ├── decilesci.m ├── cid.m ├── pbci.m ├── shiftdhd.m ├── shifthd.m ├── pb2ig.m ├── diff_asym.m ├── shiftdhd_pbci.m ├── shifthd_pbci.m ├── diffall_asym.m ├── hd3d.m ├── pb2dg.m └── LICENSE.txt /madr.m: -------------------------------------------------------------------------------- 1 | function out = madr(x) 2 | % out = madr(x) 3 | % Computes the median absolute deviation to the median, 4 | % adjusting by a factor for asymptotically normal consistency. 5 | % This is the formula used in the R version of mad, 6 | % which is different from the Matlab version. 7 | 8 | % Copyright (C) 2012 Guillaume Rousselet - University of Glasgow 9 | 10 | out = 1.4826.*median(abs(x-median(x))); -------------------------------------------------------------------------------- /cohend.m: -------------------------------------------------------------------------------- 1 | function cod = cohend(x,y) 2 | % cod = cohend(x,y); 3 | % Computes Cohen's d for two independent groups using pooled standard deviation. 4 | % x & y are two vectors 5 | 6 | % Copyright (C) 2016 Guillaume Rousselet - University of Glasgow 7 | 8 | % remove NaNs & reformat 9 | x=x(~isnan(x)); x=x(:); n1 = numel(x); 10 | y=y(~isnan(y)); y=y(:); n2 = numel(y); 11 | 12 | diff = mean(x) - mean(y); 13 | s1 = var(x,0); 14 | s2 = var(y,0); 15 | psd = sqrt( ((n1-1)*s1+(n2-1)*s2) / (n1+n2-2) ); % pooled standard deviation 16 | cod = diff ./ psd; 17 | -------------------------------------------------------------------------------- /idealf.m: -------------------------------------------------------------------------------- 1 | function [ql,qu] = idealf(x) 2 | % [ql,qu] = idealf(x) 3 | % Compute the ideal fourths for data in x 4 | % The estimate of the interquartile range is: 5 | % IQR = qu-ql; 6 | % Adapted from Rand Wilcox's idealf R function, described in 7 | % Rand Wilcox, Introduction to Robust Estimation & Hypothesis Testing, 3rd 8 | % edition, Academic Press, Elsevier, 2012 9 | 10 | % Cyril Pernet & Guillaume Rousselet, v1 - September 2012 11 | % --------------------------------------------------- 12 | % Copyright (C) Corr_toolbox 2012 13 | 14 | j=floor(length(x)/4 + 5/12); 15 | y=sort(x); 16 | g=(length(x)/4)-j+(5/12); 17 | ql=(1-g).*y(j)+g.*y(j+1); 18 | k=length(x)-j+1; 19 | qu=(1-g).*y(k)+g.*y(k-1); 20 | -------------------------------------------------------------------------------- /deciles.m: -------------------------------------------------------------------------------- 1 | function thetaq = deciles(x) 2 | % thetaq = deciles(x) 3 | % Computes the Harrell-Davis estimates of the deciles. 4 | % The vector x contains the data. 5 | % Quantiles .1 .2 .3 .4 .5 .6 .7 .8 .9 are estimated 6 | % 7 | % Adaptation of Rand Wilcox's hd R function, 8 | % http://dornsife.usc.edu/labs/rwilcox/software/ 9 | % Original article: 10 | % http://biomet.oxfordjournals.org/content/69/3/635.abstract 11 | 12 | % Copyright (C) 2016 Guillaume Rousselet - University of Glasgow 13 | 14 | n = numel(x); 15 | vec = 1:n; 16 | y = sort(x); 17 | thetaq = zeros(9,1); 18 | 19 | for dec = 1:9 20 | 21 | q = dec/10; 22 | m1 = (n+1).*q; 23 | m2 = (n+1).*(1-q); 24 | w = betacdf(vec./n,m1,m2)-betacdf((vec-1)./n,m1,m2); 25 | thetaq(dec) = sum(w(:).*y(:)); 26 | 27 | end -------------------------------------------------------------------------------- /winmean.m: -------------------------------------------------------------------------------- 1 | function wm=winmean(x,percent) % function wm=winmean(x,percent) % returns the winsorized mean of x % x must be a vector % percent must be between 0 and 100; the function winsorizes the lower and % upper extreme g values of x, where g=floor((percent/100)*length(x)). If x is empty, then NaN is % returned. % percent=20 by default % % Original code provided by Prof. Patrick J. Bennett, McMaster University % Edit input checks: GAR - University of Glasgow - Nov 2008 % % See Rand R. Wilcox (2005), p.27-29 % % See also WINSAMPLE if nargin < 2;percent=20;end % The output size for [] is a special case, handle it here. if isequal(x,[]), wm = NaN; return; end; % make sure that x is a vector sz = size(x); if sz > 2 | min(sz) > 1 error('winsample requires x to be a vector, not a matrix.'); end wx=winsample(x,percent); wm=mean(wx); return -------------------------------------------------------------------------------- /ksstat.m: -------------------------------------------------------------------------------- 1 | function ks = ksstat(x,y) 2 | % ks = ksstat(x,y) 3 | % Computes the two-sample Kolmogorov-Smirnov statistic. 4 | % x & y are two independent groups. 5 | % ks is the maximum of the absolute differences between the two empirical 6 | % cumulative distribution functions (CDF). 7 | % 8 | % No p value is returned. 9 | % 10 | % Based on Rand Wilcox's ks & ecdf R functions 11 | % http://dornsife.usc.edu/labs/rwilcox/software/ 12 | % 13 | % The Matlab function kstest2 returns the same results. 14 | 15 | % Copyright (C) 2016 Guillaume Rousselet - University of Glasgow 16 | 17 | % remove NaNs & reformat 18 | x=x(~isnan(x)); x=x(:); Nx = numel(x); 19 | y=y(~isnan(y)); y=y(:); Ny = numel(y); 20 | 21 | all = sort([x;y]); % pool and sort the observations 22 | diff = zeros(size(all)); 23 | for e = 1:numel(all) 24 | diff(e) = abs( length(x(x<=all(e)))/Nx - length(y(y<=all(e)))/Ny ); 25 | end 26 | ks = max(diff); -------------------------------------------------------------------------------- /tm.m: -------------------------------------------------------------------------------- 1 | function [trimmedMean,g] = tm(x,pr) % function [trimmedMean,g]=tm(x,pr) % % Returns the trimmed mean of x as trimmedMean. % returns number of winsorized observations at each tail of sample as g % x must be a vector % pr ranges between 0 and 100 - default = 20 % The trimmed mean is calculated from x after dropping the lower and upper g values from % x, where g=floor(pr*length(x)). If x is empty, then NaN is % returned. % % See Wilcox (2005), Introduction to Robust Estimation and Hypothesis % Testing (2nd Edition), Chapter 3, for a description of trimmed means. % % Original code provided by Prof. Patrick J. Bennett, McMaster University % The output size for [] is a special case, handle it here. if isequal(x,[]), trimmedMean = NaN; return; end; if nargin < 2 pr = 20; end % make sure that x is a vector sz = size(x); if sz > 2 | min(sz) > 1 error('tm requires x to be a vector, not a matrix.'); end n = length(x); xsort=sort(x); g=floor((pr/100)*n); tx=xsort((g+1):(n-g)); trimmedMean=mean(tx); -------------------------------------------------------------------------------- /hd.m: -------------------------------------------------------------------------------- 1 | function thetaq = hd(x,q) 2 | % thetaq = hd(x,q) 3 | % Computes the Harrell-Davis estimate of the qth quantile. 4 | % The vector x contains the data, and the desired quantile is q. 5 | % The default value for q is .5. 6 | % 7 | % Adaptation of Rand Wilcox's hd R function, 8 | % http://dornsife.usc.edu/labs/rwilcox/software/ 9 | % Original article: 10 | % http://biomet.oxfordjournals.org/content/69/3/635.abstract 11 | % 12 | % See also HD3D, HDCI, HDPBCI 13 | 14 | % Copyright (C) 2007, 2016 Guillaume Rousselet - University of Glasgow 15 | % 16 | % Test data 17 | % Data from Wilcox 2005 p.140 18 | % heartbeat=[190 80 80 75 50 40 30 20 20 10 10 10 0 0 -10 -25 -30 -45 -60 -85]; 19 | % a=[77 87 88 114 151 210 219 246 253 262 296 299 306 376 428 515 666 1310 2611]; % Wilcox, Table 3.2 p.58 20 | 21 | if nargin<2; q=.5;end 22 | n=length(x); 23 | m1=(n+1).*q; 24 | m2=(n+1).*(1-q); 25 | vec=1:length(x); 26 | w=betacdf(vec./n,m1,m2)-betacdf((vec-1)./n,m1,m2); 27 | y=sort(x); 28 | thetaq=sum(w(:).*y(:)); 29 | 30 | -------------------------------------------------------------------------------- /winvar.m: -------------------------------------------------------------------------------- 1 | function [wv,g] = winvar(x,percent) % function [wv,g] = winvar(x,percent) % returns the winsorized variance of x as wv % returns number of winsorized observations at each tail of sample as g % x must be a vector % percent must be between 0 and 100; the function winsorizes the lower and % upper extreme g values of x, where g=floor((percent/100)*length(x)). If x is empty, then NaN is % returned. % % Original code provided by Prof. Patrick J. Bennett, McMaster University % Edit input checks: GAR - University of Glasgow - Nov 2008 % % See also WINSAMPLE if nargin < 2;percent=20;end % The output size for [] is a special case, handle it here. if isequal(x,[]), wv = NaN; return; end if nargin < 2 error('winvar:TooFewInputs', 'winvar requires two input arguments.'); elseif percent >= 100 || percent < 0 error('winvar:InvalidPercent', 'PERCENT must be between 0 and 100.'); end % make sure that x is a vector sz = size(x); if sz > 2 || min(sz) > 1 error('winvar requires x to be a vector, not a matrix.'); end [wx,g]=winsample(x,percent); wv=var(wx); -------------------------------------------------------------------------------- /mapd.m: -------------------------------------------------------------------------------- 1 | function [out, apd] = mapd(x,y) 2 | % out = mapd(x,y) 3 | % Estimates the median of the distribution of x-y. 4 | % Returns the Harrell-Davis estimate of the median of all pairwise 5 | % differences. This statistics is a useful measure of effect size; 6 | % it provides information about the typical difference between any two 7 | % observations from two groups. 8 | % 9 | % INPUTS: 10 | % x & y are two vectors 11 | % 12 | % OUTPUTS: 13 | % out is the median of all pairwise differences 14 | % apd is a vector containing all the pairwise differences 15 | % 16 | % Adaptation of Rand Wilcox's wmwloc R function from Rallfun-v26 17 | % http://dornsife.usc.edu/labs/rwilcox/software/ 18 | % 19 | % See also HD, L2DCI, CID, CLIFFDELTA 20 | 21 | % Copyright (C) 2014, 2016 Guillaume Rousselet - University of Glasgow 22 | 23 | % remove NaNs 24 | x = x(~isnan(x)); 25 | y = y(~isnan(y)); 26 | 27 | x = x(:); 28 | y = y(:); 29 | 30 | yy = repmat(y,[1 length(x)])'; 31 | xx = repmat(x,[1 length(y)]); 32 | 33 | apd = xx-yy; % up to this point, calculations are identical to Cliff's delta 34 | 35 | out = hd(apd(:)); 36 | -------------------------------------------------------------------------------- /winsample.m: -------------------------------------------------------------------------------- 1 | function [wx,g] = winsample(x,percent) % function [wx,g] = winsample(x,percent) % returns the winsorized sample of x as wx % returns number of winsorized observations at each tail of sample as g % x must be a vector % percent must be between 0 and 100; the function converts the lower and % upper extreme g values of x to x(g+1) and x(n-g), respectively, where % g=floor((percent/100)*length(x)). If x is empty, then NaN is returned. % % Original code provided by Prof. Patrick J. Bennett, McMaster University % % Modified to avoid sorting the output: GAR - University of Glasgow - Dec 2007 % Edit input checks: GAR - University of Glasgow - Nov 2008 % % See also WINVAR if nargin < 2;percent=20;end % The output size for [] is a special case, handle it here. if isequal(x,[]), wx = NaN; return; end; % make sure that x is a vector sz = size(x); if sz > 2 || min(sz) > 1 error('winsample requires x to be a vector, not a matrix.'); end n = length(x); xsort=sort(x); g=floor((percent/100)*n); loval=xsort(g+1); hival=xsort(n-g); % wx=xsort; % % wx(1:g)=loval+zeros(1,g); % wx(n-g+1:n)=hival+zeros(1,g); wx = x; wx(wx<=loval) = loval; wx(wx>=hival) = hival; -------------------------------------------------------------------------------- /wincov.m: -------------------------------------------------------------------------------- 1 | function [wcov,g]=wincov(x,y,percent) 2 | 3 | % function [wv,g]=wincov(x,percent) 4 | % returns the winsorized covariance of x & y as wcov 5 | % returns number of winsorized observations at each tail of sample as g. 6 | % x must be a vector. 7 | % percent must be between 0 and 100; the function winsorizes the lower and 8 | % upper extreme g values of x, where g=floor((percent/100)*length(x)). If x is empty, then NaN is 9 | % returned. 10 | % percent=20 by default 11 | % 12 | % GAR, University of Glasgow, Dec 2007 13 | 14 | if nargin < 3;percent=20;end 15 | if nargin < 2 16 | error('winvar:TooFewInputs', 'winvar requires two input arguments.'); 17 | elseif percent >= 100 || percent < 0 18 | error('winvar:InvalidPercent', 'PERCENT must be between 0 and 100.'); 19 | end 20 | 21 | if percent > 0 && percent < 1 22 | percent = percent * 100; 23 | end 24 | 25 | % make sure that x is a vector 26 | sz = size(x); 27 | 28 | dim=length(x); 29 | 30 | % dim = find(sz == 1, 1); 31 | if isempty(dim) 32 | error('winvar:NonVectorData', 'winvar requires x to be a vector, not a matrix.'); 33 | end 34 | 35 | [wx,g]=winsample(x,percent); 36 | [wy,g]=winsample(y,percent); 37 | tmp=cov(wx,wy); 38 | wcov=tmp(1,2); 39 | 40 | return 41 | -------------------------------------------------------------------------------- /l2dci.m: -------------------------------------------------------------------------------- 1 | function [est, ci, pval] = l2dci(x,y) 2 | % [est, ci, pval] = l2dci(x,y) 3 | % Computes a bootstrap confidence interval for a 4 | % measure of location (hd) of the distribution of x-y. 5 | % Adaptation of Rand Wilcox's l2dci R function from Rallfun-v26: 6 | % http://dornsife.usc.edu/labs/rwilcox/software/ 7 | % 8 | % INPUTS: 9 | % x & y are two vectors 10 | % 11 | % OUTPUTS: 12 | % est = Harrell-Davis estimate of the median of all pairwise differences 13 | % see mapd for details 14 | % ci = confidence interval 15 | % pval = p value 16 | % 17 | % See also HD, MAPD, CID 18 | 19 | % Copyright (C) 2014, 2016 Guillaume Rousselet - University of Glasgow 20 | 21 | alpha = .05; 22 | Nb = 500; 23 | 24 | % remove NaNs 25 | x = x(~isnan(x)); 26 | y = y(~isnan(y)); 27 | 28 | nx = numel(x); 29 | ny = numel(y); 30 | 31 | est = mapd(x,y); 32 | 33 | bvec = zeros(Nb,1); 34 | 35 | for B = 1:Nb 36 | bvec(B) = mapd( x(randi(nx,nx,1)),y(randi(ny,ny,1))); 37 | end 38 | 39 | bvec = sort(bvec); 40 | low = round((alpha/2)*Nb)+1; 41 | up = Nb-low; 42 | temp = sum(bvec<0)/Nb + sum(bvec==0)/(2*Nb); 43 | pval = 2*(min(temp,1-temp)); 44 | ci = bvec([low up]); 45 | % estimate of square standard error of the estimator used 46 | % se = var(bvec) -------------------------------------------------------------------------------- /cliffdelta.m: -------------------------------------------------------------------------------- 1 | function d = cliffdelta(x,y) 2 | % d = cliffdelta(x,y) 3 | % Adaptation of Rand Wilcox's cid R function, 4 | % from Rallfun-v19 5 | % http://dornsife.usc.edu/labs/rwilcox/software/ 6 | % This version only returns delta. 7 | % The full function is cid. 8 | % 9 | % INPUTS: 10 | % x & y are two vectors 11 | % 12 | % OUTPUTS: 13 | % d statistic P(X>Y)-P(X 0); 25 | onset = Xf(onset(1)); 26 | end 27 | 28 | if rmzero == 1 % ignore baseline onsets 29 | [L,NUM] = bwlabeln(sigmask); % find clusters 30 | maskedsig = sigmask; 31 | if NUM~=0 32 | tmp = zeros(1,NUM); 33 | for C = 1:NUM % check if cluster includes baseline 34 | sigtimes = Xf(L == C); 35 | if min(sigtimes) <= 0 36 | maskedsig(L == C) = 0; 37 | end 38 | end 39 | end 40 | onset = find(maskedsig > 0); 41 | onset = Xf(onset(1)); 42 | end 43 | -------------------------------------------------------------------------------- /hdpbci.m: -------------------------------------------------------------------------------- 1 | function [xhd,CI] = hdpbci(x,q,nboot,alpha) 2 | % [xhd CI] = hdpbci(x,q,nboot) 3 | % HDPBCI computes the 95% percentile bootstrap confidence interval 4 | % for the qth quantile of a distribution using the Harrell-Davis estimator. 5 | % Unlike hdci, hdpbci does not rely on an estimation of the standard error of hd. 6 | % 7 | % INPUTS: 8 | % x = vector 9 | % q = quantile (default 0.5) 10 | % nboot = number of bootstrap samples (default = 2000) 11 | % alpha = alpha level (default = 0.05) 12 | % 13 | % OUTPUTS: 14 | % xhd = quantile 15 | % CI = quantile's confidence interval 16 | % 17 | % see: 18 | % Wilcox, R.R. (2012) 19 | % Introduction to robust estimation and hypothesis testing 20 | % Academic Press 21 | % p.126-132 22 | % 23 | % Adaptation of Rand Wilcox's qcipb R function, 24 | % http://dornsife.usc.edu/labs/rwilcox/software/ 25 | % 26 | % See also HD, HDCI, DECILESPBCI, DECILESCI 27 | 28 | % Copyright (C) 2016 Guillaume Rousselet - University of Glasgow 29 | % GAR 2016-06-02 - first version 30 | 31 | if ~exist('q', 'var') || isempty(q) 32 | q = 0.5; 33 | end 34 | if ~exist('nboot', 'var') || isempty(nboot) 35 | nboot = 2000; 36 | end 37 | if ~exist('alpha', 'var') || isempty(alpha) 38 | alpha = 0.05; 39 | end 40 | 41 | n = numel(x); 42 | 43 | % compute quantile 44 | xhd = hd(x,q); 45 | 46 | % percentile bootstrap of hd 47 | xboot = zeros(nboot,1); 48 | list = randi(n,nboot,n); 49 | for B = 1:nboot 50 | xboot(B) = hd(x(list(B,:)),q); 51 | end 52 | xboot = sort(xboot); 53 | lo = round(nboot*(alpha/2)); 54 | hi = nboot - lo; 55 | 56 | % confidence intervals 57 | CI(1) = xboot(lo+1); 58 | CI(2) = xboot(hi); 59 | -------------------------------------------------------------------------------- /mapd_eeg.m: -------------------------------------------------------------------------------- 1 | function [mapd, apd] = mapd_eeg(x,y) 2 | % [mpad, apd] = mapd_eeg(x,y) 3 | % Computes all the pairwise differences between elements of x & y. 4 | % Also estimates the median of these pairwise differences using 5 | % the Harrell-Davis estimate of the 50th percentile. 6 | % This statistics is a useful measure of effect size; 7 | % it provides information about the typical difference between any two 8 | % observations from two groups. 9 | % 10 | % INPUTS: 11 | % x & y are two matrices with dimensions time points x elements 12 | % elements could be for instance participants or trials 13 | % 14 | % OUTPUTS: 15 | % mapd is a vector of the medians of all the pairwise differences 16 | % dimensions = time points x 1 17 | % apd is a matrix time points x all the pairwise differences 18 | % 19 | % Adaptation of Rand Wilcox's wmwloc R function from Rallfun-v26 20 | % http://dornsife.usc.edu/labs/rwilcox/software/ 21 | % 22 | % See also HD, L2DCI, CID, CLIFFDELTA, MAPD 23 | 24 | % Copyright (C) 2016 Guillaume Rousselet - University of Glasgow 25 | % First version 2016-08-09 26 | % to do: vectorise time dimension 27 | 28 | [Nf,Nx] = size(x); 29 | Ny = size(y,2); 30 | mapd = zeros(Nf,1); 31 | apd = zeros(Nf,Nx*Ny); 32 | 33 | hx = x; 34 | hy = y; 35 | 36 | for F = 1:Nf 37 | 38 | x = hx(F,:); 39 | y = hy(F,:); 40 | 41 | % remove NaNs 42 | x = x(~isnan(x)); 43 | y = y(~isnan(y)); 44 | 45 | x = x(:); 46 | y = y(:); 47 | 48 | yy = repmat(y,[1 length(x)])'; 49 | xx = repmat(x,[1 length(y)]); 50 | 51 | m = xx-yy; % up to this point, calculations are identical to Cliff's delta 52 | 53 | mapd(F) = hd(m(:)); 54 | apd(F,:) = m; 55 | 56 | end 57 | -------------------------------------------------------------------------------- /disker.m: -------------------------------------------------------------------------------- 1 | function [phat,zhat] = disker(x,y,z) 2 | % [phat,zhat] = disker(x,y,z) 3 | % Estimate apparent effect size using the probability of correct 4 | % classification based on values in first group. 5 | % Uses adaptive kernel estimate with initial estimate based 6 | % on expected frequency curve. 7 | % 8 | % x & y are two independent samples 9 | % z is a vector of values classified as belonging or not to x 10 | % If not specified, z = x. 11 | % 12 | % phat = proportion of correctly classified observations 13 | % A "correct" classification is the event of deciding 14 | % that an observation from the first group did indeed 15 | % come from the first group based on a kernel density 16 | % estimate of the distributions. 17 | % 18 | % zhat = vector of 0s and 1s indicating whether values 19 | % in z would be classified as coming from group x. 20 | % 21 | % Based on Rand Wilcox's disker R function 22 | % http://dornsife.usc.edu/labs/rwilcox/software/ 23 | % 24 | % See also AKERD 25 | 26 | % Copyright (C) 2012 Guillaume Rousselet - University of Glasgow 27 | 28 | % remove NaNs & reformat 29 | x=x(~isnan(x)); x=x(:); 30 | y=y(~isnan(y)); y=y(:); 31 | 32 | xsort = sort(x); 33 | 34 | xhat = akerd(x,xsort,0); 35 | yhat = akerd(y,xsort,0);%figure;hold on;plot(xsort,xhat,'k',xsort,yhat,'g') 36 | 37 | % Compute apparent probability of a correct classification 38 | phat = sum(xhat>yhat)./length(x); 39 | 40 | if nargout==2 41 | 42 | if nargin<3 || isempty(z) 43 | z=x; 44 | end 45 | 46 | % Make decisions for the data in z, 47 | % set zhat=1 if decide it came from group 1. 48 | zxhat = akerd(x,z); 49 | zyhat = akerd(y,z); 50 | 51 | zhat = ones(length(z),1); 52 | zhat(zxhat=.8 59 | if n <= 20 60 | c = -6.23./n+5.01; 61 | end 62 | end 63 | 64 | if q<=.1 || q>=.9 65 | if n<=40 66 | c = 36.2./n+1.31; 67 | end 68 | end 69 | 70 | % confidence intervals 71 | CI(1) = xhd - c.*xd_bse; 72 | CI(2) = xhd + c.*xd_bse; 73 | -------------------------------------------------------------------------------- /yuen.m: -------------------------------------------------------------------------------- 1 | function [Ty,diff,CI,da,db,df,p]=yuen(a,b,percent,alpha) % function [Ty,diff,CI,da,db,df,p]=yuen(a,b,percent,alpha) % % Computes Ty (Yuen's T statistic). % Ty=(tma-tmb) / sqrt(da+db), where tma & tmb are trimmed means of a & b, % and da & db are yuen's estimate of the standard errors of tma & tmb. % Ty is distributed approximately as Student's t with estimated degrees of freedom, df. % The p-value (p) is the probability of obtaining a t-value whose absolute value % is greater than Ty if the null hypothesis (i.e., tma-tmb = mu) is true. % In other words, p is the p-value for a two-tailed test of H0: tma-tmb=0; % Data arrays a & b must be vectors; percent must be a number between 0 & 100. % % Default values: % percent = 20; % alpha = 0.05; necessary to compute the CI % % See Wilcox (2005), Introduction to Robust Estimation and Hypothesis % Testing (2nd Edition), page 159-161 for a description of the Yuen % procedure. % You can also check David C. Howell, Statistical Methods for Psychology, % sixth edition, p.43, 323, 362-363. % % Original code by Prof. Patrick J. Bennett, McMaster University % Added CI output, various editing, GAR, University of Glasgow, Dec 2007 % % See also YUEND if nargin<4;alpha=.05;end if nargin<3;percent=20;end if isempty(a) || isempty(b) error('yuen:InvalidInput', 'data vectors cannot have length=0'); end if (min(size(a))>1) || (min(size(b))>1) error('yuen:InvalidInput', 'yuen requires that the data are input as vectors.'); end if (percent >= 100) || (percent < 0) error('yuen:InvalidPercent', 'PERCENT must be between 0 and 100.'); end [swa,ga]=winvar(a,percent); % winsorized variance of a & # items winsorized [swb,gb]=winvar(b,percent); % winsorized variance of b & # items winsorized % yuen's estimate of standard errors for a and b na=length(a); ha=na-2*ga; da=((na-1)*swa)/(ha*(ha-1)); nb=length(b); hb=nb-2*gb; db=((nb-1)*swb)/(hb*(hb-1)); % trimmed means ma=tm(a,percent); mb=tm(b,percent); diff=ma-mb; Ty=diff./sqrt(da+db); da2=da^2; db2=db^2; df= ((da+db).^2) / ( (da2/(ha-1)) + (db2/(hb-1)) ); p=2*(1-tcdf(abs(Ty),df)); % 2-tailed probability t=tinv(1-alpha./2,df); % 1-alpha/2 quantile of Student's distribution with df degrees of freedom CI(1)=(ma-mb)-t.*sqrt(da+db); CI(2)=(ma-mb)+t.*sqrt(da+db); return -------------------------------------------------------------------------------- /summary_hd.m: -------------------------------------------------------------------------------- 1 | function out = summary_hd(x, nboot, alpha) 2 | % out = SUMMARY_HD(x, nboot, alpha) 3 | % Compute a summary of observations stored in vector x: 4 | % min, max and quartiles estimated using 5 | % the Harrell-Davis estimator. Return results in a structure, 6 | % as well as a table in the command window. 7 | % 8 | % INPUTS: 9 | % x Vector of observations. 10 | % nboot Number of bootstrap samples. If not specified confidence intervals 11 | % are not computed. 12 | % alpha Alpha level. Default to 0.05 if nboot is provided. 13 | % 14 | % OUTPUTS: 15 | % out A structure with fields: 16 | % - min Minimum observation(s) 17 | % - max Maximum observation(s) 18 | % - q Quantiles 19 | % - xq Quantile estimates 20 | % - qci Confidence intervals matching xhd 21 | % 22 | % EXAMPLES 23 | % out = summary_hd(x) % basic call, does not return confidence intervals 24 | % out = summary_hd(x, 2000) % specify number of bootstrap samples, alpha 25 | % set to 0.05 by default 26 | % out = summary_hd(x, 2000, 0.1) % specify 10% alpha level 27 | % 28 | % See also HD, HD3D 29 | 30 | % Copyright (C) 2017 Guillaume Rousselet - University of Glasgow 31 | % GAR 2017-05-08 - first version 32 | 33 | if ~isvector(x) 34 | error('summary_hd only works with vectors...') 35 | end 36 | 37 | if ~exist('nboot', 'var') 38 | nboot = []; 39 | end 40 | 41 | if ~exist('alpha', 'var') 42 | alpha = []; 43 | end 44 | 45 | seq = [.25, .5, .75]; 46 | nq = numel(seq); 47 | 48 | xmin = min(x); 49 | xmax = max(x); 50 | allq = zeros(nq,1); 51 | if ~isempty(nboot) 52 | allci = zeros(nq,2); 53 | end 54 | for Q = 1:nq 55 | res = hd3d(x, seq(Q), nboot, alpha); 56 | allq(Q) = res.xhd; 57 | if ~isempty(nboot) 58 | allci(Q,:) = res.ci; 59 | end 60 | end 61 | 62 | out.min = xmin; 63 | out.max = xmax; 64 | out.q = seq; 65 | out.xq = allq; 66 | if ~isempty(nboot) 67 | out.qci = allci; 68 | end 69 | 70 | results = [xmax allq(3) allq(2) allq(1) xmin]'; 71 | if ~isempty(nboot) 72 | ci = [NaN NaN; allci(3,:); allci(2,:); allci(1,:); NaN NaN]; 73 | end 74 | 75 | if ~isempty(nboot) 76 | T = table(results,ci, 'RowNames', {'maximum';'quartile 3';'quartile 2';'quartile 1';'minimum'}); 77 | else 78 | T = table(results, 'RowNames', {'maximum';'quartile 3';'quartile 2';'quartile 1';'minimum'}); 79 | end 80 | T 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /hdi.m: -------------------------------------------------------------------------------- 1 | function hdilim = hdi(samplevec,credmass) 2 | % hdilim = hdi(samplevec,credmass) 3 | % Computes highest density interval from a sample of representative values, 4 | % estimated as shortest credible interval. 5 | % 6 | % INPUTS: 7 | % samplevec = vector of representative values from a probability distribution. 8 | % credmass = scalar between 0 and 1, indicating the mass within the credible 9 | % interval that is to be estimated, e.g. 0.90. 10 | % OUTPUT: 11 | % hdilim = vector containing the limits of the hdi 12 | % 13 | % HDI implementation based on original R code HDIofMCMC from John K. Kruschke: 14 | % https://github.com/boboppie/kruschke-doing_bayesian_data_analysis/blob/master/1e/HDIofMCMC.R 15 | % ------------------------------------------ 16 | % Copyright (C) Guillaume Rousselet 2015 17 | 18 | % GAR - University of Glasgow - 16 Dec 2015 19 | 20 | sortedPts = sort( samplevec ); 21 | ciIdxInc = floor( credmass * length( sortedPts ) ); 22 | nCIs = length( sortedPts ) - ciIdxInc; 23 | ciWidth = zeros(nCIs,1); 24 | for ci = 1:nCIs 25 | ciWidth(ci) = sortedPts(ci + ciIdxInc) - sortedPts(ci); 26 | end 27 | 28 | HDImin = sortedPts( find(ciWidth == min(ciWidth),1) ); 29 | HDImax = sortedPts( find(ciWidth == min(ciWidth),1) + ciIdxInc); 30 | hdilim = [HDImin HDImax]; 31 | 32 | % original R code from 33 | % https://github.com/boboppie/kruschke-doing_bayesian_data_analysis/tree/master/1e 34 | % HDIofMCMC = function( sampleVec , credMass=0.95 ) { 35 | % # Computes highest density interval from a sample of representative values, 36 | % # estimated as shortest credible interval. 37 | % # Arguments: 38 | % # sampleVec 39 | % # is a vector of representative values from a probability distribution. 40 | % # credMass 41 | % # is a scalar between 0 and 1, indicating the mass within the credible 42 | % # interval that is to be estimated. 43 | % # Value: 44 | % # HDIlim is a vector containing the limits of the HDI 45 | % sortedPts = sort( sampleVec ) 46 | % ciIdxInc = floor( credMass * length( sortedPts ) ) 47 | % nCIs = length( sortedPts ) - ciIdxInc 48 | % ciWidth = rep( 0 , nCIs ) 49 | % for ( i in 1:nCIs ) { 50 | % ciWidth[ i ] = sortedPts[ i + ciIdxInc ] - sortedPts[ i ] 51 | % } 52 | % HDImin = sortedPts[ which.min( ciWidth ) ] 53 | % HDImax = sortedPts[ which.min( ciWidth ) + ciIdxInc ] 54 | % HDIlim = c( HDImin , HDImax ) 55 | % return( HDIlim ) 56 | % } -------------------------------------------------------------------------------- /akerd.m: -------------------------------------------------------------------------------- 1 | function dhat = akerd(x,pts,plotit) 2 | % dhat = akerd(x,pts,plotit) 3 | % 4 | % Computes dhat, an adaptive kernel density estimate for univariate data, 5 | % using the expected frequency as initial estimate of density (see Silverman, 1986). 6 | % 7 | % x = vector of observations 8 | % pts = points at which to estimate the density 9 | % plotit = 1 or 0 to get a figure or not 10 | % 11 | % Matlab adaptation of R functions from Rand Wilcox: 12 | % akerd, rdplot & near 13 | % see Wilcox, R. R. (2012). Introduction to robust estimation and 14 | % hypothesis testing (3rd ed.). Amsterdam, Boston: Academic Press. 15 | % 16 | % See also MADR, IDEALF, WINVAR 17 | 18 | % Copyright (C) 2012, 2016 Guillaume Rousselet - University of Glasgow 19 | 20 | if nargin<3 || isempty(plotit) 21 | plotit=0; 22 | end 23 | if nargin<2 24 | pts=[]; 25 | end 26 | 27 | fr=.8;aval=.5; 28 | x=x(~isnan(x)); 29 | x=x(:); 30 | x=sort(x); 31 | n=length(x); 32 | m=madr(x); 33 | if m==0 34 | [ql,qu]=idealf(x); 35 | m=(qu-ql)./1.34898;%(qnorm(.75)-qnorm(.25)) 36 | end 37 | if m==0 38 | m=sqrt(winvar(x,20)/.4129); 39 | end 40 | if m==0 41 | error('in akerd: all measures of dispersion are equal to 0') 42 | end 43 | 44 | % rdplot: Expected frequency curve -------------------------------------- 45 | rmd=zeros(length(x),1); 46 | for p=1:length(x) % near: determine which values in x are near pt based on fr * mad 47 | rmd(p)=sum(abs(x-x(p))<=(fr.*m)); 48 | end 49 | if m~=0 50 | fhat=(rmd./(2.*fr.*m))./n; 51 | end 52 | % ----------------------------------------------------------------------- 53 | 54 | if m>0 55 | fhat=fhat./(2.*fr.*m); 56 | end 57 | 58 | % compute hval 59 | sig=sqrt(var(x)); 60 | [ql,qu]=idealf(x); 61 | iq=(qu-ql)/1.34; 62 | A=min([sig iq]); 63 | if A==0 64 | A=sqrt(winvar(x,20))/.64; 65 | end 66 | hval=1.06.*A./length(x)^(.2); 67 | % See Silverman, 1986, pp. 47-48 68 | 69 | gm=exp(mean(log(fhat(fhat>0)))); %fprintf('%.7f',gm) 70 | alam=(fhat./gm).^(0-aval); 71 | 72 | if isempty(pts);pts=sort(x);end 73 | dhat=zeros(length(pts),1); 74 | pts=sort(pts); 75 | for p=1:length(pts) 76 | temp=(pts(p)-x)./(hval.*alam); 77 | epan=zeros(n,1); 78 | epan(abs(temp)=pts(1) & xf<=pts(2); 34 | xf50it = xf(frame_selec); 35 | nf50it = numel(xf50it); 36 | 37 | % baseline correction 38 | % data = data - repmat( median(data(xf<0,:),1), [nf 1] ); 39 | 40 | % cumulative sum 41 | data = data(frame_selec,:); 42 | data = cumsum( data, 1 ); 43 | 44 | % normalization 45 | data = data - repmat(min(data,[],1), [nf50it 1]); % figure;plot(Xf0500,cs1) 46 | data = data ./ repmat(max(data,[],1), [nf50it 1]); % figure;plot(Xf0500,cs1) 47 | it = zeros(np,1); 48 | for P = 1:np % for every participant 49 | it(P) = interp1(data(:,P),xf50it,.5,'linear'); 50 | end 51 | 52 | if plotit == 1 53 | 54 | cc = parula(np); 55 | figure('Color','w','NumberTitle','off','Name','50% integration time') 56 | hold on 57 | for P=1:np 58 | plot(xf50it,data(:,P),'Color',cc(P,:),'LineWidth',2) 59 | plot([it(P) it(P)],[0 1],'Color',cc(P,:),'LineWidth',1) 60 | end 61 | set(gca,'LineWidth',2,'YLim',[0 1],'XLim',pts,'XTick',pts(1):50:pts(2)) 62 | set(gca,'FontSize',14,'Layer','Top') 63 | xlabel('Time in ms','FontSize',16') 64 | ylabel('Normalised MI','FontSize',16') 65 | box on 66 | 67 | end 68 | -------------------------------------------------------------------------------- /qhat.m: -------------------------------------------------------------------------------- 1 | function q = qhat(x,y,nboot) 2 | % q = qhat(x,y,nboot) 3 | % Estimates Q, a nonparametric measure of effect size for 4 | % two independent samples, as described in: 5 | % Wilcox, R.R. & Muska, J. (2010) 6 | % Measuring effect size: A non-parametric analogue of omega(2). 7 | % The British journal of mathematical and statistical psychology, 52, 93-110. 8 | % 9 | % Uses an adaptive kernel estimate with an initial estimate based 10 | % on the expected frequency curve. 11 | % Bias is corrected using the .632 method of estimating prediction error 12 | % (see Efron and Tibshirani, 1993, pp. 252--254). 13 | % 14 | % x & y are two vectors of observations 15 | % nboot is the number of bootstrap samples - default 100 16 | % 17 | % Based on Rand Wilcox's qhat R function 18 | % http://dornsife.usc.edu/labs/rwilcox/software/ 19 | % 20 | % See also DISKER, AKERD 21 | 22 | % Copyright (C) 2012, 2016 Guillaume Rousselet - University of Glasgow 23 | 24 | x=x(~isnan(x));x=x(:);Nx=length(x); 25 | y=y(~isnan(y));y=y(:);Ny=length(y); 26 | 27 | if nargin<3 || isempty(nboot) 28 | nboot=100; 29 | end 30 | 31 | if nargin<4 32 | datax=randi(Nx,nboot,Nx); 33 | % datax is an nboot by n matrix containing subscripts for bootstrap sample 34 | % associated with first group. 35 | datay=randi(Ny,nboot,Ny); 36 | % datay is an nboot by m matrix containing subscripts for bootstrap sample 37 | % associated with second group. 38 | end 39 | 40 | % fprintf('Taking bootstrap samples. Please wait.\n') 41 | 42 | % Make bidx & bidy ------------------------------------------------------- 43 | % bidx is a n by nboot matrix. If the jth bootstrap sample from 44 | % 1, ..., n contains the value i, bid[i,j]=0; otherwise bid[i,j]=1 45 | bidx=zeros(Nx,nboot); 46 | bidy=zeros(Ny,nboot); 47 | for B = 1:nboot 48 | [bidx(:,B),~] = ismember(1:Nx,datax(B,:)); 49 | [bidy(:,B),~] = ismember(1:Ny,datay(B,:)); 50 | end 51 | bidx=bidx==0; 52 | bidy=bidy==0; 53 | 54 | temp3=zeros(nboot,Nx); 55 | temp5=zeros(nboot,Ny); 56 | 57 | for B=1:nboot 58 | [~,temp3(B,:)] = disker(x(datax(B,:)),y(datay(B,:)),x); 59 | % temp3 contains vector of 0s and 1s, 1 if x[i] 60 | % is classified as coming from group 1. 61 | [~,temp5(B,:)] = disker(y(datay(B,:)),x(datax(B,:)),y); 62 | end 63 | 64 | temp4=temp3.*bidx'; 65 | temp4=sum(temp4,1)./sum(bidx,2)'; 66 | temp6=temp5.*bidy'; 67 | temp6=sum(temp6,1)./sum(bidy,2)'; 68 | ep0x=nanmean(temp4); % epsilon hat_x 69 | aperrorx=disker(x,y); % apparent error 70 | regprex=.368.*aperrorx+.632.*ep0x; 71 | ep0y=nanmean(temp6); 72 | aperrory=disker(y,x); % apparent error 73 | regprey=.368.*aperrory+.632.*ep0y; 74 | q = (Nx.*regprex+Ny.*regprey)./(Nx+Ny); 75 | -------------------------------------------------------------------------------- /yuend.m: -------------------------------------------------------------------------------- 1 | function [Ty,CI,diff,se,df,p]=yuend(a,b,percent,alpha) 2 | 3 | % function [Ty,CI,diff,se,df,p]=yuend(a,b,percent,alpha) 4 | % 5 | % Computes Ty (Yuen's T statistic) for two dependent groups 6 | % Ty=(tma-tmb) / sqrt(da+db-2dab), where tma & tmb are trimmed means of a & b, 7 | % da & db are yuen's estimate of the standard errors of tma & tmb. 8 | % Ty is distributed approximately as Student's t with estimated degrees of freedom, df. 9 | % The p-value (p) is the probability of obtaining a t-value whose absolute value 10 | % is greater than Ty if the null hypothesis (i.e., tma-tmb = mu) is true. 11 | % In other words, p is the p-value for a two-tailed test of H0: tma-tmb=0; 12 | % Data arrays a & b must be vectors; percent must be a number between 0 & 100. 13 | % se is the estimated standard error of the difference between the sample trimmed means. 14 | % 15 | % Default values: 16 | % mu = 0; 17 | % percent = 20; 18 | % alpha = 0.05; necessary to compute the CI 19 | % 20 | % See Wilcox (2005), Introduction to Robust Estimation and Hypothesis 21 | % Testing (2nd Edition), page 188-191 for a description of the Yuen 22 | % procedure for dependent groups. 23 | % 24 | % GAR, University of Glasgow, Dec 2007 25 | % 26 | % See also YUEN 27 | 28 | if nargin<4;alpha=.05;end 29 | if nargin<3;percent=20;end 30 | 31 | if isempty(a) || isempty(b) 32 | error('yuen:InvalidInput', 'data vectors cannot have length=0'); 33 | end 34 | 35 | if (min(size(a))>1) || (min(size(b))>1) 36 | error('yuen:InvalidInput', 'yuen requires that the data are input as vectors.'); 37 | end 38 | 39 | if (percent >= 100) || (percent < 0) 40 | error('yuen:InvalidPercent', 'PERCENT must be between 0 and 100.'); 41 | end 42 | 43 | [swa,ga]=winvar(a,percent); % winsorized variance of a & # items winsorized 44 | [swb,gb]=winvar(b,percent); % winsorized variance of b & # items winsorized 45 | 46 | % yuen's estimate of standard errors for a and b 47 | na=length(a); 48 | ha=na-2.*ga; % effective sample size after trimming 49 | da=(na-1).*swa; 50 | 51 | nb=length(b); 52 | hb=nb-2.*gb; 53 | db=(nb-1).*swb; 54 | 55 | dab=(na-1).*wincov(a,b,percent); 56 | 57 | % trimmed means 58 | ma=tm(a,percent); 59 | mb=tm(b,percent); 60 | 61 | diff=ma-mb; 62 | 63 | df= ha-1; 64 | se=sqrt( (da+db-2.*dab)./(ha.*(ha-1)) ); 65 | 66 | Ty=(ma-mb)./se; 67 | 68 | p=2*(1-tcdf(abs(Ty),df)); % 2-tailed probability 69 | 70 | t=tinv(1-alpha./2,df); % 1-alpha./2 quantile of Student's distribution with df degrees of freedom 71 | 72 | CI(1)=diff-t.*se; 73 | CI(2)=diff+t.*se; 74 | 75 | return 76 | 77 | % Data from Wilcox p.190 78 | % before=[190 210 300 240 280 170 280 250 240 220]; 79 | % after=[210 210 340 190 260 180 200 220 230 200]; 80 | 81 | -------------------------------------------------------------------------------- /decilesci.m: -------------------------------------------------------------------------------- 1 | function [xhd,CI] = decilesci(x,nboot,plotCI) 2 | % [xhd CI] = decilesci(x,nboot,plotCI) 3 | % DECILESCI computes 95% confidence intervals 4 | % for the deciles of a distribution using 5 | % the Harrell-Davis estimator and a percentile bootstrap 6 | % estimate of its standard error. 7 | % 8 | % INPUTS: 9 | % x = vector 10 | % nboot = number of bootstrap samples (default = 100) 11 | % plotCI = set to 1 to output figure of deciles + their confidence 12 | % intervals 13 | % 14 | % OUTPUTS: 15 | % xhd = 9 deciles 16 | % CI = 9 x 2 matrix of the deciles' confidence intervals 17 | % 18 | % see: 19 | % Wilcox, R.R. (2012) 20 | % Introduction to robust estimation and hypothesis testing 21 | % Academic Press 22 | % p.126-132 23 | % 24 | % Adaptation of Rand Wilcox's hdci R function, 25 | % http://dornsife.usc.edu/labs/rwilcox/software/ 26 | % 27 | % See also HD, HDCI, HDPBCI, DECILESPBCI 28 | 29 | % Copyright (C) 2009, 2016 Guillaume Rousselet - University of Glasgow 30 | % GAR, University of Glasgow, Sep 2009 - first version 31 | % GAR 2016-06-02 - updated help 32 | 33 | if nargin<2;nboot=100;plotCI=0;end 34 | 35 | n = numel(x); 36 | if n<=10 37 | error('hdci: n<11, confidence intervals cannot be computed for less than 11 observations') 38 | end 39 | 40 | list = randi(n,nboot,n); % use same bootstrap samples for all CIs 41 | 42 | xhd = zeros(9,1); 43 | CI = zeros(9,2); 44 | 45 | for d = 1:9 46 | 47 | q = d/10; 48 | 49 | % compute decile 50 | xhd(d) = hd(x,q); 51 | 52 | % percentile bootstrap estimate of the standard error of hd 53 | xboot = zeros(nboot,1); 54 | for B = 1:nboot 55 | xboot(B) = hd(x(list(B,:)),q); 56 | end 57 | xd_bse = std(xboot,0); % normalize by (n-1) 58 | % We estimate the standard error of the test statistic by the 59 | % standard deviation of the bootstrap replications 60 | % Efron & Tibshinari 1993, chapter 6 61 | % Wilcox 2005, p.44-45 62 | 63 | % The constant c was determined so that the probability coverage of each confidence interval 64 | % is approximately 95% when sampling from normal and non-normal distributions. 65 | c = 1.96 + .5064 ./ (n.^.25); 66 | 67 | if q<=.2 || q>=.8 68 | if n <= 20 69 | c = -6.23./n+5.01; 70 | end 71 | end 72 | 73 | if q<=.1 || q>=.9 74 | if n<=40 75 | c = 36.2./n+1.31; 76 | end 77 | end 78 | 79 | % confidence intervals 80 | CI(d,1) = xhd(d)-c.*xd_bse; 81 | CI(d,2) = xhd(d)+c.*xd_bse; 82 | 83 | end 84 | 85 | if plotCI==1 86 | figure;set(gcf,'Color','w');hold on 87 | plot(1:9,xhd,'ko',1:9,CI(:,1),'k+',1:9,CI(:,2),'k+') 88 | set(gca,'FontSize',14,'XLim',[0 10],'XTick',1:9) 89 | box on 90 | end 91 | -------------------------------------------------------------------------------- /cid.m: -------------------------------------------------------------------------------- 1 | function [qxly,q0,qxgy,d,ci] = cid(x,y,alpha) 2 | % [qxly,q0,qxgy,d,ci] = cid(x,y,alpha) 3 | % Adaptation of Wilcox's cid R function, 4 | % from Rallfun-v19 5 | % http://dornsife.usc.edu/labs/rwilcox/software/ 6 | % 7 | % Compute a confidence interval for delta using the method in 8 | % Cliff, 1996, p. 140, eq 5.12 9 | % Ordinal methods for behavioral data analysis. 10 | % Erlbaum, Mahwah, N.J. 11 | % 12 | % The null hypothesis is that for two independent group, P(XY). 13 | % This function reports a 1-alpha confidence interval for 14 | % P(X>Y)-P(XY) 24 | % d: delta statistic P(X>Y)-P(X0))./numel(msave); 66 | 67 | if flag==1 68 | sigdih=sum(sum((m-d).^2))/(dx*dy-1); 69 | di=NaN(dx,1); 70 | for c=1:dx 71 | di(c)=sum(x(c)>y)/dy-sum(x(c)x)/dx-sum(y(c) 2 87 | if nargin < 6 || isempty(mu) 88 | mu=0; 89 | end 90 | p = mean(bootx > mu) + mean(bootx == mu).*0.5; 91 | p = 2.*min(p,1-p); 92 | end 93 | -------------------------------------------------------------------------------- /shiftdhd.m: -------------------------------------------------------------------------------- 1 | function [xd, yd, delta, deltaCI] = shiftdhd(x,y,nboot,plotit) 2 | %[xd yd delta deltaCI] = shiftdhd(x,y,nboot,plotshift) 3 | % SHIFTDHD computes the 95% simultaneous confidence intervals 4 | % for the difference between the deciles of two dependent groups 5 | % using the Harrell-Davis quantile estimator, in conjunction with 6 | % percentile bootstrap estimation of the quantiles' standard errors. 7 | % See Wilcox Robust hypothesis testing book 2005 p.184-187 8 | % 9 | % INPUTS: 10 | % - x & y are vectors of the same length without missing values 11 | % - nboot = number of bootstrap samples - default = 200 12 | % - plotit = 1 to get a figure; 0 otherwise by default 13 | % 14 | % OUTPUTS: 15 | % - xd & yd = vectors of quantiles 16 | % - delta = vector of differences between quantiles (x-y) 17 | % - deltaCI = matrix quantiles x low/high bounds of the confidence 18 | % intervals of the quantile differences 19 | % 20 | % Tied values are not allowed. 21 | % If tied values occur, or if you want to estimate quantiles other than the deciles, 22 | % or if you want to use an alpha other than 0.05, use SHIFTDHD_PBCI instead. 23 | % 24 | % Adaptation of Rand Wilcox's shifthd R function, 25 | % http://dornsife.usc.edu/labs/rwilcox/software/ 26 | % 27 | % See also HD, SHIFTDHD, SHIFTHD_PBCI 28 | 29 | % Copyright (C) 2007, 2013, 2016 Guillaume Rousselet - University of Glasgow 30 | % Original R code by Rand Wilcox 31 | % GAR, University of Glasgow, Dec 2007 32 | % GAR, April 2013: replace randsample with randi 33 | % GAR, June 2013: added list option 34 | % GAR, 7 Jun 2016: removed list option 35 | % GAR, 17 Jun 2016: updated help for github release 36 | 37 | if nargin < 3;nboot=200;end 38 | if nargin < 4;plotit=0;end 39 | 40 | if numel(x) ~= numel(y) 41 | error('shiftdhd: x and y must be the same length') 42 | end 43 | 44 | n=length(x); 45 | c=(37./n.^1.4)+2.75; % The constant c was determined so that the simultaneous 46 | % probability coverage of all 9 differences is 47 | % approximately 95% when sampling from normal 48 | % distributions 49 | 50 | % Get >>ONE<< set of bootstrap samples 51 | % The same set is used for all nine quantiles being compared 52 | list = randi(n,nboot,n); 53 | 54 | xd = zeros(9,1); 55 | yd = zeros(9,1); 56 | delta = zeros(9,1); 57 | deltaCI = zeros(9,2); 58 | bootdelta = zeros(nboot,1); 59 | 60 | for d=1:9 61 | q = d/10; 62 | xd(d) = hd(x,q); 63 | yd(d) = hd(y,q); 64 | delta(d) = xd(d) - yd(d); 65 | for b=1:nboot 66 | bootdelta(b) = hd(x(list(b,:)),q) - hd(y(list(b,:)),q); 67 | end 68 | delta_bse = std(bootdelta,0); 69 | deltaCI(d,1) = delta(d)-c.*delta_bse; 70 | deltaCI(d,2) = delta(d)+c.*delta_bse; 71 | end 72 | 73 | if plotit==1 74 | 75 | figure('Color','w','NumberTitle','off');hold on 76 | 77 | ext = 0.1*(max(xd)-min(xd)); 78 | plot([min(xd)-ext max(xd)+ext],[0 0],'LineWidth',1,'Color',[.5 .5 .5]) % zero line 79 | for qi = 1:9 80 | plot([xd(qi) xd(qi)],[deltaCI(qi,1) deltaCI(qi,2)],'k','LineWidth',2) 81 | end 82 | % mark median 83 | v = axis;plot([xd(5) xd(5)],[v(3) v(4)],'k:') 84 | plot(xd,delta,'ko-','MarkerFaceColor',[.9 .9 .9],'MarkerSize',10,'LineWidth',1) 85 | set(gca,'FontSize',14,'XLim',[min(xd)-ext max(xd)+ext]) 86 | box on 87 | xlabel('Group 1 deciles','FontSize',16) 88 | ylabel('Group 1 - group 2 deciles','FontSize',16) 89 | 90 | end 91 | 92 | %% TEST 93 | % Data from Wilcox p.187 94 | % time1=[0 32 9 0 2 0 41 0 0 0 6 18 3 3 0 11 11 2 0 11]; 95 | % time3=[0 25 10 11 2 0 17 0 3 6 16 9 1 4 0 14 7 5 11 14]; 96 | -------------------------------------------------------------------------------- /shifthd.m: -------------------------------------------------------------------------------- 1 | function [xd, yd, delta, deltaCI] = shifthd(x,y,nboot,plotit) 2 | % [xd yd delta deltaCI] = shifthd(x,y,nboot,plotshift) 3 | % SHIFTHD computes the 95% simultaneous confidence intervals 4 | % for the difference between the deciles of two independent groups 5 | % using the Harrell-Davis quantile estimator, in conjunction with 6 | % percentile bootstrap estimation of the quantiles' standard errors. 7 | % See Wilcox Robust hypothesis testing book 2005 p.151-155 8 | % 9 | % INPUTS: 10 | % - x & y are two vectors without missing values 11 | % - nboot = number of bootstrap samples - default = 200 12 | % - plotit = 1 to get a figure; 0 otherwise by default 13 | % 14 | % OUTPUTS: 15 | % - xd & yd = vectors of quantiles 16 | % - delta = vector of differences between quantiles (x-y) 17 | % - deltaCI = matrix quantiles x low/high bounds of the confidence 18 | % intervals of the quantile differences 19 | % 20 | % Tied values are not allowed. 21 | % If tied values occur, or if you want to estimate quantiles other than the deciles, 22 | % or if you want to use an alpha other than 0.05, use SHIFTHD_PBCI instead. 23 | % 24 | % Adaptation of Rand Wilcox's shifthd R function, 25 | % http://dornsife.usc.edu/labs/rwilcox/software/ 26 | % 27 | % See also HD, SHIFTDHD, SHIFTHD_PBCI 28 | 29 | % Copyright (C) 2007, 2013, 2016 Guillaume Rousselet - University of Glasgow 30 | % GAR, University of Glasgow, Dec 2007 31 | % GAR, April 2013: replace randsample with randi 32 | % GAR, June 2013: added list option 33 | % GAR, 29 May 2016: removed call to bootse, removed list option and fixed bootstrap sampling error - 34 | % use independent bootstrap sample for each decile. 35 | % GAR, 17 Jun 2016: edited help for github release 36 | 37 | if nargin < 3;nboot=200;end 38 | if nargin < 4;plotit=0;end 39 | 40 | nx=length(x); 41 | ny=length(y); 42 | n=min(nx,ny); 43 | c=(80.1./n.^2)+2.73; % The constant c was determined so that the simultaneous 44 | % probability coverage of all 9 differences is 45 | % approximately 95% when sampling from normal 46 | % distributions 47 | 48 | xd = zeros(9,1); 49 | yd = zeros(9,1); 50 | delta = zeros(9,1); 51 | deltaCI = zeros(9,2); 52 | 53 | for d = 1:9 54 | 55 | q = d./10; 56 | xd(d) = hd(x,q); 57 | yd(d) = hd(y,q); 58 | 59 | xboot = zeros(nboot,1); 60 | yboot = zeros(nboot,1); 61 | xlist = randi(nx,nboot,nx); 62 | ylist = randi(ny,nboot,ny); 63 | 64 | % Get a different set of bootstrap samples for each decile 65 | % and each group 66 | for B = 1:nboot 67 | xboot(B) = hd(x(xlist(B,:)),q); 68 | yboot(B) = hd(y(ylist(B,:)),q); 69 | end 70 | 71 | sqrt_var_sum = sqrt( var(xboot) + var(yboot) ); 72 | delta(d) = xd(d)-yd(d); 73 | deltaCI(d,1) = delta(d)-c.*sqrt_var_sum; 74 | deltaCI(d,2) = delta(d)+c.*sqrt_var_sum; 75 | end 76 | 77 | if plotit==1 78 | 79 | figure('Color','w','NumberTitle','off');hold on 80 | 81 | ext = 0.1*(max(xd)-min(xd)); 82 | plot([min(xd)-ext max(xd)+ext],[0 0],'LineWidth',1,'Color',[.5 .5 .5]) % zero line 83 | for qi = 1:9 84 | plot([xd(qi) xd(qi)],[deltaCI(qi,1) deltaCI(qi,2)],'k','LineWidth',2) 85 | end 86 | % mark median 87 | v = axis;plot([xd(5) xd(5)],[v(3) v(4)],'k:') 88 | plot(xd,delta,'ko-','MarkerFaceColor',[.9 .9 .9],'MarkerSize',10,'LineWidth',1) 89 | set(gca,'FontSize',14,'XLim',[min(xd)-ext max(xd)+ext]) 90 | box on 91 | xlabel('Group 1 quantiles','FontSize',16) 92 | ylabel('Group 1 - group 2 quantiles','FontSize',16) 93 | 94 | end 95 | 96 | % Data from Wilcox 2005 p.150 97 | % control=[41 38.4 24.4 25.9 21.9 18.3 13.1 27.3 28.5 -16.9 26 17.4 21.8 15.4 27.4 19.2 22.4 17.7 26 29.4 21.4 26.6 22.7]; 98 | % ozone=[10.1 6.1 20.4 7.3 14.3 15.5 -9.9 6.8 28.2 17.9 -9 -12.9 14 6.6 12.1 15.7 39.9 -15.9 54.6 -14.7 44.1 -9]; 99 | -------------------------------------------------------------------------------- /pb2ig.m: -------------------------------------------------------------------------------- 1 | function [bootdiff,diff,CI,p,sig] = pb2ig(data1,data2,nboot,alpha,est,q,mu) 2 | 3 | %pb2ig - percentile bootstrap test to compare 2 independent groups 4 | % [bootdiff,diff,CI,p,sig] = pb2ig(data1,data2,nboot,alpha,est,q) 5 | % 2 tailed bootstrap test based on the estimation of H1, the 6 | % hypothesis of an experimental effect. 7 | % 8 | % INPUTS: 9 | % ------- 10 | % 11 | % DATA1 and DATA2 are 2 vectors: 12 | % 13 | % nboot (resamples, default 1000) 14 | % alpha (default 5%) 15 | % est (estimator, default 'median') 16 | % q (argument for estimator, default .5 for Harrell-Davis 17 | % estimator, 20% for trimmed mean 18 | % mu (optional null hypothesis, default 0) 19 | % 20 | % OUTPUTS: 21 | % -------- 22 | % 23 | % BOOTDIFF: bootstrapped distributions of differences 24 | % 25 | % LOCI/HICI: low and high boundaries of the confidence interval for 26 | % the difference between 2 groups. Contrary to permtest and 27 | % pbH0, the confidence interval calculated here is not under the 28 | % null hypothesis. Therefore, instead of being centred on zero, it will 29 | % follow the difference between the 2 experimental conditions compared. 30 | % As a simple decisional rule, when the confidence interval under H1 does 31 | % not include zero, the difference is considered significant. 32 | % 33 | % P value of the effect 34 | % 35 | % SIG: significativity of the experimental difference, binary output, 36 | % 1=YES, 0=NO 37 | % 38 | % See also pbci bootse pb2dg hd tm 39 | 40 | % Copyright (C) 2008, 2016 Guillaume Rousselet - University of Glasgow 41 | 42 | % Guillaume A. Rousselet - University of Glasgow - January 2008 43 | % changed randsample to randi - GAR - 25/05/2016 44 | 45 | if nargin<3 || isempty(nboot) 46 | nboot=1000; 47 | end 48 | if nargin<4 || isempty(alpha) 49 | alpha=.05; 50 | end 51 | if nargin<5 || isempty(est) 52 | est='median'; 53 | end 54 | 55 | if nargin<6 || isempty(q) 56 | switch lower(est) 57 | case {'hd'} % Harrell-Davis estimator 58 | q=.5; 59 | case {'tm'} % trimmed mean 60 | q=20; 61 | case {'trimmean'} % trimmed mean - Matlab function 62 | q=20; % later on multiplied by 2 to achieve 20% trimming of both tails 63 | end 64 | end 65 | 66 | n1 = length(data1); 67 | n2 = length(data2); 68 | lo = round(nboot.*alpha./2); % get CI boundary indices 69 | hi = nboot - lo; 70 | lo = lo+1; 71 | 72 | for kk = 1:nboot % bootstrap with replacement loop 73 | switch lower(est) 74 | case {'hd'} % Harrell-Davis estimator 75 | eval(['bootdiff(kk)=',est,'(data1(randi(n1,n1,1)),q) -',est,'(data2(randi(n2,n2,1)),q);']) 76 | case {'tm'} % trimmed mean 77 | eval(['bootdiff(kk)=',est,'(data1(randi(n1,n1,1)),q) -',est,'(data2(randi(n2,n2,1)),q);']) 78 | case {'trimmean'} % trimmed mean - Matlab function 79 | eval(['bootdiff(kk)=',est,'(data1(randi(n1,n1,1)),q.*2) -',est,'(data2(randi(n2,n2,1)),q.*2);']) 80 | otherwise 81 | eval(['bootdiff(kk)=',est,'(data1(randi(n1,n1,1))) -',est,'(data2(randi(n2,n2,1)));']) 82 | end 83 | end 84 | 85 | diffsort = sort(bootdiff); % sort in ascending order 86 | CI(1) = diffsort(lo); 87 | CI(2) = diffsort(hi); 88 | 89 | if nargout > 1 90 | if nargin < 7 || isempty(mu) 91 | mu=0; 92 | end 93 | p = sum(bootdiff400 times faster than limo_harrell_davis 165 | % 166 | % 3d matrix ----------------------------------- 167 | % rng(1) 168 | % hx = randn(100,1); 169 | % x = zeros(2,10,100); 170 | % x(1,:,:) = repmat(hx,1,10)'; 171 | % x(2,:,:) = repmat(hx,1,10)'; 172 | % hxhd = zeros(2,10); 173 | % hCI = zeros(2,10,2); 174 | % tic 175 | % for E = 1:2 176 | % for F = 1:10 177 | % rng(1) 178 | % [xhd(E,F),hCI(E,F,:)] = hdpbci(squeeze(x(E,F,:)),q,nboot,alpha); 179 | % end 180 | % end 181 | % toc 182 | % rng(1) 183 | % tic 184 | % res = hd3d(x,q,nboot,alpha); 185 | % toc % >70 times faster than loop 186 | 187 | -------------------------------------------------------------------------------- /pb2dg.m: -------------------------------------------------------------------------------- 1 | function [bootdiff,diff,CI,p,sig,padj] = pb2dg(data1,data2,nboot,alpha,est,q,mu) 2 | 3 | %pb2dg - percentile bootstrap test to compare 2 dependent groups 4 | % [bootdiff,diffCI,p,sig,padj] = pb2dg(data1,data2,nboot,alpha,est,q,mu) 5 | % 2 tailed bootstrap test based on sampling with replacement pairs 6 | % of observations, computing an estimate separately for each group (e.g. 7 | % the median), and subtracting the two estimates. 8 | % To compute a confidence interval of the pairwise differences, 9 | % use pbci instead. 10 | % The 2 groups must have the same size. 11 | % 12 | % INPUTS: 13 | % ------- 14 | % 15 | % DATA1 and DATA2 are 2 vectors: 16 | % 17 | % nboot (resamples, default 1000) 18 | % alpha (default 5%) 19 | % est (estimator, default 'median') 20 | % q (argument for estimator, default .5 for Harrell-Davis 21 | % estimator, 20% for trimmed mean 22 | % mu (optional null hypothesis, default 0) 23 | % 24 | % OUTPUTS: 25 | % -------- 26 | % 27 | % BOOTDIFF: bootstrapped distributions of differences 28 | % 29 | % DIFF: difference between the two estimates 30 | % 31 | % LOCI/HICI: low and high boundaries of the confidence interval for 32 | % the difference between 2 groups. Contrary to permtest and 33 | % pbH0, the confidence interval calculated here is not under the 34 | % null hypothesis. Therefore, instead of being centred on zero, it will 35 | % follow the difference between the 2 experimental conditions compared. 36 | % As a simple decisional rule, when the confidence interval under H1 does 37 | % not include zero, the difference is considered significant. 38 | % 39 | % P value of the effect 40 | % 41 | % SIG: significativity of the experimental difference, binary output, 42 | % 1=YES, 0=NO 43 | % 44 | % PADJ: adjusted p-value 45 | % The percentile bootstrap method above can be unsatisfactory when making 46 | % inferences about means, variances, and in the case of small sample sizes 47 | % with M-estimators or the Harrell-Davis estimate of the median. 48 | % The risk is to have an actual type I error rate lower than the nominal 49 | % level. We can correct for that by computing a bias-adjusted p-value. 50 | % See Wilcox 2005 p.192-193 51 | % 52 | % See also pbci bootse pb2ig hd tm 53 | 54 | % Copyright (C) 2008, 2016 Guillaume Rousselet - University of Glasgow 55 | 56 | % Guillaume A. Rousselet - University of Glasgow - January 2008 57 | % added bias-adjusted p-value - Nov 2008 58 | % changed randsample to randi - GAR - 25/05/2016 59 | 60 | if nargin<3 || isempty(nboot) 61 | nboot=1000; 62 | end 63 | if nargin<4 || isempty(alpha) 64 | alpha=.05; 65 | end 66 | if nargin<5 || isempty(est) 67 | est='median'; 68 | end 69 | 70 | if nargin<6 || isempty(q) 71 | switch lower(est) 72 | case {'hd'} % Harrell-Davis estimator 73 | q=.5; 74 | case {'tm'} % trimmed mean 75 | q=20; 76 | case {'trimmean'} % trimmed mean - Matlab function 77 | q=20; % later on multiplied by 2 to achieve 20% trimming of both tails 78 | otherwise 79 | q=0; 80 | end 81 | end 82 | 83 | switch lower(est) 84 | case {'hd'} % Harrell-Davis estimator 85 | eval(['diff=',est,'(data1,q) -',est,'(data2,q);']) 86 | case {'tm'} % trimmed mean 87 | eval(['diff=',est,'(data1,q) -',est,'(data2,q);']) 88 | case {'trimmean'} % trimmed mean - Matlab function 89 | eval(['diff=',est,'(data1,q.*2) -',est,'(data2,q.*2);']) 90 | otherwise 91 | eval(['diff=',est,'(data1) -',est,'(data2);']) 92 | end 93 | 94 | n1 = length(data1); 95 | % n2 = length(data2); 96 | lo = round(nboot.*alpha./2); % get CI boundary indices 97 | hi = nboot - lo; 98 | lo = lo + 1; 99 | 100 | for kk = 1:nboot % bootstrap with replacement loop 101 | bootsamp = randi(n1,n1,1); % sample pairs of observations 102 | switch lower(est) 103 | case {'hd'} % Harrell-Davis estimator 104 | eval(['bootdiff(kk)=',est,'(data1(bootsamp),q) -',est,'(data2(bootsamp),q);']) 105 | case {'tm'} % trimmed mean 106 | eval(['bootdiff(kk)=',est,'(data1(bootsamp),q) -',est,'(data2(bootsamp),q);']) 107 | case {'trimmean'} % trimmed mean - Matlab function 108 | eval(['bootdiff(kk)=',est,'(data1(bootsamp),q.*2) -',est,'(data2(bootsamp),q.*2);']) 109 | otherwise 110 | eval(['bootdiff(kk)=',est,'(data1(bootsamp)) -',est,'(data2(bootsamp));']) 111 | end 112 | end 113 | 114 | diffsort = sort(bootdiff); % sort in ascending order 115 | CI(1) = diffsort(lo); 116 | CI(2) = diffsort(hi); 117 | 118 | % Compute P value 119 | if nargin < 7 || isempty(mu) 120 | mu=0; 121 | end 122 | p = sum(bootdiff 21 | Everyone is permitted to copy and distribute verbatim copies 22 | of this license document, but changing it is not allowed. 23 | 24 | Preamble 25 | 26 | The GNU General Public License is a free, copyleft license for 27 | software and other kinds of works. 28 | 29 | The licenses for most software and other practical works are designed 30 | to take away your freedom to share and change the works. By contrast, 31 | the GNU General Public License is intended to guarantee your freedom to 32 | share and change all versions of a program--to make sure it remains free 33 | software for all its users. We, the Free Software Foundation, use the 34 | GNU General Public License for most of our software; it applies also to 35 | any other work released this way by its authors. You can apply it to 36 | your programs, too. 37 | 38 | When we speak of free software, we are referring to freedom, not 39 | price. Our General Public Licenses are designed to make sure that you 40 | have the freedom to distribute copies of free software (and charge for 41 | them if you wish), that you receive source code or can get it if you 42 | want it, that you can change the software or use pieces of it in new 43 | free programs, and that you know you can do these things. 44 | 45 | To protect your rights, we need to prevent others from denying you 46 | these rights or asking you to surrender the rights. Therefore, you have 47 | certain responsibilities if you distribute copies of the software, or if 48 | you modify it: responsibilities to respect the freedom of others. 49 | 50 | For example, if you distribute copies of such a program, whether 51 | gratis or for a fee, you must pass on to the recipients the same 52 | freedoms that you received. You must make sure that they, too, receive 53 | or can get the source code. And you must show them these terms so they 54 | know their rights. 55 | 56 | Developers that use the GNU GPL protect your rights with two steps: 57 | (1) assert copyright on the software, and (2) offer you this License 58 | giving you legal permission to copy, distribute and/or modify it. 59 | 60 | For the developers' and authors' protection, the GPL clearly explains 61 | that there is no warranty for this free software. For both users' and 62 | authors' sake, the GPL requires that modified versions be marked as 63 | changed, so that their problems will not be attributed erroneously to 64 | authors of previous versions. 65 | 66 | Some devices are designed to deny users access to install or run 67 | modified versions of the software inside them, although the manufacturer 68 | can do so. This is fundamentally incompatible with the aim of 69 | protecting users' freedom to change the software. The systematic 70 | pattern of such abuse occurs in the area of products for individuals to 71 | use, which is precisely where it is most unacceptable. Therefore, we 72 | have designed this version of the GPL to prohibit the practice for those 73 | products. If such problems arise substantially in other domains, we 74 | stand ready to extend this provision to those domains in future versions 75 | of the GPL, as needed to protect the freedom of users. 76 | 77 | Finally, every program is threatened constantly by software patents. 78 | States should not allow patents to restrict development and use of 79 | software on general-purpose computers, but in those that do, we wish to 80 | avoid the special danger that patents applied to a free program could 81 | make it effectively proprietary. To prevent this, the GPL assures that 82 | patents cannot be used to render the program non-free. 83 | 84 | The precise terms and conditions for copying, distribution and 85 | modification follow. 86 | 87 | TERMS AND CONDITIONS 88 | 89 | 0. Definitions. 90 | 91 | "This License" refers to version 3 of the GNU General Public License. 92 | 93 | "Copyright" also means copyright-like laws that apply to other kinds of 94 | works, such as semiconductor masks. 95 | 96 | "The Program" refers to any copyrightable work licensed under this 97 | License. Each licensee is addressed as "you". "Licensees" and 98 | "recipients" may be individuals or organizations. 99 | 100 | To "modify" a work means to copy from or adapt all or part of the work 101 | in a fashion requiring copyright permission, other than the making of an 102 | exact copy. The resulting work is called a "modified version" of the 103 | earlier work or a work "based on" the earlier work. 104 | 105 | A "covered work" means either the unmodified Program or a work based 106 | on the Program. 107 | 108 | To "propagate" a work means to do anything with it that, without 109 | permission, would make you directly or secondarily liable for 110 | infringement under applicable copyright law, except executing it on a 111 | computer or modifying a private copy. Propagation includes copying, 112 | distribution (with or without modification), making available to the 113 | public, and in some countries other activities as well. 114 | 115 | To "convey" a work means any kind of propagation that enables other 116 | parties to make or receive copies. Mere interaction with a user through 117 | a computer network, with no transfer of a copy, is not conveying. 118 | 119 | An interactive user interface displays "Appropriate Legal Notices" 120 | to the extent that it includes a convenient and prominently visible 121 | feature that (1) displays an appropriate copyright notice, and (2) 122 | tells the user that there is no warranty for the work (except to the 123 | extent that warranties are provided), that licensees may convey the 124 | work under this License, and how to view a copy of this License. If 125 | the interface presents a list of user commands or options, such as a 126 | menu, a prominent item in the list meets this criterion. 127 | 128 | 1. Source Code. 129 | 130 | The "source code" for a work means the preferred form of the work 131 | for making modifications to it. "Object code" means any non-source 132 | form of a work. 133 | 134 | A "Standard Interface" means an interface that either is an official 135 | standard defined by a recognized standards body, or, in the case of 136 | interfaces specified for a particular programming language, one that 137 | is widely used among developers working in that language. 138 | 139 | The "System Libraries" of an executable work include anything, other 140 | than the work as a whole, that (a) is included in the normal form of 141 | packaging a Major Component, but which is not part of that Major 142 | Component, and (b) serves only to enable use of the work with that 143 | Major Component, or to implement a Standard Interface for which an 144 | implementation is available to the public in source code form. A 145 | "Major Component", in this context, means a major essential component 146 | (kernel, window system, and so on) of the specific operating system 147 | (if any) on which the executable work runs, or a compiler used to 148 | produce the work, or an object code interpreter used to run it. 149 | 150 | The "Corresponding Source" for a work in object code form means all 151 | the source code needed to generate, install, and (for an executable 152 | work) run the object code and to modify the work, including scripts to 153 | control those activities. However, it does not include the work's 154 | System Libraries, or general-purpose tools or generally available free 155 | programs which are used unmodified in performing those activities but 156 | which are not part of the work. For example, Corresponding Source 157 | includes interface definition files associated with source files for 158 | the work, and the source code for shared libraries and dynamically 159 | linked subprograms that the work is specifically designed to require, 160 | such as by intimate data communication or control flow between those 161 | subprograms and other parts of the work. 162 | 163 | The Corresponding Source need not include anything that users 164 | can regenerate automatically from other parts of the Corresponding 165 | Source. 166 | 167 | The Corresponding Source for a work in source code form is that 168 | same work. 169 | 170 | 2. Basic Permissions. 171 | 172 | All rights granted under this License are granted for the term of 173 | copyright on the Program, and are irrevocable provided the stated 174 | conditions are met. This License explicitly affirms your unlimited 175 | permission to run the unmodified Program. The output from running a 176 | covered work is covered by this License only if the output, given its 177 | content, constitutes a covered work. This License acknowledges your 178 | rights of fair use or other equivalent, as provided by copyright law. 179 | 180 | You may make, run and propagate covered works that you do not 181 | convey, without conditions so long as your license otherwise remains 182 | in force. You may convey covered works to others for the sole purpose 183 | of having them make modifications exclusively for you, or provide you 184 | with facilities for running those works, provided that you comply with 185 | the terms of this License in conveying all material for which you do 186 | not control copyright. Those thus making or running the covered works 187 | for you must do so exclusively on your behalf, under your direction 188 | and control, on terms that prohibit them from making any copies of 189 | your copyrighted material outside their relationship with you. 190 | 191 | Conveying under any other circumstances is permitted solely under 192 | the conditions stated below. Sublicensing is not allowed; section 10 193 | makes it unnecessary. 194 | 195 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 196 | 197 | No covered work shall be deemed part of an effective technological 198 | measure under any applicable law fulfilling obligations under article 199 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 200 | similar laws prohibiting or restricting circumvention of such 201 | measures. 202 | 203 | When you convey a covered work, you waive any legal power to forbid 204 | circumvention of technological measures to the extent such circumvention 205 | is effected by exercising rights under this License with respect to 206 | the covered work, and you disclaim any intention to limit operation or 207 | modification of the work as a means of enforcing, against the work's 208 | users, your or third parties' legal rights to forbid circumvention of 209 | technological measures. 210 | 211 | 4. Conveying Verbatim Copies. 212 | 213 | You may convey verbatim copies of the Program's source code as you 214 | receive it, in any medium, provided that you conspicuously and 215 | appropriately publish on each copy an appropriate copyright notice; 216 | keep intact all notices stating that this License and any 217 | non-permissive terms added in accord with section 7 apply to the code; 218 | keep intact all notices of the absence of any warranty; and give all 219 | recipients a copy of this License along with the Program. 220 | 221 | You may charge any price or no price for each copy that you convey, 222 | and you may offer support or warranty protection for a fee. 223 | 224 | 5. Conveying Modified Source Versions. 225 | 226 | You may convey a work based on the Program, or the modifications to 227 | produce it from the Program, in the form of source code under the 228 | terms of section 4, provided that you also meet all of these conditions: 229 | 230 | a) The work must carry prominent notices stating that you modified 231 | it, and giving a relevant date. 232 | 233 | b) The work must carry prominent notices stating that it is 234 | released under this License and any conditions added under section 235 | 7. This requirement modifies the requirement in section 4 to 236 | "keep intact all notices". 237 | 238 | c) You must license the entire work, as a whole, under this 239 | License to anyone who comes into possession of a copy. This 240 | License will therefore apply, along with any applicable section 7 241 | additional terms, to the whole of the work, and all its parts, 242 | regardless of how they are packaged. This License gives no 243 | permission to license the work in any other way, but it does not 244 | invalidate such permission if you have separately received it. 245 | 246 | d) If the work has interactive user interfaces, each must display 247 | Appropriate Legal Notices; however, if the Program has interactive 248 | interfaces that do not display Appropriate Legal Notices, your 249 | work need not make them do so. 250 | 251 | A compilation of a covered work with other separate and independent 252 | works, which are not by their nature extensions of the covered work, 253 | and which are not combined with it such as to form a larger program, 254 | in or on a volume of a storage or distribution medium, is called an 255 | "aggregate" if the compilation and its resulting copyright are not 256 | used to limit the access or legal rights of the compilation's users 257 | beyond what the individual works permit. Inclusion of a covered work 258 | in an aggregate does not cause this License to apply to the other 259 | parts of the aggregate. 260 | 261 | 6. Conveying Non-Source Forms. 262 | 263 | You may convey a covered work in object code form under the terms 264 | of sections 4 and 5, provided that you also convey the 265 | machine-readable Corresponding Source under the terms of this License, 266 | in one of these ways: 267 | 268 | a) Convey the object code in, or embodied in, a physical product 269 | (including a physical distribution medium), accompanied by the 270 | Corresponding Source fixed on a durable physical medium 271 | customarily used for software interchange. 272 | 273 | b) Convey the object code in, or embodied in, a physical product 274 | (including a physical distribution medium), accompanied by a 275 | written offer, valid for at least three years and valid for as 276 | long as you offer spare parts or customer support for that product 277 | model, to give anyone who possesses the object code either (1) a 278 | copy of the Corresponding Source for all the software in the 279 | product that is covered by this License, on a durable physical 280 | medium customarily used for software interchange, for a price no 281 | more than your reasonable cost of physically performing this 282 | conveying of source, or (2) access to copy the 283 | Corresponding Source from a network server at no charge. 284 | 285 | c) Convey individual copies of the object code with a copy of the 286 | written offer to provide the Corresponding Source. This 287 | alternative is allowed only occasionally and noncommercially, and 288 | only if you received the object code with such an offer, in accord 289 | with subsection 6b. 290 | 291 | d) Convey the object code by offering access from a designated 292 | place (gratis or for a charge), and offer equivalent access to the 293 | Corresponding Source in the same way through the same place at no 294 | further charge. You need not require recipients to copy the 295 | Corresponding Source along with the object code. If the place to 296 | copy the object code is a network server, the Corresponding Source 297 | may be on a different server (operated by you or a third party) 298 | that supports equivalent copying facilities, provided you maintain 299 | clear directions next to the object code saying where to find the 300 | Corresponding Source. Regardless of what server hosts the 301 | Corresponding Source, you remain obligated to ensure that it is 302 | available for as long as needed to satisfy these requirements. 303 | 304 | e) Convey the object code using peer-to-peer transmission, provided 305 | you inform other peers where the object code and Corresponding 306 | Source of the work are being offered to the general public at no 307 | charge under subsection 6d. 308 | 309 | A separable portion of the object code, whose source code is excluded 310 | from the Corresponding Source as a System Library, need not be 311 | included in conveying the object code work. 312 | 313 | A "User Product" is either (1) a "consumer product", which means any 314 | tangible personal property which is normally used for personal, family, 315 | or household purposes, or (2) anything designed or sold for incorporation 316 | into a dwelling. In determining whether a product is a consumer product, 317 | doubtful cases shall be resolved in favor of coverage. For a particular 318 | product received by a particular user, "normally used" refers to a 319 | typical or common use of that class of product, regardless of the status 320 | of the particular user or of the way in which the particular user 321 | actually uses, or expects or is expected to use, the product. A product 322 | is a consumer product regardless of whether the product has substantial 323 | commercial, industrial or non-consumer uses, unless such uses represent 324 | the only significant mode of use of the product. 325 | 326 | "Installation Information" for a User Product means any methods, 327 | procedures, authorization keys, or other information required to install 328 | and execute modified versions of a covered work in that User Product from 329 | a modified version of its Corresponding Source. The information must 330 | suffice to ensure that the continued functioning of the modified object 331 | code is in no case prevented or interfered with solely because 332 | modification has been made. 333 | 334 | If you convey an object code work under this section in, or with, or 335 | specifically for use in, a User Product, and the conveying occurs as 336 | part of a transaction in which the right of possession and use of the 337 | User Product is transferred to the recipient in perpetuity or for a 338 | fixed term (regardless of how the transaction is characterized), the 339 | Corresponding Source conveyed under this section must be accompanied 340 | by the Installation Information. But this requirement does not apply 341 | if neither you nor any third party retains the ability to install 342 | modified object code on the User Product (for example, the work has 343 | been installed in ROM). 344 | 345 | The requirement to provide Installation Information does not include a 346 | requirement to continue to provide support service, warranty, or updates 347 | for a work that has been modified or installed by the recipient, or for 348 | the User Product in which it has been modified or installed. Access to a 349 | network may be denied when the modification itself materially and 350 | adversely affects the operation of the network or violates the rules and 351 | protocols for communication across the network. 352 | 353 | Corresponding Source conveyed, and Installation Information provided, 354 | in accord with this section must be in a format that is publicly 355 | documented (and with an implementation available to the public in 356 | source code form), and must require no special password or key for 357 | unpacking, reading or copying. 358 | 359 | 7. Additional Terms. 360 | 361 | "Additional permissions" are terms that supplement the terms of this 362 | License by making exceptions from one or more of its conditions. 363 | Additional permissions that are applicable to the entire Program shall 364 | be treated as though they were included in this License, to the extent 365 | that they are valid under applicable law. If additional permissions 366 | apply only to part of the Program, that part may be used separately 367 | under those permissions, but the entire Program remains governed by 368 | this License without regard to the additional permissions. 369 | 370 | When you convey a copy of a covered work, you may at your option 371 | remove any additional permissions from that copy, or from any part of 372 | it. (Additional permissions may be written to require their own 373 | removal in certain cases when you modify the work.) You may place 374 | additional permissions on material, added by you to a covered work, 375 | for which you have or can give appropriate copyright permission. 376 | 377 | Notwithstanding any other provision of this License, for material you 378 | add to a covered work, you may (if authorized by the copyright holders of 379 | that material) supplement the terms of this License with terms: 380 | 381 | a) Disclaiming warranty or limiting liability differently from the 382 | terms of sections 15 and 16 of this License; or 383 | 384 | b) Requiring preservation of specified reasonable legal notices or 385 | author attributions in that material or in the Appropriate Legal 386 | Notices displayed by works containing it; or 387 | 388 | c) Prohibiting misrepresentation of the origin of that material, or 389 | requiring that modified versions of such material be marked in 390 | reasonable ways as different from the original version; or 391 | 392 | d) Limiting the use for publicity purposes of names of licensors or 393 | authors of the material; or 394 | 395 | e) Declining to grant rights under trademark law for use of some 396 | trade names, trademarks, or service marks; or 397 | 398 | f) Requiring indemnification of licensors and authors of that 399 | material by anyone who conveys the material (or modified versions of 400 | it) with contractual assumptions of liability to the recipient, for 401 | any liability that these contractual assumptions directly impose on 402 | those licensors and authors. 403 | 404 | All other non-permissive additional terms are considered "further 405 | restrictions" within the meaning of section 10. If the Program as you 406 | received it, or any part of it, contains a notice stating that it is 407 | governed by this License along with a term that is a further 408 | restriction, you may remove that term. If a license document contains 409 | a further restriction but permits relicensing or conveying under this 410 | License, you may add to a covered work material governed by the terms 411 | of that license document, provided that the further restriction does 412 | not survive such relicensing or conveying. 413 | 414 | If you add terms to a covered work in accord with this section, you 415 | must place, in the relevant source files, a statement of the 416 | additional terms that apply to those files, or a notice indicating 417 | where to find the applicable terms. 418 | 419 | Additional terms, permissive or non-permissive, may be stated in the 420 | form of a separately written license, or stated as exceptions; 421 | the above requirements apply either way. 422 | 423 | 8. Termination. 424 | 425 | You may not propagate or modify a covered work except as expressly 426 | provided under this License. Any attempt otherwise to propagate or 427 | modify it is void, and will automatically terminate your rights under 428 | this License (including any patent licenses granted under the third 429 | paragraph of section 11). 430 | 431 | However, if you cease all violation of this License, then your 432 | license from a particular copyright holder is reinstated (a) 433 | provisionally, unless and until the copyright holder explicitly and 434 | finally terminates your license, and (b) permanently, if the copyright 435 | holder fails to notify you of the violation by some reasonable means 436 | prior to 60 days after the cessation. 437 | 438 | Moreover, your license from a particular copyright holder is 439 | reinstated permanently if the copyright holder notifies you of the 440 | violation by some reasonable means, this is the first time you have 441 | received notice of violation of this License (for any work) from that 442 | copyright holder, and you cure the violation prior to 30 days after 443 | your receipt of the notice. 444 | 445 | Termination of your rights under this section does not terminate the 446 | licenses of parties who have received copies or rights from you under 447 | this License. If your rights have been terminated and not permanently 448 | reinstated, you do not qualify to receive new licenses for the same 449 | material under section 10. 450 | 451 | 9. Acceptance Not Required for Having Copies. 452 | 453 | You are not required to accept this License in order to receive or 454 | run a copy of the Program. Ancillary propagation of a covered work 455 | occurring solely as a consequence of using peer-to-peer transmission 456 | to receive a copy likewise does not require acceptance. However, 457 | nothing other than this License grants you permission to propagate or 458 | modify any covered work. These actions infringe copyright if you do 459 | not accept this License. Therefore, by modifying or propagating a 460 | covered work, you indicate your acceptance of this License to do so. 461 | 462 | 10. Automatic Licensing of Downstream Recipients. 463 | 464 | Each time you convey a covered work, the recipient automatically 465 | receives a license from the original licensors, to run, modify and 466 | propagate that work, subject to this License. You are not responsible 467 | for enforcing compliance by third parties with this License. 468 | 469 | An "entity transaction" is a transaction transferring control of an 470 | organization, or substantially all assets of one, or subdividing an 471 | organization, or merging organizations. If propagation of a covered 472 | work results from an entity transaction, each party to that 473 | transaction who receives a copy of the work also receives whatever 474 | licenses to the work the party's predecessor in interest had or could 475 | give under the previous paragraph, plus a right to possession of the 476 | Corresponding Source of the work from the predecessor in interest, if 477 | the predecessor has it or can get it with reasonable efforts. 478 | 479 | You may not impose any further restrictions on the exercise of the 480 | rights granted or affirmed under this License. For example, you may 481 | not impose a license fee, royalty, or other charge for exercise of 482 | rights granted under this License, and you may not initiate litigation 483 | (including a cross-claim or counterclaim in a lawsuit) alleging that 484 | any patent claim is infringed by making, using, selling, offering for 485 | sale, or importing the Program or any portion of it. 486 | 487 | 11. Patents. 488 | 489 | A "contributor" is a copyright holder who authorizes use under this 490 | License of the Program or a work on which the Program is based. The 491 | work thus licensed is called the contributor's "contributor version". 492 | 493 | A contributor's "essential patent claims" are all patent claims 494 | owned or controlled by the contributor, whether already acquired or 495 | hereafter acquired, that would be infringed by some manner, permitted 496 | by this License, of making, using, or selling its contributor version, 497 | but do not include claims that would be infringed only as a 498 | consequence of further modification of the contributor version. For 499 | purposes of this definition, "control" includes the right to grant 500 | patent sublicenses in a manner consistent with the requirements of 501 | this License. 502 | 503 | Each contributor grants you a non-exclusive, worldwide, royalty-free 504 | patent license under the contributor's essential patent claims, to 505 | make, use, sell, offer for sale, import and otherwise run, modify and 506 | propagate the contents of its contributor version. 507 | 508 | In the following three paragraphs, a "patent license" is any express 509 | agreement or commitment, however denominated, not to enforce a patent 510 | (such as an express permission to practice a patent or covenant not to 511 | sue for patent infringement). To "grant" such a patent license to a 512 | party means to make such an agreement or commitment not to enforce a 513 | patent against the party. 514 | 515 | If you convey a covered work, knowingly relying on a patent license, 516 | and the Corresponding Source of the work is not available for anyone 517 | to copy, free of charge and under the terms of this License, through a 518 | publicly available network server or other readily accessible means, 519 | then you must either (1) cause the Corresponding Source to be so 520 | available, or (2) arrange to deprive yourself of the benefit of the 521 | patent license for this particular work, or (3) arrange, in a manner 522 | consistent with the requirements of this License, to extend the patent 523 | license to downstream recipients. "Knowingly relying" means you have 524 | actual knowledge that, but for the patent license, your conveying the 525 | covered work in a country, or your recipient's use of the covered work 526 | in a country, would infringe one or more identifiable patents in that 527 | country that you have reason to believe are valid. 528 | 529 | If, pursuant to or in connection with a single transaction or 530 | arrangement, you convey, or propagate by procuring conveyance of, a 531 | covered work, and grant a patent license to some of the parties 532 | receiving the covered work authorizing them to use, propagate, modify 533 | or convey a specific copy of the covered work, then the patent license 534 | you grant is automatically extended to all recipients of the covered 535 | work and works based on it. 536 | 537 | A patent license is "discriminatory" if it does not include within 538 | the scope of its coverage, prohibits the exercise of, or is 539 | conditioned on the non-exercise of one or more of the rights that are 540 | specifically granted under this License. You may not convey a covered 541 | work if you are a party to an arrangement with a third party that is 542 | in the business of distributing software, under which you make payment 543 | to the third party based on the extent of your activity of conveying 544 | the work, and under which the third party grants, to any of the 545 | parties who would receive the covered work from you, a discriminatory 546 | patent license (a) in connection with copies of the covered work 547 | conveyed by you (or copies made from those copies), or (b) primarily 548 | for and in connection with specific products or compilations that 549 | contain the covered work, unless you entered into that arrangement, 550 | or that patent license was granted, prior to 28 March 2007. 551 | 552 | Nothing in this License shall be construed as excluding or limiting 553 | any implied license or other defenses to infringement that may 554 | otherwise be available to you under applicable patent law. 555 | 556 | 12. No Surrender of Others' Freedom. 557 | 558 | If conditions are imposed on you (whether by court order, agreement or 559 | otherwise) that contradict the conditions of this License, they do not 560 | excuse you from the conditions of this License. If you cannot convey a 561 | covered work so as to satisfy simultaneously your obligations under this 562 | License and any other pertinent obligations, then as a consequence you may 563 | not convey it at all. For example, if you agree to terms that obligate you 564 | to collect a royalty for further conveying from those to whom you convey 565 | the Program, the only way you could satisfy both those terms and this 566 | License would be to refrain entirely from conveying the Program. 567 | 568 | 13. Use with the GNU Affero General Public License. 569 | 570 | Notwithstanding any other provision of this License, you have 571 | permission to link or combine any covered work with a work licensed 572 | under version 3 of the GNU Affero General Public License into a single 573 | combined work, and to convey the resulting work. The terms of this 574 | License will continue to apply to the part which is the covered work, 575 | but the special requirements of the GNU Affero General Public License, 576 | section 13, concerning interaction through a network will apply to the 577 | combination as such. 578 | 579 | 14. Revised Versions of this License. 580 | 581 | The Free Software Foundation may publish revised and/or new versions of 582 | the GNU General Public License from time to time. Such new versions will 583 | be similar in spirit to the present version, but may differ in detail to 584 | address new problems or concerns. 585 | 586 | Each version is given a distinguishing version number. If the 587 | Program specifies that a certain numbered version of the GNU General 588 | Public License "or any later version" applies to it, you have the 589 | option of following the terms and conditions either of that numbered 590 | version or of any later version published by the Free Software 591 | Foundation. If the Program does not specify a version number of the 592 | GNU General Public License, you may choose any version ever published 593 | by the Free Software Foundation. 594 | 595 | If the Program specifies that a proxy can decide which future 596 | versions of the GNU General Public License can be used, that proxy's 597 | public statement of acceptance of a version permanently authorizes you 598 | to choose that version for the Program. 599 | 600 | Later license versions may give you additional or different 601 | permissions. However, no additional obligations are imposed on any 602 | author or copyright holder as a result of your choosing to follow a 603 | later version. 604 | 605 | 15. Disclaimer of Warranty. 606 | 607 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 608 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 609 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 610 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 611 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 612 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 613 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 614 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 615 | 616 | 16. Limitation of Liability. 617 | 618 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 619 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 620 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 621 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 622 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 623 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 624 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 625 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 626 | SUCH DAMAGES. 627 | 628 | 17. Interpretation of Sections 15 and 16. 629 | 630 | If the disclaimer of warranty and limitation of liability provided 631 | above cannot be given local legal effect according to their terms, 632 | reviewing courts shall apply local law that most closely approximates 633 | an absolute waiver of all civil liability in connection with the 634 | Program, unless a warranty or assumption of liability accompanies a 635 | copy of the Program in return for a fee. 636 | 637 | END OF TERMS AND CONDITIONS 638 | 639 | How to Apply These Terms to Your New Programs 640 | 641 | If you develop a new program, and you want it to be of the greatest 642 | possible use to the public, the best way to achieve this is to make it 643 | free software which everyone can redistribute and change under these terms. 644 | 645 | To do so, attach the following notices to the program. It is safest 646 | to attach them to the start of each source file to most effectively 647 | state the exclusion of warranty; and each file should have at least 648 | the "copyright" line and a pointer to where the full notice is found. 649 | 650 | 651 | Copyright (C) 652 | 653 | This program is free software: you can redistribute it and/or modify 654 | it under the terms of the GNU General Public License as published by 655 | the Free Software Foundation, either version 3 of the License, or 656 | (at your option) any later version. 657 | 658 | This program is distributed in the hope that it will be useful, 659 | but WITHOUT ANY WARRANTY; without even the implied warranty of 660 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 661 | GNU General Public License for more details. 662 | 663 | You should have received a copy of the GNU General Public License 664 | along with this program. If not, see . 665 | 666 | Also add information on how to contact you by electronic and paper mail. 667 | 668 | If the program does terminal interaction, make it output a short 669 | notice like this when it starts in an interactive mode: 670 | 671 | Copyright (C) 672 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 673 | This is free software, and you are welcome to redistribute it 674 | under certain conditions; type `show c' for details. 675 | 676 | The hypothetical commands `show w' and `show c' should show the appropriate 677 | parts of the General Public License. Of course, your program's commands 678 | might be different; for a GUI interface, you would use an "about box". 679 | 680 | You should also get your employer (if you work as a programmer) or school, 681 | if any, to sign a "copyright disclaimer" for the program, if necessary. 682 | For more information on this, and how to apply and follow the GNU GPL, see 683 | . 684 | 685 | The GNU General Public License does not permit incorporating your program 686 | into proprietary programs. If your program is a subroutine library, you 687 | may consider it more useful to permit linking proprietary applications with 688 | the library. If this is what you want to do, use the GNU Lesser General 689 | Public License instead of this License. But first, please read 690 | . --------------------------------------------------------------------------------