|
151 | 151 | w = value;
|
152 | 152 | case {'options', 'option'}
|
153 | 153 | paropt = value;
|
154 |
| - case 'match' |
| 154 | + case {'match', 'matched', 'matching'} |
155 | 155 | match = value;
|
156 | 156 | case 'seed'
|
157 | 157 | seed = value;
|
|
444 | 444 | %! 0 33 28 34 4 32 24 47 41 24 26 30 41]';
|
445 | 445 | %!
|
446 | 446 | %! % Compute 50 bootstrap statistics for the mean and calculate the bootstrap
|
447 |
| -%! % standard error |
448 |
| -%! bootstat = bootstrp (50, @mean, data) |
| 447 | +%! % standard error of the mean |
| 448 | +%! bootstat = bootstrp (50, @mean, data, 'seed', 1); |
| 449 | +%! % Or equivalently |
| 450 | +%! bootstat = bootstrp (50, @mean, data, 'seed', 1, 'loo', false); |
| 451 | +%! std (bootstat) |
| 452 | + |
| 453 | +%!demo |
| 454 | +%! |
| 455 | +%! % Input univariate dataset |
| 456 | +%! data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ... |
| 457 | +%! 0 33 28 34 4 32 24 47 41 24 26 30 41]'; |
| 458 | +%! |
| 459 | +%! % Compute 50 bootknife statistics for the mean and calculate the unbiased |
| 460 | +%! % bootstrap standard error of the mean |
| 461 | +%! bootstat = bootstrp (50, @mean, data, 'seed', 1, 'loo', true); |
| 462 | +%! std (bootstat) |
| 463 | + |
| 464 | +%!demo |
| 465 | +%! |
| 466 | +%! % Input univariate dataset |
| 467 | +%! data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ... |
| 468 | +%! 0 33 28 34 4 32 24 47 41 24 26 30 41]'; |
| 469 | +%! % Split data into consecutive blocks of two data observations per cell |
| 470 | +%! data_blocks = mat2cell (data, 2 * (ones (13, 1)), 1); |
| 471 | +%! |
| 472 | +%! % Compute 50 bootknife statistics for the mean and calculate the unbiased |
| 473 | +%! % bootstrap standard error of the mean |
| 474 | +%! bootstat = bootstrp (50, @(x) mean (cell2mat (x)), data_blocks, 'seed', 1, ... |
| 475 | +%! 'loo', true); |
| 476 | +%! std (bootstat) |
| 477 | + |
| 478 | +%!demo |
| 479 | +%! |
| 480 | +%! % Input univariate dataset |
| 481 | +%! data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ... |
| 482 | +%! 0 33 28 34 4 32 24 47 41 24 26 30 41]'; |
| 483 | +%! |
| 484 | +%! % Compute 50 bootknife statistics for the variance and calculate the |
| 485 | +%! % unbiased standard error of the variance |
| 486 | +%! bootstat = bootstrp (50, {@var, 1}, data, 'loo', true); |
| 487 | +%! std (bootstat) |
| 488 | + |
| 489 | +%!demo |
| 490 | +%! |
| 491 | +%! % Input two-sample dataset |
| 492 | +%! X = [212 435 339 251 404 510 377 335 410 335 ... |
| 493 | +%! 415 356 339 188 256 296 249 303 266 300]'; |
| 494 | +%! Y = [247 461 526 302 636 593 393 409 488 381 ... |
| 495 | +%! 474 329 555 282 423 323 256 431 437 240]'; |
| 496 | +%! |
| 497 | +%! % Compute 50 bootknife statistics for the mean difference between X and Y |
| 498 | +%! % and calculate the unbiased bootstrap standard error of the mean difference |
| 499 | +%! bootstat = bootstrp (50, @(x, y) mean (x - y), X, Y, 'loo', true); |
| 500 | +%! % Or equivalently |
| 501 | +%! bootstat = bootstrp (50, @(x, y) mean (x - y), X, Y, 'loo', true, ... |
| 502 | +%! 'match', true); |
| 503 | +%! std (bootstat) |
| 504 | + |
| 505 | +%!demo |
| 506 | +%! |
| 507 | +%! % Input two-sample dataset |
| 508 | +%! X = [212 435 339 251 404 510 377 335 410 335 ... |
| 509 | +%! 415 356 339 188 256 296 249 303 266 300]'; |
| 510 | +%! Y = [247 461 526 302 636 593 393 409 488 381 ... |
| 511 | +%! 474 329 555 282 423 323 256 431 437 240]'; |
| 512 | +%! |
| 513 | +%! % Compute 50 bootknife statistics for the difference in mean between |
| 514 | +%! % between independent samples X and Y and calculate the unbiased bootstrap |
| 515 | +%! % standard error of the difference in mean |
| 516 | +%! bootstat = bootstrp (50, @(x, y) mean (x) - mean(y), X, Y, 'loo', true, ... |
| 517 | +%! 'match', false); |
| 518 | +%! std (bootstat) |
| 519 | + |
| 520 | +%!demo |
| 521 | +%! |
| 522 | +%! % Input bivariate dataset |
| 523 | +%! X = [212 435 339 251 404 510 377 335 410 335 ... |
| 524 | +%! 415 356 339 188 256 296 249 303 266 300]'; |
| 525 | +%! Y = [247 461 526 302 636 593 393 409 488 381 ... |
| 526 | +%! 474 329 555 282 423 323 256 431 437 240]'; |
| 527 | +%! |
| 528 | +%! % Compute 50 bootstrap statistics for the correlation coefficient and |
| 529 | +%! % calculate the bootstrap standard error of the correlation coefficient |
| 530 | +%! bootstat = bootstrp (50, @cor, X, Y); |
| 531 | +%! std (bootstat) |
| 532 | + |
| 533 | +%!demo |
| 534 | +%! |
| 535 | +%! % Input bivariate dataset |
| 536 | +%! X = [212 435 339 251 404 510 377 335 410 335 ... |
| 537 | +%! 415 356 339 188 256 296 249 303 266 300]'; |
| 538 | +%! Y = [247 461 526 302 636 593 393 409 488 381 ... |
| 539 | +%! 474 329 555 282 423 323 256 431 437 240]'; |
| 540 | +%! |
| 541 | +%! % Compute 50 bootstrap statistics for the coefficient of determination and |
| 542 | +%! % calculate the bootstrap standard error of the coefficient of determination |
| 543 | +%! bootstat = bootstrp (50, {@cor,'squared'}, X, Y); |
| 544 | +%! std (bootstat) |
| 545 | + |
| 546 | +%!demo |
| 547 | +%! |
| 548 | +%! % Input bivariate dataset |
| 549 | +%! X = [212 435 339 251 404 510 377 335 410 335 ... |
| 550 | +%! 415 356 339 188 256 296 249 303 266 300]'; |
| 551 | +%! Y = [247 461 526 302 636 593 393 409 488 381 ... |
| 552 | +%! 474 329 555 282 423 323 256 431 437 240]'; |
| 553 | +%! |
| 554 | +%! % Compute 50 bootstrap statistics for the slope and intercept of a linear |
| 555 | +%! % regression and calculate there bootstrap standard errors |
| 556 | +%! bootstat = bootstrp (50, @mldivide, cat (2, ones (20, 1), X), Y); |
449 | 557 | %! std (bootstat)
|
450 | 558 |
|
451 | 559 | %!test
|
|
0 commit comments