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,16 @@
all:
for number in 001 002 003 004 005 006 007 007 009 010 011 012 013 014 015 016 017 ; do \
echo $$number ; \
sed "s/000/$$number/g" day1.tex > tmp.tex; \
pdflatex tmp.tex; \
mv tmp.pdf day1_$$number.pdf; \
cp ../data/example$$number.csv ./ ;\
rm tmp.* ; \
zip example$$number.zip example$$number.csv day1_$$number.pdf ; \
rm example$$number.csv ;\
rm day1_$$number.pdf ; \
done
clean:
rm *.zip
rm -rf auto

View File

@@ -0,0 +1,72 @@
\documentclass[addpoints,10pt]{exam}
\usepackage{url}
\usepackage{color}
\usepackage{hyperref}
\pagestyle{headandfoot}
\runningheadrule
\firstpageheadrule
\firstpageheader{Scientific Computing}{afternoon assignment day 01}{10/20/2014}
%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014}
\firstpagefooter{}{}{}
\runningfooter{}{}{}
\pointsinmargin
\bracketedpoints
%\printanswers
\shadedsolutions
\begin{document}
%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%%
\sffamily
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
\begin{questions}
\question To publish scientific results, you will usually need to
use statistical methods. Some journals provide you with a brief
description of how they expect you to apply statistical methods. One
example can be found in the author guidelines of the journal
Nature.
Assume you collected the following dataset. You can download it from
Ilias as {\tt example000.csv}. Here is the description of the dataset:
\begin{quotation}
\tt
\input{../examples/example000.tex}
\end{quotation}
\begin{parts}
\part Download the dataset and write a script that loads it into
matlab.
\part Think about the type of your data (I might ask you that
tomorrow).
\part Produce a plot that displays the data in an appropriate
way. Make sure to respect all elements of good plotting we
discussed today.
\part Download the statistical checklist from nature. Produce {\bf
one} slide that contains the plot and a concise summary of your
data which respects the requirements made by nature (assume you
are producing a figure legend for the figure in nature). It is
good style to avoid expressions like ``the plot shows'' or
similar.
\part Upload your code, the data, and the slide as a zip to
Ilias. Deadline is 19h00. Structure the zip such that you can
present you program in front of the class. Several students will
be asked to present their slide and their code tomorrow morning.
\end{parts}
\end{questions}
\end{document}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,46 @@
\documentclass[addpoints,10pt]{exam}
\usepackage{url}
\usepackage{color}
\usepackage{hyperref}
\pagestyle{headandfoot}
\runningheadrule
\firstpageheadrule
\firstpageheader{Scientific Computing}{afternoon assignment day 02}{10/21/2014}
%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014}
\firstpagefooter{}{}{}
\runningfooter{}{}{}
\pointsinmargin
\bracketedpoints
%\printanswers
\shadedsolutions
\begin{document}
%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%%
\sffamily
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
\begin{questions}
\question Download example002 from yesterday (brain weights).
\begin{parts}
\part Simulate a null distribution via permutation.
\part Determine whether you can reject ``means are equal'' on a
5\% significance level using the simulated null distribution.
\part Check whether the means are different with a two sample
t-test in matlab ({\tt ttest2}).
\part Plot the data appropriately and generate a single slide that
contains the plot and short discussion of the test that respects
the nature statistical checklist (ignore all question whether the
assumptions of the test are satisfied).
\part Upload the slide and the code to Ilias. Deadline is 19h00.
\end{parts}
\end{questions}
\end{document}

View File

@@ -0,0 +1,65 @@
\documentclass[addpoints,10pt]{exam}
\usepackage{url}
\usepackage{color}
\usepackage{hyperref}
\pagestyle{headandfoot}
\runningheadrule
\firstpageheadrule
\firstpageheader{Scientific Computing}{afternoon assignment day 02}{10/22/2014}
%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014}
\firstpagefooter{}{}{}
\runningfooter{}{}{}
\pointsinmargin
\bracketedpoints
%\printanswers
\shadedsolutions
\begin{document}
%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%%
\sffamily
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
\begin{questions}
\question When the p-value is small, we reject the null
hypothesis. For example, if you want to test whether two means are
not equal, the null hypothesis is ``means are equal''. If e.g. $p\le
0.05$ then we take it as sufficient evidence that the null
hypothesis is not true. Therefore, we assume that the means are not
equal (which is what you want to show).
In this exercise we will look at what kind of p-values we expect if
the null hypothesis is true. In our example, this would be the case
if the true means of two datasets are actually equal.
\begin{parts}
\part Think about how you expect the p-values to behave in that
situation.
\part Simulate the situation in which the means are equal by
repeating the following at least $1000$ times:
\begin{enumerate}
\item Generate two arrays {\tt x} and {\tt y} with $10$ normally
(Gaussian) distributed random numbers using {\tt randn}. By
construction, the true means behind the random number are zero.
\item Perform a two sample t-test ({\tt ttest2}) on {\tt x} and
{\tt y}. Store the p-value.
\end{enumerate}
\part Plot a histogram of the $1000$ p-values. What do you think
is the distribution the p-values (i.e. if you repeated this
experiment many more times, how would the histogram look like)?
\part Given what you find, think about whether the following
strategy is statistically valid: You collect $10$ data points from
each group and perform a test. If the test is not significant, you
collect $10$ more and repeat the test. If the test tells you that
there is a significant difference you stop. Otherwise you repeat
the procedure until the test is significant.
\end{parts}
\end{questions}
\end{document}

View File

@@ -0,0 +1,43 @@
MAO,Diagnosis
6.8,I
4.1,I
7.3,I
14.2,I
18.8,I
9.9,I
7.4,I
11.9,I
5.2,I
7.8,I
7.8,I
8.7,I
12.7,I
14.5,I
10.7,I
8.4,I
9.7,I
10.6,I
7.8,II
4.4,II
11.4,II
3.1,II
4.3,II
10.1,II
1.5,II
7.4,II
5.2,II
10,II
3.7,II
5.5,II
8.5,II
7.7,II
6.8,II
3.1,II
6.4,III
10.8,III
1.1,III
2.9,III
4.5,III
5.8,III
9.4,III
6.8,III
1 MAO Diagnosis
2 6.8 I
3 4.1 I
4 7.3 I
5 14.2 I
6 18.8 I
7 9.9 I
8 7.4 I
9 11.9 I
10 5.2 I
11 7.8 I
12 7.8 I
13 8.7 I
14 12.7 I
15 14.5 I
16 10.7 I
17 8.4 I
18 9.7 I
19 10.6 I
20 7.8 II
21 4.4 II
22 11.4 II
23 3.1 II
24 4.3 II
25 10.1 II
26 1.5 II
27 7.4 II
28 5.2 II
29 10 II
30 3.7 II
31 5.5 II
32 8.5 II
33 7.7 II
34 6.8 II
35 3.1 II
36 6.4 III
37 10.8 III
38 1.1 III
39 2.9 III
40 4.5 III
41 5.8 III
42 9.4 III
43 6.8 III

View File

@@ -0,0 +1,186 @@
Weight,Sex
1607,m
1157,m
1248,m
1310,m
1398,m
1237,m
1232,m
1343,m
1380,m
1274,m
1245,m
1286,m
1508,m
1105,m
1123,m
1198,m
1300,m
1249,m
1185,m
915,m
1345,m
1107,m
1357,m
1227,m
1205,m
1435,m
1289,m
1093,m
1211,m
1260,m
1193,m
1330,m
1130,m
1357,m
1193,m
1232,m
1321,m
1260,m
1380,m
1230,m
1136,m
1029,m
1223,m
1240,m
1264,m
1020,m
1415,m
1410,m
1275,m
1230,m
1085,m
1048,m
1181,m
1103,m
1165,m
1547,m
1173,m
1660,m
1307,m
1535,m
1315,m
1257,m
1424,m
1309,m
1170,m
1412,m
1270,m
1230,m
1233,m
1561,m
1193,m
1272,m
1355,m
1137,m
1354,m
1110,m
1265,m
1407,m
1227,m
1330,m
1222,m
1305,m
1475,m
1177,m
1337,m
1145,m
1070,m
1305,m
1085,m
1303,m
1390,m
1532,m
1238,m
1233,m
1280,m
1245,m
1459,m
1157,m
1302,m
1385,m
1310,m
1342,m
1303,m
1248,m
1115,m
1365,m
1227,m
1353,m
1125,f
1027,f
1112,f
983,f
1090,f
1247,f
1045,f
983,f
972,f
1045,f
937,f
1245,f
1200,f
1270,f
1200,f
1145,f
1090,f
1040,f
1343,f
1010,f
1095,f
1180,f
1168,f
1095,f
1040,f
1235,f
1050,f
1038,f
1046,f
1255,f
1228,f
1000,f
1225,f
1220,f
1085,f
1067,f
1006,f
1138,f
1175,f
1252,f
1037,f
958,f
1020,f
1068,f
1107,f
1317,f
952,f
1056,f
1203,f
1183,f
1392,f
1130,f
1284,f
996,f
1228,f
1087,f
1035,f
1170,f
1064,f
1250,f
1129,f
1088,f
1037,f
1117,f
1095,f
1027,f
1027,f
1190,f
1153,f
1037,f
1120,f
1212,f
1024,f
1135,f
1177,f
1096,f
1114,f
1 Weight Sex
2 1607 m
3 1157 m
4 1248 m
5 1310 m
6 1398 m
7 1237 m
8 1232 m
9 1343 m
10 1380 m
11 1274 m
12 1245 m
13 1286 m
14 1508 m
15 1105 m
16 1123 m
17 1198 m
18 1300 m
19 1249 m
20 1185 m
21 915 m
22 1345 m
23 1107 m
24 1357 m
25 1227 m
26 1205 m
27 1435 m
28 1289 m
29 1093 m
30 1211 m
31 1260 m
32 1193 m
33 1330 m
34 1130 m
35 1357 m
36 1193 m
37 1232 m
38 1321 m
39 1260 m
40 1380 m
41 1230 m
42 1136 m
43 1029 m
44 1223 m
45 1240 m
46 1264 m
47 1020 m
48 1415 m
49 1410 m
50 1275 m
51 1230 m
52 1085 m
53 1048 m
54 1181 m
55 1103 m
56 1165 m
57 1547 m
58 1173 m
59 1660 m
60 1307 m
61 1535 m
62 1315 m
63 1257 m
64 1424 m
65 1309 m
66 1170 m
67 1412 m
68 1270 m
69 1230 m
70 1233 m
71 1561 m
72 1193 m
73 1272 m
74 1355 m
75 1137 m
76 1354 m
77 1110 m
78 1265 m
79 1407 m
80 1227 m
81 1330 m
82 1222 m
83 1305 m
84 1475 m
85 1177 m
86 1337 m
87 1145 m
88 1070 m
89 1305 m
90 1085 m
91 1303 m
92 1390 m
93 1532 m
94 1238 m
95 1233 m
96 1280 m
97 1245 m
98 1459 m
99 1157 m
100 1302 m
101 1385 m
102 1310 m
103 1342 m
104 1303 m
105 1248 m
106 1115 m
107 1365 m
108 1227 m
109 1353 m
110 1125 f
111 1027 f
112 1112 f
113 983 f
114 1090 f
115 1247 f
116 1045 f
117 983 f
118 972 f
119 1045 f
120 937 f
121 1245 f
122 1200 f
123 1270 f
124 1200 f
125 1145 f
126 1090 f
127 1040 f
128 1343 f
129 1010 f
130 1095 f
131 1180 f
132 1168 f
133 1095 f
134 1040 f
135 1235 f
136 1050 f
137 1038 f
138 1046 f
139 1255 f
140 1228 f
141 1000 f
142 1225 f
143 1220 f
144 1085 f
145 1067 f
146 1006 f
147 1138 f
148 1175 f
149 1252 f
150 1037 f
151 958 f
152 1020 f
153 1068 f
154 1107 f
155 1317 f
156 952 f
157 1056 f
158 1203 f
159 1183 f
160 1392 f
161 1130 f
162 1284 f
163 996 f
164 1228 f
165 1087 f
166 1035 f
167 1170 f
168 1064 f
169 1250 f
170 1129 f
171 1088 f
172 1037 f
173 1117 f
174 1095 f
175 1027 f
176 1027 f
177 1190 f
178 1153 f
179 1037 f
180 1120 f
181 1212 f
182 1024 f
183 1135 f
184 1177 f
185 1096 f
186 1114 f