|
551 | 551 | % Get dimensions of the data |
552 | 552 | [m, n] = size (X); |
553 | 553 | q = size (Y, 2); |
| 554 | + % Check that Y contains floating point numbers |
| 555 | + if (~ any (strcmpi (class (Y), {'single', 'double'}))) |
| 556 | + error ('bootwild: Y must contain single or double precision numbers.'); |
| 557 | + end |
554 | 558 |
|
555 | 559 | % Check that the first column is X are all equal to 1, if not create one |
556 | 560 | if ( ~all (X(:, 1) == 1) ) |
557 | 561 | X = cat (2, ones (m, 1), X); |
558 | 562 | n = n + 1; |
559 | 563 | end |
| 564 | + % Check that X contains floating point numbers |
| 565 | + if (~ any (strcmpi (class (X), {'single', 'double'}))) |
| 566 | + error ('bootwild: X must contain single or double precision numbers.'); |
| 567 | + end |
560 | 568 |
|
561 | 569 | % If categor is not provided, set it to empty |
562 | 570 | if ( (nargin < 3) || isempty (categor) ) |
|
629 | 637 | seed = 1; |
630 | 638 | else |
631 | 639 | if ( isinf (seed) || isnan (seed) || (numel (seed) > 1) || ... |
632 | | - seed ~= fix(seed)) |
| 640 | + seed ~= fix (seed)) |
633 | 641 | error ('bootridge: The seed must be a finite integer'); |
634 | 642 | end |
635 | 643 | end |
|
1408 | 1416 |
|
1409 | 1417 | %------------------------------------------------------------------------------- |
1410 | 1418 |
|
| 1419 | +%!demo |
| 1420 | +%! |
| 1421 | +%! % Analysis of Rohwer's dataset |
| 1422 | +%! [group, SES, SAT, PPVT, Raven, n, s, ns, na, ss] = ... |
| 1423 | +%! textread ('./rohwer_data.csv', '%f %s %f %f %f %f %f %f %f %f', ... |
| 1424 | +%! 'Delimiter', ',', 'HeaderLines', 1); |
| 1425 | +%! MAT = bootlm (SAT, {SES, n, s, ns, na, ss}, 'model', 'linear', ... |
| 1426 | +%! 'nboot', 0, 'display', 'off', 'continuous', [2:6], ... |
| 1427 | +%! 'contrasts', 'helmert'); |
| 1428 | +%! |
| 1429 | +%! % Analysis using bootridge |
| 1430 | +%! bootridge([SAT, PPVT, Raven], MAT.X, 2, 1999, .05); |
| 1431 | + |
1411 | 1432 | %!demo |
1412 | 1433 | %! |
1413 | 1434 | %! % Simple linear regression. The data represents salaries of employees and |
|
0 commit comments