|
3 | 3 | % Bootstrap null hypothesis significance test (NHST)
|
4 | 4 | %
|
5 | 5 | % p = bootnhst(DATA,GROUP)
|
6 |
| -% p = bootnhst(DATA,GROUP,ref) |
7 |
| -% p = bootnhst(DATA,GROUP,ref,bootfun,nboot) |
8 |
| -% p = bootnhst(DATA,GROUP,ref,bootfun,nboot) |
9 |
| -% p = bootnhst(DATA,GROUP,ref,bootfun,nboot,paropt) |
| 6 | +% p = bootnhst(DATA,GROUP,bootfun) |
| 7 | +% p = bootnhst(DATA,GROUP,bootfun,nboot) |
| 8 | +% p = bootnhst(DATA,GROUP,bootfun,nboot,ref) |
| 9 | +% p = bootnhst(DATA,GROUP,bootfun,nboot,ref,paropt) |
10 | 10 | % [p,c] = bootnhst(DATA,GROUP,...)
|
11 | 11 | % [p,c,stats] = bootnhst(DATA,GROUP,...)
|
12 | 12 | % bootnhst(DATA,GROUP,...);
|
|
46 | 46 | % consideration in hypothesis testing but they will still contribute to
|
47 | 47 | % the estimate of the pooled (weighted mean) sampling variance.
|
48 | 48 | %
|
49 |
| -% p = bootnhst(DATA,GROUP,ref) also sets the GROUP to use as the reference |
50 |
| -% GROUP for post hoc tests. For one-way ANOVA-like experimental designs this |
51 |
| -% will usually be the control GROUP. If all pairwise comparisons are desired, |
52 |
| -% then set ref to 'pairwise' or leave empty. By default, pairwise comparisons |
53 |
| -% are computed for post hoc tests. |
54 |
| -% |
55 |
| -% p = bootnhst(DATA,GROUP,ref,bootfun) also sets the statistic calculated |
| 49 | +% p = bootnhst(DATA,GROUP,bootfun) also sets the statistic calculated |
56 | 50 | % from the bootstrap samples. This can be a function handle or string
|
57 | 51 | % corresponding to the function name. If empty, the default is @mean or
|
58 | 52 | % 'mean'. If DATA is multivariate, bootfun is the grand mean, which is
|
|
62 | 56 | % implements a smoothed version of the median (see function help for
|
63 | 57 | % smoothmedian).
|
64 | 58 | %
|
65 |
| -% p = bootnhst(DATA,GROUP,ref,bootfun,nboot) sets the number of bootstrap |
66 |
| -% resamples. Increasing nboot reduces the monte carlo error of the p-value |
67 |
| -% estimates but the calculations take longer to complete. When nboot is |
68 |
| -% empty or not provided, the default (and minimum allowable nboot to |
69 |
| -% to compute two-tailed p-values down to 0.001) is 1000 - an error is |
70 |
| -% returned if the nboot provided by the user is lower than this. |
| 59 | +% p = bootnhst(DATA,GROUP,bootfun,nboot) sets the number of bootstrap |
| 60 | +% resamples. Increasing nboot reduces the monte carlo error of the p- |
| 61 | +% value estimates but the calculations take longer to complete. When |
| 62 | +% nboot is empty or not provided, the default (and minimum allowable |
| 63 | +% nboot to compute two-tailed p-values down to 0.001) is 1000 - an |
| 64 | +% error is returned if the nboot provided by the user is lower than |
| 65 | +% this. |
| 66 | +% |
| 67 | +% p = bootnhst(DATA,GROUP,bootfun,nboot,ref) also sets the GROUP to |
| 68 | +% use as the reference GROUP for post hoc tests. For one-way ANOVA-like |
| 69 | +% experimental designs this will usually be the control GROUP. If all |
| 70 | +% pairwise comparisons are desired, then set ref to 'pairwise' or leave |
| 71 | +% empty. By default, pairwise comparisons are computed for post hoc tests. |
71 | 72 | %
|
72 |
| -% p = bootnhst(DATA,GROUP,ref,bootfun,nboot,paropt) specifies options that |
73 |
| -% govern if and how to perform bootstrap iterations using multiple |
| 73 | +% p = bootnhst(DATA,GROUP,bootfun,nboot,ref,paropt) specifies options |
| 74 | +% that govern if and how to perform bootstrap iterations using multiple |
74 | 75 | % processors (if the Parallel Computing Toolbox or Octave Forge package
|
75 | 76 | % is available). If empty, calculations are performed in serial.
|
76 | 77 | %
|
|
176 | 177 | % along with this program. If not, see <http://www.gnu.org/licenses/>.
|
177 | 178 |
|
178 | 179 |
|
179 |
| -function [p, c, stats] = bootnhst (data, group, ref, bootfun, nboot, paropt) |
| 180 | +function [p, c, stats] = bootnhst (data, group, bootfun, nboot, ref, paropt) |
180 | 181 |
|
181 | 182 | % Check and process bootnhst input arguments
|
182 | 183 | nvar = size(data,2);
|
|
194 | 195 | group = cell2mat(group);
|
195 | 196 | end
|
196 | 197 | end
|
197 |
| - if (nargin < 3) || strcmpi(ref,'pairwise') |
198 |
| - ref = []; |
199 |
| - end |
200 |
| - if (nargin < 4) || isempty(bootfun) |
| 198 | + if (nargin < 3) || isempty(bootfun) |
201 | 199 | bootfun = @mean;
|
202 | 200 | end
|
203 | 201 | if isa(bootfun,'function_handle')
|
|
234 | 232 | bootfun = @smoothmedian;
|
235 | 233 | end
|
236 | 234 | elseif strcmpi(bootfun,'median')
|
237 |
| - %error('bootfun cannot be the median, use ''robust'' instead.') |
| 235 | + error('bootfun cannot be the median, use ''robust'' instead.') |
238 | 236 | end
|
239 | 237 | end
|
240 |
| - if (nargin < 5) || isempty(nboot) |
| 238 | + if (nargin < 4) || isempty(nboot) |
241 | 239 | nboot = 1000;
|
242 | 240 | else
|
243 | 241 | if nboot < 1000
|
|
247 | 245 | if any(size(nboot)>1)
|
248 | 246 | error('nboot must be scalar. bootnhst is not compatible with bootstrap iteration')
|
249 | 247 | end
|
| 248 | + if (nargin < 5) || strcmpi(ref,'pairwise') |
| 249 | + ref = []; |
| 250 | + end |
250 | 251 | if (nargin < 6) || isempty(paropt)
|
251 | 252 | paropt = struct;
|
252 | 253 | paropt.UseParallel = false;
|
|
0 commit comments