AllPossibleRegressi​ons

A tabular summary of all linear combinations for linear regression
41 Downloads
Aktualisiert 23. Nov 2016

Lizenz anzeigen

Ran into the non-trivial issue of generating a table of all possible linear combinations of a regression while doing my stats homework. Noticed based on some googling that MATLAB does not have this option and I wasn't alone. Enjoy!
_______________________________________________________________________________
% Optional test code, based on the data on page 489 of the 9th edition of Walpole et. al.'s
% Probability and Statistics for Engineers and Scientists.
HT = [4.75 4.07 4.04 4.18 4.35 4.16 4.43 3.20 3.02 3.64 3.68 3.60 3.85];
RLS = [170 140 180 160 170 150 170 110 120 130 120 140 160];
LLS = [170 130 170 160 150 150 180 110 110 120 140 130 150];
RHF = [106 92 93 103 104 101 108 86 90 85 89 92 95];
LHF = [106 93 78 93 93 87 106 92 86 80 83 94 95];
Power = [240.57 195.49 152.99 197.09 266.56 260.56 219.25 132.68 130.24 205.88 153.92 154.64 240.57];

X = [RLS', LLS', RHF', LHF', Power'];
Y = HT';
output = AllPossibleRegressions(X, Y)

_______________________________________________________________________________
% Expected output (which can be validated on page 490, for those with the book!)

output =

'Model' 'S^2' 'Sum(delta_i)' 'PRESS' 'R^2'
'x5' '0.11178' '4.1784' '1.7251' '0.57123'
'x4' '0.18671' '4.8887' '2.8221' '0.28382'
'x4x5' '0.10565' '4.1273' '1.8773' '0.63159'
'x3' '0.074518' '3.0675' '1.1355' '0.71416'
'x3x5' '0.065678' '3.0947' '1.0571' '0.77097'
'x3x4' '0.080605' '3.28' '1.2831' '0.71892'
'x3x4x5' '0.072505' '3.4969' '1.4204' '0.77245'
'x2' '0.066894' '3.2232' '1.0456' '0.7434'
'x2x5' '0.036907' '1.9358' '0.54683' '0.8713'
'x2x4' '0.063744' '3.591' '1.1853' '0.77772'
'x2x4x5' '0.037708' '2.188' '0.59915' '0.88166'
'x2x3' '0.056153' '2.9531' '0.98815' '0.80419'
'x2x3x5' '0.039636' '2.0955' '0.66182' '0.87561'
'x2x3x4' '0.062082' '3.3239' '1.1749' '0.80516'
'x2x3x4x5' '0.042421' '2.5579' '0.86236' '0.88166'
'x1' '0.080208' '3.3156' '1.3027' '0.69233'
'x1x5' '0.059621' '2.9943' '0.97483' '0.79209'
'x1x4' '0.069965' '3.6441' '1.3019' '0.75602'
'x1x4x5' '0.056279' '2.7539' '0.89551' '0.82337'
'x1x3' '0.0594' '3.0144' '0.99697' '0.79286'
'x1x3x5' '0.053664' '2.6528' '0.87325' '0.83158'
'x1x3x4' '0.065414' '3.363' '1.1504' '0.7947'
'x1x3x4x5' '0.059169' '3.3736' '1.3687' '0.83494'
'x1x2' '0.068402' '3.0905' '1.0973' '0.76147'
'x1x2x5' '0.041001' '2.0649' '0.58998' '0.87132'
'x1x2x4' '0.064143' '3.894' '1.3983' '0.79869'
'x1x2x4x5' '0.042265' '2.4219' '0.6784' '0.88209'
'x1x2x3' '0.05967' '3.4129' '1.2656' '0.81273'
'x1x2x3x5' '0.044578' '2.2628' '0.70958' '0.87564'
'x1x2x3x4' '0.066088' '3.9585' '1.5234' '0.81563'
'x1x2x3x4x5' '0.048302' '2.873' '1.0092' '0.8821'

Zitieren als

Danielle Ripsman (2024). AllPossibleRegressions (https://www.mathworks.com/matlabcentral/fileexchange/60364-allpossibleregressions), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2013a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0