day 2 done

This commit is contained in:
Fabian Sinz 2014-10-15 17:50:51 +02:00
parent 7e4d79a2c5
commit 065efd18b1
39 changed files with 10700 additions and 632 deletions

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

@ -1,3 +1,3 @@
Brain Weight In 1888, P. Topinard published data on the brain weights
Brain Weight: In 1888, P. Topinard published data on the brain weights
of hundreds of French men and women. Brain weights are given in
gram.

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
statistics/figs/example01.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
statistics/figs/hunger.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Binary file not shown.

BIN
statistics/figs/statistic1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
statistics/figs/statistic2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

BIN
statistics/figs/statistic3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
statistics/figs/statistic4.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -22,14 +22,19 @@
% \useoutertheme{miniframes}
}
\AtBeginSection[]
\AtBeginSubsection[]
{
\begin{frame}<beamer>
\begin{center}
\Huge \insertsectionhead
\end{center}
\tableofcontents[
currentsubsection,
hideothersubsections,
sectionstyle=show/hide,
subsectionstyle=show/shaded,
]
% \frametitle{\insertsectionhead}
% \tableofcontents[currentsection,hideothersubsections]
\end{frame}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
@ -84,25 +89,7 @@ Bernstein Center T\"ubingen}
\end{frame}
\begin{frame}
\frametitle{plan}
\setcounter{tocdepth}{1}
\tableofcontents
\end{frame}
\begin{frame}
\frametitle{information}
\begin{itemize}
\item Samuels, M. L., Wittmer, J. A., \& Schaffner,
A. A. (2010). Statistics for the Life Sciences (4th ed.,
p. 668). Prentice Hall.
\item Zar, J. H. (1999). Biostatistical Analysis. (D. Lynch,
Ed.)Prentice Hall New Jersey (4th ed., Vol. 4th, p. 663). Prentice
Hall. doi:10.1037/0012764
\item \url{http://stats.stackexchange.com}
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% errorbars (error bar paper)
% confidence intervals (sources of error)
@ -170,8 +157,7 @@ Bernstein Center T\"ubingen}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section[descriptive statistics, errorbars, and plots]{Day 1 --
descriptive statistics and plots}
\section{Day 1 -- descriptive statistics and plots}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{types of data}
@ -523,7 +509,7 @@ correlation coefficient does not have that property.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{nominal scale}
\subsection{plotting data}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------------------------------------------------------------

File diff suppressed because it is too large Load Diff

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,19 @@
load thymusglandweights.dat
n = 80;
x = thymusglandweights(1:n);
m = 5000;
me = zeros(m,1);
for i = 1:m
me(i) = median(x(randi(n,n,1)));
end
t025 = tinv(0.025, n-1);
t975 = tinv(0.975, n-1);
se = std(x)/sqrt(n);
fprintf('bootstrap quantiles: %.4f, %.4f \n', quantile(me,0.025), quantile(me,0.975));
fprintf('analytical quantile: %.4f, %.4f \n', mean(x)+t025*se, mean(x)+t975*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));

38
statistics/matlab/tests.m Normal file
View File

@ -0,0 +1,38 @@
close all
clear all
load thymusglandweights.dat
literature_mean = 34.3;
x = thymusglandweights;
n = length(x);
y = x - mean(x) + literature_mean;
m = 2000;
me = zeros(m,1);
for i = 1:m
me(i) = median(y(randi(n,n,1)));
end
hist(me, 50);
hold on
mu = mean(x);
plot([mu,mu],[0,200],'--r','LineWidth',3);
xlabel('thymus gland weights [g]');
ylabel('frequency');
title('bootstrapped null distribution');
hold off
% 5% significance boundaries
low = quantile(me,0.025);
high = quantile(me,0.975);
disp(['the 5% boundaries are: ', num2str(low), ' ', num2str(high)]);
hold on
plot([low,low],[0,200],'--g','LineWidth',3);
plot([high,high],[0,200],'--g','LineWidth',3);
hold off
pval = mean(abs(me-literature_mean) > abs(mu - literature_mean))
legend('Null distribution','measured mean','5% significance boundaries')

File diff suppressed because it is too large Load Diff