summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-12-10 16:30:50 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-12-10 16:30:50 +0100
commit7b044ffe0f6e3c811850387a721704963012c90f (patch)
treef7ce71d3f8c4c315e5826019641b288f68745ae4
parent4bcd3b16da0eb0f0efe4fb5eb1e8c6bea9e79cf2 (diff)
mms: add lecture
-rw-r--r--Year_3/MMS/UStemps.txt57
-rw-r--r--Year_3/MMS/lecture_20211202.m38
2 files changed, 95 insertions, 0 deletions
diff --git a/Year_3/MMS/UStemps.txt b/Year_3/MMS/UStemps.txt
new file mode 100644
index 0000000..1ae1ec1
--- /dev/null
+++ b/Year_3/MMS/UStemps.txt
@@ -0,0 +1,57 @@
+City JanTemp Lat Long
+Mobile, AL 44 31.2 88.5
+Montgomery, AL 38 32.9 86.8
+Phoenix, AZ 35 33.6 112.5
+Little Rock, AR 31 35.4 92.8
+Los Angeles, CA 47 34.3 118.7
+San Francisco, CA 42 38.4 123.0
+Denver, CO 15 40.7 105.3
+New Haven, CT 22 41.7 73.4
+Wilmington, DE 26 40.5 76.3
+Washington, DC 30 39.7 77.5
+Jacksonville, FL 45 31.0 82.3
+Key West, FL 65 25.0 82.0
+Miami, FL 58 26.3 80.7
+Atlanta, GA 37 33.9 85.0
+Boise, ID 22 43.7 117.1
+Chicago, IL 19 42.3 88.0
+Indianapolis, IN 21 39.8 86.9
+Des Moines, IA 11 41.8 93.6
+Wichita, KS 22 38.1 97.6
+Louisville, KY 27 39.0 86.5
+New Orleans, LA 45 30.8 90.2
+Portland, ME 12 44.2 70.5
+Baltimore, MD 25 39.7 77.3
+Boston, MA 23 42.7 71.4
+Detroit, MI 21 43.1 83.9
+Minneapolis, MN 2 45.9 93.9
+St. Louis, MO 24 39.3 90.5
+Helena, MT 8 47.1 112.4
+Omaha, NE 13 41.9 96.1
+Concord, NH 11 43.5 71.9
+Atlantic City, NJ 27 39.8 75.3
+Albuquerque, NM 24 35.1 106.7
+Albany, NY 14 42.6 73.7
+New York, NY 27 40.8 74.6
+Charlotte, NC 34 35.9 81.5
+Raleigh, NC 31 36.4 78.9
+Bismarck, ND 0 47.1 101.0
+Cincinnati, OH 26 39.2 85.0
+Cleveland, OH 21 42.3 82.5
+Oklahoma City, OK 28 35.9 97.5
+Portland, OR 33 45.6 123.2
+Harrisburg, PA 24 40.9 77.8
+Philadelphia, PA 24 40.9 75.5
+Charleston, SC 38 33.3 80.8
+Nashville, TN 31 36.7 87.6
+Amarillo, TX 24 35.6 101.9
+Galveston, TX 49 29.4 95.5
+Houston, TX 44 30.1 95.9
+Salt Lake City, UT 18 41.1 112.3
+Burlington, VT 7 45.0 73.9
+Norfolk, VA 32 37.0 76.6
+Seattle, WA 33 48.1 122.5
+Spokane, WA 19 48.1 117.9
+Madison, WI 9 43.4 90.2
+Milwaukee, WI 13 43.3 88.1
+Cheyenne, WY 14 41.2 104.9 \ No newline at end of file
diff --git a/Year_3/MMS/lecture_20211202.m b/Year_3/MMS/lecture_20211202.m
new file mode 100644
index 0000000..0e56243
--- /dev/null
+++ b/Year_3/MMS/lecture_20211202.m
@@ -0,0 +1,38 @@
+f = @(x) x.^2;
+x = 0:0.1:2;
+y = f(x);
+integral(f, 0, 1);
+
+g = @(x) exp(-2 * x.^2);
+integral(g, 1, inf);
+
+% ---
+
+load fish;
+price70 = table2array(fish(:, 2));
+xbar = mean(price70);
+s = std(price70);
+
+% Normal function
+f = @(x) (1/s/sqrt(2*pi))*exp(-(x-xbar).^2/(s^2)/2);
+
+integral(f, xbar, inf); % 0.5000
+
+x = (xbar- 100):1.0:(xbar+100);
+y = f(x);
+
+% Integrated normal function
+yy = normpdf(x, xbar, s);
+
+% Plots are the same
+% plot(x, yy, 'o', x, yy, '+')
+
+ustemps = readtable("UStemps.txt");
+jantemps = table2array(ustemps(:, 2));
+
+% normrnd(0, 1);
+
+tbar = mean(jantemps);
+ds = std(jantemps);
+
+norminv(0.5, tbar, ds); % with 0.5 you have the mean \ No newline at end of file