Skip to content

Commit 3fb02bf

Browse files
committed
bootridge: minor bug fix for printing the number of predictors in the output
1 parent 19378b4 commit 3fb02bf

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

inst/bootridge.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,6 @@
552552

553553
% Get dimensions of the data
554554
[m, n] = size (X);
555-
p = n - 1;
556555
q = size (Y, 2);
557556
% Check that Y contains floating point numbers
558557
if (~ any (strcmpi (class (Y), {'single', 'double'})))
@@ -564,6 +563,7 @@
564563
X = cat (2, ones (m, 1), X);
565564
n = n + 1;
566565
end
566+
p = n - 1;
567567
% Check that X contains floating point numbers
568568
if (~ any (strcmpi (class (X), {'single', 'double'})))
569569
error ('bootwild: X must contain single or double precision numbers.');
@@ -1453,10 +1453,12 @@
14531453
%! % Run machine learning optimized ridge regression with empirical bayes
14541454
%! % inference. By not assigning the output to a variable, we get results
14551455
%! % printed to stdout.
1456+
%! fprintf ('The bootridge function is running ...\n')
14561457
%! bootridge ([SAT, PPVT, Raven], MAT.X, 2, 200, .05);
14571458
%!
14581459
%! % Get the output structure stored in ans from the last function call
14591460
%! S = ans;
1461+
%!
14601462

14611463
%!demo
14621464
%!
@@ -1470,6 +1472,7 @@
14701472
%! salary = [39 46 38 44 40 57 60 54 64 57 63 56 57 57 61 68 66 83 81 94 92 ...
14711473
%! 98 101 114 109 106 117 113 122 122]';
14721474
%!
1475+
%! fprintf ('The bootridge function is running ...\n')
14731476
%! bootridge (salary, years);
14741477
%!
14751478
%! % We can see from the intercept that the starting starting salary is $25.2 K
@@ -1488,10 +1491,12 @@
14881491
%! % coding to simple contrasts, which are centered.
14891492
%! MAT = bootlm (score, gender, 'nboot', 0, 'display', 'off', ...
14901493
%! 'dim', 1, 'posthoc', 'trt_vs_ctrl');
1494+
%! fprintf ('The bootridge function is running ...\n')
14911495
%! bootridge (MAT.Y, MAT.X, 2);
14921496
%!
14931497
%! % Group means
14941498
%! MAT = bootlm (score, gender, 'nboot', 0, 'display', 'off', 'dim', 1);
1499+
%! fprintf ('The bootridge function is running ...\n')
14951500
%! bootridge (MAT.Y, MAT.X, 2, [], [], MAT.L);
14961501

14971502
%!demo
@@ -1516,6 +1521,7 @@
15161521
%! 'poly', 'dim', 2, 'posthoc', 'trt_vs_ctrl', 'nboot', 0);
15171522
%!
15181523
%! % Ridge regression and bayesian analysis of posthoc comparisons
1524+
%! fprintf ('The bootridge function is running ...\n')
15191525
%! bootridge (MAT.Y, MAT.X, '*', 200, 0.05, MAT.L);
15201526
%!
15211527
%! % Frequentist framework: wild bootstrap of linear model, with orthogonal
@@ -1526,6 +1532,7 @@
15261532
%! % Ridge regression and bayesian analysis of model estimates. Note that group-
15271533
%! % mean Bayes Factors are NaN under the flat prior on the intercept whereas
15281534
%! % the contrasts we just calculated had proper Normal priors.
1535+
%! fprintf ('The bootridge function is running ...\n')
15291536
%! bootridge (MAT.Y, MAT.X, '*', 200, 0.05, MAT.L);
15301537

15311538
%!demo
@@ -1552,6 +1559,7 @@
15521559
%! % Ridge regression and bayesian analysis of regression coefficients
15531560
%! % MAT.X: column 1 is intercept, column 2 is temp (continuous), column 3
15541561
%! % is species (categorical).
1562+
%! fprintf ('The bootridge function is running ...\n')
15551563
%! bootridge (MAT.Y, MAT.X, 3, 200, 0.05);
15561564

15571565
%!demo
@@ -1589,6 +1597,7 @@
15891597
%! % Ridge regression and bayesian analysis of regression coefficients
15901598
%! % MAT.X: column 1 is intercept, column 2 is temp (continuous), column 3
15911599
%! % is species (categorical).
1600+
%! fprintf ('The bootridge function is running ...\n')
15921601
%! bootridge (MAT.Y, MAT.X, '*', 200, 0.05);
15931602
%!
15941603
%! % Now imagine the design is repeated stimulus measurements in each rodent
@@ -1602,6 +1611,7 @@
16021611
%! % Ridge regression and bayesian analysis of regression coefficients
16031612
%! % MAT.X: column 1 is intercept, column 2 is temp (continuous), column 3
16041613
%! % is species (categorical).
1614+
%! fprintf ('The bootridge function is running ...\n')
16051615
%! bootridge (MAT.Y, MAT.X, '*', 200, 0.05);
16061616

16071617
%!demo
@@ -1655,10 +1665,12 @@
16551665
%!
16561666
%! % Fit a cluster-robust empirical Bayes model using our bootstrap estimate of
16571667
%! % the design effect and using the hypothesis matrix to define the comparisons
1668+
%! fprintf ('The bootridge function is running ...\n')
16581669
%! bootridge (MAT.Y, MAT.X, '*', 200, 0.05, MAT.L, DEFF);
16591670
%!
16601671
%! % Compare this to using a maximum cluster size as an upperbound for Deff
16611672
%! g = max (accumarray (clustid(:), 1, [], @sum)); % g is max. cluster size
1673+
%! fprintf ('The bootridge function is running ...\n')
16621674
%! bootridge (MAT.Y, MAT.X, '*', 200, 0.05, MAT.L, g); % Upperbound DEFF is g
16631675
%!
16641676
%! % Note: Using the empirical DEFF (~1.5) instead of the upper-bound (4.0)

0 commit comments

Comments
 (0)