summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Year_3/MMS/lecture_20211221.m43
-rw-r--r--Year_3/MMS/regressione_lineare/all-the-efficiency.txt76
-rw-r--r--Year_3/MMS/regressione_lineare/alternative-energy-2016.txt51
-rw-r--r--Year_3/MMS/regressione_lineare/baseball-salaries-2016.txt31
-rw-r--r--Year_3/MMS/regressione_lineare/birthrates-2015.txt12
-rw-r--r--Year_3/MMS/regressione_lineare/bookstore-sales.txt11
-rw-r--r--Year_3/MMS/regressione_lineare/boyle.txt26
-rw-r--r--Year_3/MMS/regressione_lineare/brain-size.txt21
-rw-r--r--Year_3/MMS/regressione_lineare/brakes.txt16
9 files changed, 287 insertions, 0 deletions
diff --git a/Year_3/MMS/lecture_20211221.m b/Year_3/MMS/lecture_20211221.m
new file mode 100644
index 0000000..8fa807a
--- /dev/null
+++ b/Year_3/MMS/lecture_20211221.m
@@ -0,0 +1,43 @@
+% First, import `regressione_lineare/brakes.txt` as Column vectors
+
+% plot(Speedmph, StoppingDistance, 'o');
+
+p = polyfit(Speedmph, StoppingDistance, 1);
+f = @(x) p(1)*x + p(2);
+
+x = min(Speedmph)-1:0.1:max(Speedmph)+2;
+y = f(x);
+
+% plot(Speedmph, StoppingDistance, 'o', x, y);
+
+% ---
+% Import `regressione_lineare/boyle.txt` as Column vectors
+x = Height;
+y = Pressure;
+
+xbar = mean(x);
+ybar = mean(y);
+n = length(x);
+
+Sxx = 0.0;
+Syy = 0.0;
+Sxy = 0.0;
+
+for i = 1:1:length(x)
+ Sxx = Sxx + (x(i)-xbar)^2;
+ Syy = Syy + (y(i)-ybar)^2;
+ Sxy = Sxy + (x(i)-xbar) * (y(i)-ybar);
+end
+
+R2 = Sxy^2 / (Sxx*Syy);
+SSRes = (Sxx*Syy - Sxy^2) / Sxx;
+R2Corr = 1 - SSRes/Syy*(n-1)/(n-2);
+
+% Import `regressione_lineare/all-the-efficiency.txt` as Column vectors
+p = polyfit(EfficiencyhiwayMpg, MSRP, 1);
+
+f = @(x) p(1)*x + p(2);
+x = min(EfficiencyhiwayMpg)-1:0.1:max(EfficiencyhiwayMpg)+2;
+y = f(x);
+
+% plot(EfficiencyhiwayMpg, MSRP, 'o', x, y);
diff --git a/Year_3/MMS/regressione_lineare/all-the-efficiency.txt b/Year_3/MMS/regressione_lineare/all-the-efficiency.txt
new file mode 100644
index 0000000..e3a31f0
--- /dev/null
+++ b/Year_3/MMS/regressione_lineare/all-the-efficiency.txt
@@ -0,0 +1,76 @@
+Efficiency (hiway mpg) MSRP
+44 26750
+48 28790
+43 27150
+40 31250
+40 30900
+36 25490
+40 25795
+40 26500
+41 19455
+36 28600
+39 23455
+36 28600
+36 28345
+38 17500
+34 39100
+34 9990
+35 21750
+42 27840
+36 18100
+36 17600
+34 19390
+35 21650
+31 18200
+34 19390
+36 23955
+36 23955
+28 46325
+31 13300
+32 18199
+33 18100
+35 27950
+35 13900
+35 24900
+42 28065
+33 23195
+34 18390
+43 25995
+35 17770
+36 17395
+36 24800
+36 27850
+33 22995
+33 19995
+42 23885
+34 17410
+34 25105
+40 17300
+37 14560
+40 20445
+40 20195
+37 19400
+35 14515
+34 25105
+35 15635
+33 29305
+35 15900
+33 29305
+34 15345
+36 16395
+36 16095
+31 33080
+37 22700
+31 33080
+31 30115
+35 27050
+37 17500
+38 16400
+40 16500
+38 20605
+40 15795
+38 17500
+35 15365
+35 15365
+37 21300
+37 19500 \ No newline at end of file
diff --git a/Year_3/MMS/regressione_lineare/alternative-energy-2016.txt b/Year_3/MMS/regressione_lineare/alternative-energy-2016.txt
new file mode 100644
index 0000000..d2b7eab
--- /dev/null
+++ b/Year_3/MMS/regressione_lineare/alternative-energy-2016.txt
@@ -0,0 +1,51 @@
+State Pct.Renewable incl Hydro Pct.Renewable w/o Hydro Ren Elec(GW-h) non Ren Elec Ren Elec w/o Hydro (GW-h) Total Elect (GW-h)
+Vermont 99.8 44.3 1898 3 842 1901
+Idaho 78.6 19.6 12584 3427 3138 16011
+Washington 77.1 8.9 86902 25882 10059 112784
+Oregon 70.9 14.2 42122 17303 8422 59425
+South Dakota 70.2 30.4 7280 3083 3146 10363
+Maine 63.6 38.1 7408 4242 4440 11650
+Montana 43.8 7.6 12334 15819 2151 28153
+California 40.3 25.8 80208 118830 51263 199038
+Iowa 38.8 37.1 21261 33532 20305 54793
+Alaska 32.6 3.97 1764 3653 215 5417
+Kansas 29.7 29.7 14187 33518 14187 47705
+Oklahoma 28.6 25.5 22226 55514 19844 77740
+North Dakota 26.6 21.5 10003 27579 8091 37582
+New York 24.6 4.78 33016 101233 6412 134249
+Minnesota 22.2 20.7 13348 46800 12464 60148
+Colorado 22 18.5 11981 42413 10063 54394
+Nevada 21.6 17.1 8531 31018 6764 39549
+New Hampshire 16.8 11 3243 16006 2122 19249
+Hawaii 14.9 13.7 1436 8171 1318 9607
+Nebraska 14.9 10.4 5618 31985 3893 37603
+New Mexico 13.9 13.5 4598 28412 4452 33010
+Texas 13.4 13.2 61140 394392 60037 455532
+Wyoming 11.6 9.4 5361 40931 4363 46292
+Arizona 10.7 4.15 11673 97097 4515 108770
+Tennessee 10.7 1.41 8544 71491 1126 80035
+Massachusetts 9 6.6 2908 29545 2138 32453
+Utah 8.3 6.1 3131 34660 2315 37791
+Wisconsin 8.3 4.55 5351 59446 2946 64797
+North Carolina 8.2 4.78 10812 120674 6283 131486
+Arkansas 8 2.37 4842 55575 1432 60417
+Michigan 7.8 6.4 8761 103958 7213 112719
+Alabama 7.7 2.3 11010 132012 3289 143022
+Maryland 7.3 3.59 2735 34547 1338 37282
+Georgia 6.5 4.17 8645 124673 5563 133318
+Virginia 6.1 4.49 5672 86767 4146 92439
+Illinois 6.1 6 11388 175551 11259 186939
+Indiana 5.9 5.5 6038 95786 5623 101824
+South Carolina 4.93 2.45 4777 92193 2378 96970
+Kentucky 4.87 0.58 3914 76431 464 80345
+Rhode Island 3.92 3.92 258 6330 258 6588
+Pennsylvania 3.87 2.76 8311 206500 5935 214811
+West Virginia 3.76 1.9 2847 72779 1437 75626
+Louisiana 3.55 2.52 3790 102898 2687 106688
+Connecticut 3.28 2.5 1197 35258 911 36455
+Missouri 3.23 1.66 2547 76358 1310 78905
+New Jersey 2.61 2.61 2027 75593 2027 77620
+Mississippi 2.37 2.37 1494 61412 1494 62906
+Ohio 2.19 1.76 2619 116737 2102 119356
+Florida 2.16 2.06 5132 232962 4913 238094
+Delaware 1.55 1.55 136 8629 136 8765 \ No newline at end of file
diff --git a/Year_3/MMS/regressione_lineare/baseball-salaries-2016.txt b/Year_3/MMS/regressione_lineare/baseball-salaries-2016.txt
new file mode 100644
index 0000000..e95c658
--- /dev/null
+++ b/Year_3/MMS/regressione_lineare/baseball-salaries-2016.txt
@@ -0,0 +1,31 @@
+Team Team Abbr League Salary ($M) W L
+Arizona Diamondbacks ARI NL 91.995583 69 93
+Atlanta Braves ATL NL 77.073541 68 93
+Baltimore Orioles BAL AL 141.741213 89 73
+Boston Red Sox BOS AL 198.328678 93 69
+Chicago Cubs CHC NL 163.805667 103 58
+Chicago White Sox CHW AL 113.911667 78 84
+Cincinnati Reds CIN NL 80.905951 68 94
+Cleveland Indians CLE AL 92.652499 94 67
+Colorado Rockies COL NL 103.603571 75 87
+Detroit Tigers DET AL 192.3075 86 75
+Houston Astros HOU AL 89.0625 84 78
+Kansas City Royals KCR AL 136.564175 81 81
+Los Angeles Angels LAA AL 160.98619 74 88
+Los Angeles Dodgers LAD NL 248.321662 91 71
+Miami Marlins MIA NL 64.02 79 82
+Milwaukee Brewers MIL NL 51.2 73 89
+Minnesota Twins MIN AL 99.8125 59 103
+New York Mets NYM NL 128.413458 87 75
+New York Yankees NYY AL 221.574999 84 78
+Oakland Athletics OAK AL 80.613332 69 93
+Philadelphia Phillies PHI NL 91.616668 71 91
+Pittsburgh Pirates PIT NL 95.840999 78 83
+San Diego Padres SDP NL 94.12 68 94
+San Francisco Giants SEA AL 166.744443 86 76
+Seattle Mariners SFG NL 139.804258 87 75
+St. Louis Cardinals STL NL 143.514 86 76
+Tampa Bay Rays TBR AL 60.065366 68 94
+Texas Rangers TEX AL 158.68022 95 67
+Toronto Blue Jays TOR AL 131.905327 89 73
+Washington Nationals WSN NL 142.501785 95 67 \ No newline at end of file
diff --git a/Year_3/MMS/regressione_lineare/birthrates-2015.txt b/Year_3/MMS/regressione_lineare/birthrates-2015.txt
new file mode 100644
index 0000000..8414f20
--- /dev/null
+++ b/Year_3/MMS/regressione_lineare/birthrates-2015.txt
@@ -0,0 +1,12 @@
+Year Rate Year_since_1900
+1965 19.4 65
+1970 18.4 70
+1975 14.8 75
+1980 15.9 80
+1985 15.6 85
+1990 16.4 90
+1995 14.8 95
+2000 14.4 100
+2005 14 105
+2010 13 110
+2014 12.4 115 \ No newline at end of file
diff --git a/Year_3/MMS/regressione_lineare/bookstore-sales.txt b/Year_3/MMS/regressione_lineare/bookstore-sales.txt
new file mode 100644
index 0000000..3f9fd2f
--- /dev/null
+++ b/Year_3/MMS/regressione_lineare/bookstore-sales.txt
@@ -0,0 +1,11 @@
+Number of Sales People Working Sales (in $1000)
+2 10
+3 11
+7 13
+9 14
+10 18
+10 20
+12 20
+15 22
+16 22
+20 26 \ No newline at end of file
diff --git a/Year_3/MMS/regressione_lineare/boyle.txt b/Year_3/MMS/regressione_lineare/boyle.txt
new file mode 100644
index 0000000..e3517ab
--- /dev/null
+++ b/Year_3/MMS/regressione_lineare/boyle.txt
@@ -0,0 +1,26 @@
+Height Pressure
+48 29.1
+46 30.6
+44 31.9
+42 33.2
+40 35.3
+38 37
+36 39.3
+34 41.6
+32 44.2
+30 47.5
+28 50.3
+26 54.3
+24 58.8
+23 61.3
+22 64.5
+21 67.1
+20 70.7
+19 74.1
+18 77.9
+17 82.75
+16 87.9
+15 93.1
+14 100.4
+13 107.8
+12 117.6 \ No newline at end of file
diff --git a/Year_3/MMS/regressione_lineare/brain-size.txt b/Year_3/MMS/regressione_lineare/brain-size.txt
new file mode 100644
index 0000000..b36f9e7
--- /dev/null
+++ b/Year_3/MMS/regressione_lineare/brain-size.txt
@@ -0,0 +1,21 @@
+VerbalIQ Brain Size
+132 816.932
+132 951.545
+90 928.799
+136 991.305
+90 854.258
+129 833.868
+120 856.472
+100 878.897
+71 865.363
+132 852.244
+112 808.02
+129 790.619
+86 831.772
+90 798.612
+83 793.549
+126 866.662
+126 857.782
+90 834.344
+129 948.066
+86 893.983 \ No newline at end of file
diff --git a/Year_3/MMS/regressione_lineare/brakes.txt b/Year_3/MMS/regressione_lineare/brakes.txt
new file mode 100644
index 0000000..40d8ed9
--- /dev/null
+++ b/Year_3/MMS/regressione_lineare/brakes.txt
@@ -0,0 +1,16 @@
+Speed(mph) Stopping.Distance
+20 64
+20 62
+20 59
+30 114
+30 118
+30 105
+40 153
+40 171
+40 165
+50 231
+50 203
+50 238
+60 317
+60 321
+60 276 \ No newline at end of file