Started statistics lecture

This commit is contained in:
2015-10-15 18:18:56 +02:00
parent 78ce93cb37
commit 06016d3e2f
149 changed files with 1015 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
load thymusglandweights.dat
x = thymusglandweights(1:50);
m = 500;
n = length(x);
mu = zeros(m,1);
for i = 1:m
mu(i) = mean(x(randi(n,n,1)));
end
fprintf("bootstrap standard error: %.4f\n", std(mu));
fprintf("standard error: %.4f\n", std(x)/sqrt(n));

View File

@@ -0,0 +1,185 @@
1607 0
1157 0
1248 0
1310 0
1398 0
1237 0
1232 0
1343 0
1380 0
1274 0
1245 0
1286 0
1508 0
1105 0
1123 0
1198 0
1300 0
1249 0
1185 0
915 0
1345 0
1107 0
1357 0
1227 0
1205 0
1435 0
1289 0
1093 0
1211 0
1260 0
1193 0
1330 0
1130 0
1357 0
1193 0
1232 0
1321 0
1260 0
1380 0
1230 0
1136 0
1029 0
1223 0
1240 0
1264 0
1020 0
1415 0
1410 0
1275 0
1230 0
1085 0
1048 0
1181 0
1103 0
1165 0
1547 0
1173 0
1660 0
1307 0
1535 0
1315 0
1257 0
1424 0
1309 0
1170 0
1412 0
1270 0
1230 0
1233 0
1561 0
1193 0
1272 0
1355 0
1137 0
1354 0
1110 0
1265 0
1407 0
1227 0
1330 0
1222 0
1305 0
1475 0
1177 0
1337 0
1145 0
1070 0
1305 0
1085 0
1303 0
1390 0
1532 0
1238 0
1233 0
1280 0
1245 0
1459 0
1157 0
1302 0
1385 0
1310 0
1342 0
1303 0
1248 0
1115 0
1365 0
1227 0
1353 0
1125 1
1027 1
1112 1
983 1
1090 1
1247 1
1045 1
983 1
972 1
1045 1
937 1
1245 1
1200 1
1270 1
1200 1
1145 1
1090 1
1040 1
1343 1
1010 1
1095 1
1180 1
1168 1
1095 1
1040 1
1235 1
1050 1
1038 1
1046 1
1255 1
1228 1
1000 1
1225 1
1220 1
1085 1
1067 1
1006 1
1138 1
1175 1
1252 1
1037 1
958 1
1020 1
1068 1
1107 1
1317 1
952 1
1056 1
1203 1
1183 1
1392 1
1130 1
1284 1
996 1
1228 1
1087 1
1035 1
1170 1
1064 1
1250 1
1129 1
1088 1
1037 1
1117 1
1095 1
1027 1
1027 1
1190 1
1153 1
1037 1
1120 1
1212 1
1024 1
1135 1
1177 1
1096 1
1114 1

View File

@@ -0,0 +1,28 @@
1 12 3
2 14 1
3 11 2
4 13 1
5 20 5
6 14 3
7 10 0
8 12 2
9 8 6
10 13 3
11 14 2
12 15 4
13 12 3
14 13 2
15 8 0
16 18 5
17 15 3
18 12 2
19 17 2
20 15 4
21 11 3
22 22 4
23 14 2
24 18 4
25 15 5
26 8 1
27 13 2
28 16 3

View File

@@ -0,0 +1,19 @@
load thymusglandweights.dat
x = thymusglandweights(1:50);
m = 500;
n = length(x);
x = sort(x);
me = zeros(m,1);
for i = 1:m
me(i) = mean(x(randi(n,n,1)));
end
a1 = tinv(0.025,n-1);
a2 = tinv(1-0.025,n-1);
se = std(x)/sqrt(n);
fprintf('bootstrap quantiles: %.4f, %.4f \n', quantile(me,0.025), quantile(me,1-0.025));
fprintf('analytical quantile: %.4f, %.4f \n', mean(x)+a1*se, mean(x)+a2*se);

View File

@@ -0,0 +1,17 @@
load thymusglandweights.dat
x = thymusglandweights(1:50);
m = 500;
n = length(x);
x = sort(x);
me = zeros(m,1);
for i = 1:m
me(i) = median(x(randi(n,n,1)));
end
a1 = binoinv(0.025,n,.5)-1;
a2 = binoinv(1-0.025,n,.5);
fprintf('bootstrap quantiles: %.4f, %.4f \n', quantile(me,0.025), quantile(me,1-0.025));
fprintf('analytical quantile: %.4f, %.4f \n', x(a1),x(a2));

View File

@@ -0,0 +1,15 @@
2.600000000000000000e+01
2.400000000000000000e+01
2.900000000000000000e+01
3.300000000000000000e+01
2.500000000000000000e+01
2.600000000000000000e+01
2.300000000000000000e+01
3.000000000000000000e+01
3.100000000000000000e+01
3.000000000000000000e+01
2.800000000000000000e+01
2.700000000000000000e+01
2.900000000000000000e+01
2.600000000000000000e+01
2.800000000000000000e+01

View File

@@ -0,0 +1,10 @@
m = 10000
n = 10
p = zeros(m,1);
for i = 1:m
x = randn(n,1);
[~,p(i)] = ttest(x,0);
end
hist(p,50)

File diff suppressed because it is too large Load Diff