changed title

This commit is contained in:
Fabian Sinz 2014-10-02 08:01:29 +02:00
parent 2f90fea723
commit 32bd0392c9
152 changed files with 15878 additions and 0 deletions

24
statistics/Makefile Normal file
View File

@ -0,0 +1,24 @@
DOTSOURCES = $(wildcard figs/*.dot)
all: $(DOTSOURCES:dot=pdf)
python figs/generate.py
python figs/generate03.py
python figs/generateTPlots.py
pdflatex talk*.tex
pdflatex talk*.tex
pdflatex talk*.tex
figs/prob%.pdf : figs/prob%.dot
dot -Tpdf -o $@ $<
figs/test%.pdf : figs/test%.dot
dot -Tpdf -o $@ $<
figs/fig%.pdf : figs/fig%.dot
dot -Tpdf -o $@ $<
clean:
rm -rf *.dvi *.pdf *.aux *.out *.log auto *.nav *.snm *.toc *.vrb

View File

@ -0,0 +1 @@
../latex/beamercolorthemetuebingen.sty

218
statistics/certificate.lyx Normal file
View File

@ -0,0 +1,218 @@
#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass g-brief2
\begin_preamble
\fenstermarken % prints address window marks
\faltmarken % prints folding marks
%\lochermarke % prints puncher marks
\trennlinien % prints striplines
%\unserzeichen % prints "our ref" instead of "my ref"
\end_preamble
\use_default_options false
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman palatino
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 12
\spacing onehalf
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 4
\tocdepth 4
\paragraph_separation skip
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle empty
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Note Note
status open
\begin_layout Plain Layout
Note also the document preamble settings.
\end_layout
\end_inset
\end_layout
\begin_layout NameRowA
Dr.
rer.
nat.
Fabian Sinz
\end_layout
\begin_layout NameRowB
\end_layout
\begin_layout NameRowC
\end_layout
\begin_layout NameRowD
\end_layout
\begin_layout NameRowE
\end_layout
\begin_layout NameRowF
\end_layout
\begin_layout NameRowG
\end_layout
\begin_layout AddressRowA
University Tübingen
\end_layout
\begin_layout AddressRowB
\end_layout
\begin_layout AddressRowC
Auf der Morgenstelle 28
\end_layout
\begin_layout AddressRowD
72076 Tübingen
\end_layout
\begin_layout InternetRowA
http:/
\begin_inset Formula $\!$
\end_inset
/www.epagoge.de
\end_layout
\begin_layout InternetRowB
fabian.sinz@epagoge.de
\end_layout
\begin_layout ReturnAddress
University Tübingen
\begin_inset Formula $\cdot$
\end_inset
Auf der Morgenstelle 28
\begin_inset Formula $\cdot$
\end_inset
72076 Tübingen
\end_layout
\begin_layout Date
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
today
\end_layout
\end_inset
\end_layout
\begin_layout Reference
\end_layout
\begin_layout Opening
To whom it may concern,
\end_layout
\begin_layout Closing
Best regards
\end_layout
\begin_layout Signature
Dr.
Fabian Sinz
\end_layout
\begin_layout Encl.
\end_layout
\begin_layout Letter
this letter certifies that
\emph on
Lakshmi Channappa
\emph default
attended the course
\emph on
Statistics in a Nutshell
\emph default
held at the Neurochip research group at the
\emph on
Naturwissenschaftliches und Medizinisches Institut Reutlingen
\emph default
in 2013
\emph on
.
\emph default
The course was organized in two lectures of four hours each and covered
topics such as basics of probability theory, errorbars and confidence intervals
, statistical tests, p-values, multiple hypothesis testing, basics of study
design, and basics of ANOVA.
Small calculation and programming exercises were used to clarify selected
material.
\end_layout
\end_body
\end_document

123
statistics/environments.tex Normal file
View File

@ -0,0 +1,123 @@
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
\definecolor{crimson}{HTML}{DC143C}
\definecolor{cornflowerblue}{HTML}{6495ED}
\definecolor{dodgerblue}{HTML}{1E90FF}
\definecolor{deepskyblue}{HTML}{00BFFF}
\definecolor{gainsboro}{HTML}{DCDCDC}
\definecolor{ghostwhite}{HTML}{F8F8F8}
\definecolor{lightgray}{HTML}{D3D3D3}
\newenvironment<>{emphasize}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=black,bg=orange!100}
\setbeamercolor{block body}{fg=black,bg=cornflowerblue!70}
% \setbeamercolor{itemize item}{fg=orange!20!black}
% \setbeamertemplate{itemize item}[triangle]
\setbeamerfont{block title}{series=\bfseries}
% \setbeamerfont{block body}{family=\ttfamily}
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
\newenvironment<>{solution}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=black,bg=dodgerblue!100}
\setbeamercolor{block body}{fg=black,bg=lightgray!70}
% \setbeamercolor{itemize item}{fg=orange!20!black}
% \setbeamertemplate{itemize item}[triangle]
\setbeamerfont{block title}{series=\bfseries}
% \setbeamerfont{block body}{family=\ttfamily}
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
\newenvironment<>{question}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=black,bg=dodgerblue!100}
\setbeamercolor{block body}{fg=black,bg=lightgray!70}
% \setbeamercolor{itemize item}{fg=orange!20!black}
% \setbeamertemplate{itemize item}[triangle]
\setbeamerfont{block title}{series=\bfseries}
% \setbeamerfont{block body}{family=\ttfamily}
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
\renewenvironment<>{definition}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=black,bg=dodgerblue!100}
\setbeamercolor{block body}{fg=black,bg=lightgray!70}
% \setbeamercolor{itemize item}{fg=orange!20!black}
% \setbeamertemplate{itemize item}[triangle]
\setbeamerfont{block title}{series=\bfseries}
% \setbeamerfont{block body}{family=\ttfamily}
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
\newenvironment<>{description}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=white,bg=gray}
\setbeamercolor{block body}{fg=black,bg=gray!30}
% \setbeamercolor{itemize item}{fg=orange!20!black}
% \setbeamertemplate{itemize item}[triangle]
\setbeamerfont{block title}{family=\sffamily, series=\bfseries}
\setbeamerfont{block body}{family=\ttfamily}
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
\newenvironment<>{task}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=black,bg=dodgerblue!100}
\setbeamercolor{block body}{fg=black,bg=deepskyblue!80}
% \setbeamercolor{itemize item}{fg=orange!20!black}
% \setbeamertemplate{itemize item}[triangle]
\setbeamerfont{block title}{series=\bfseries}
% \setbeamerfont{block body}{family=\ttfamily}
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
\newenvironment<>{summary}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=black,bg=blue!40}
\setbeamercolor{block body}{fg=black,bg=blue!20}
% \setbeamercolor{itemize item}{fg=orange!20!black}
% \setbeamertemplate{itemize item}[triangle]
\setbeamerfont{block title}{series=\bfseries}
% \setbeamerfont{block body}{family=\ttfamily}
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
%%%%%%%%%%%%%%%%%%% PROGRESSBAR %%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{pbblue}{HTML}{0A75A8}% filling color for the progress bar
\definecolor{pbgray}{HTML}{575757}% background color for the progress bar
\definecolor{pbgreen}{HTML}{57EE57}% green color for the progress bar

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
statistics/figs/HE0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
statistics/figs/HE1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
statistics/figs/HE2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
statistics/figs/HE3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
statistics/figs/Joint00.pdf Normal file

Binary file not shown.

BIN
statistics/figs/Joint01.pdf Normal file

Binary file not shown.

BIN
statistics/figs/Joint02.pdf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
statistics/figs/Uniform.pdf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

Binary file not shown.

15
statistics/figs/fig0.dot Normal file
View File

@ -0,0 +1,15 @@
digraph G {
rankdir=TB;
node [fontsize=12, shape=rectangle, style=filled];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="?"];
nominal[label="?"];
data->IR[label="interval/ratio"]
data->nominal[label="nominal/discrete"]
data->ordinal[label="ordinal"]
}

BIN
statistics/figs/fig0.pdf Normal file

Binary file not shown.

94
statistics/figs/fig01.dot Executable file
View File

@ -0,0 +1,94 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.95,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
subgraph cluster_IR {
label = "interval/ ratio";
bgcolor=lightblue;
IR[label="data normal distributed\nor n large?"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
trulynotnormal->twosampNN[label="2 groups"];
signrank[label="Wilcoxon signed\nrank test"];
trulynotnormal->signrank[label="1 group\n(fix other\ngroup to\n one value)"];
}
trulynotnormal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
twosampNN->signrank[label="paired"];
twosampNN->indepTwosampNN[label="independent"];
data->ordinal[label="ordinal"];
subgraph cluster_O {
label = "ordinal";
bgcolor=lightblue;
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
signtest[label="sign test"];
ordinal[label="1, 2, or >2 groups?"];
ordinal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
}
subgraph cluster_ND {
label = "nominal/discrete";
bgcolor=lightblue;
nd_test_type[label="1, 2, or >2 variables",color="green"];
}
data[label="type of data?"];
data->IR[label="interval/ratio"];
data->nd_test_type[label="nominal/discrete",color="red"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
}

BIN
statistics/figs/fig01.pdf Normal file

Binary file not shown.

96
statistics/figs/fig02.dot Normal file
View File

@ -0,0 +1,96 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.95,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
subgraph cluster_IR {
label = "interval/ ratio";
bgcolor=lightblue;
IR[label="data normal distributed\nor n large?"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
trulynotnormal->twosampNN[label="2 groups"];
signrank[label="Wilcoxon signed\nrank test"];
trulynotnormal->signrank[label="1 group\n(fix other\ngroup to\n one value)"];
}
trulynotnormal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
twosampNN->signrank[label="paired"];
twosampNN->indepTwosampNN[label="independent"];
data->ordinal[label="ordinal"];
subgraph cluster_O {
label = "ordinal";
bgcolor=lightblue;
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
signtest[label="sign test"];
ordinal[label="1, 2, or >2 groups?"];
ordinal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
}
subgraph cluster_ND {
label = "nominal/discrete";
bgcolor=lightblue;
nd_test_type[label="1, 2, or >2 variables",color="green"];
onesampND[label="chi square for\ngoodness of fit"];
nd_test_type->onesampND[label="1 variable"];
}
data[label="type of data?"];
data->IR[label="interval/ratio"];
data->nd_test_type[label="nominal/discrete",color="red"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
}

BIN
statistics/figs/fig02.pdf Normal file

Binary file not shown.

98
statistics/figs/fig03.dot Normal file
View File

@ -0,0 +1,98 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.95,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
subgraph cluster_IR {
label = "interval/ ratio";
bgcolor=lightblue;
IR[label="data normal distributed\nor n large?"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
trulynotnormal->twosampNN[label="2 groups"];
signrank[label="Wilcoxon signed\nrank test"];
trulynotnormal->signrank[label="1 group\n(fix other\ngroup to\n one value)"];
}
trulynotnormal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
twosampNN->signrank[label="paired"];
twosampNN->indepTwosampNN[label="independent"];
data->ordinal[label="ordinal"];
subgraph cluster_O {
label = "ordinal";
bgcolor=lightblue;
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
signtest[label="sign test"];
ordinal[label="1, 2, or >2 groups?"];
ordinal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
}
subgraph cluster_ND {
label = "nominal/discrete";
bgcolor=lightblue;
nd_test_type[label="1, 2, or >2 variables",color="green"];
onesampND[label="chi square for\ngoodness of fit"];
twosampND[label="chi square for\nindependence"];
nd_test_type->onesampND[label="1 variable"];
nd_test_type->twosampND[label="2 variables"];
}
data[label="type of data?"];
data->IR[label="interval/ratio"];
data->nd_test_type[label="nominal/discrete",color="red"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
}

BIN
statistics/figs/fig03.pdf Normal file

Binary file not shown.

99
statistics/figs/fig04.dot Normal file
View File

@ -0,0 +1,99 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.95,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
subgraph cluster_IR {
label = "interval/ ratio";
bgcolor=lightblue;
IR[label="data normal distributed\nor n large?"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
trulynotnormal->twosampNN[label="2 groups"];
signrank[label="Wilcoxon signed\nrank test"];
trulynotnormal->signrank[label="1 group\n(fix other\ngroup to\n one value)"];
}
trulynotnormal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
twosampNN->signrank[label="paired"];
twosampNN->indepTwosampNN[label="independent"];
data->ordinal[label="ordinal"];
subgraph cluster_O {
label = "ordinal";
bgcolor=lightblue;
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
signtest[label="sign test"];
ordinal[label="1, 2, or >2 groups?"];
ordinal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
}
subgraph cluster_ND {
label = "nominal/discrete";
bgcolor=lightblue;
nd_test_type[label="1, 2, or >2 variables",color="green"];
onesampND[label="chi square for\ngoodness of fit"];
twosampND[label="chi square for\nindependence"];
nd_test_type->onesampND[label="1 variable"];
nd_test_type->onesampND[label="n variables",color="red"];
nd_test_type->twosampND[label="2 variables"];
}
data[label="type of data?"];
data->IR[label="interval/ratio"];
data->nd_test_type[label="nominal/discrete"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
}

BIN
statistics/figs/fig04.pdf Normal file

Binary file not shown.

99
statistics/figs/fig05.dot Normal file
View File

@ -0,0 +1,99 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.95,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
subgraph cluster_IR {
label = "interval/ ratio";
bgcolor=lightblue;
IR[label="data normal distributed\nor n large?"];
normal[label="1, 2, or >2 groups?",color="green"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
trulynotnormal->twosampNN[label="2 groups"];
signrank[label="Wilcoxon signed\nrank test"];
trulynotnormal->signrank[label="1 group\n(fix other\ngroup to\n one value)"];
}
trulynotnormal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
twosampNN->signrank[label="paired"];
twosampNN->indepTwosampNN[label="independent"];
data->ordinal[label="ordinal"];
subgraph cluster_O {
label = "ordinal";
bgcolor=lightblue;
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
signtest[label="sign test"];
ordinal[label="1, 2, or >2 groups?"];
ordinal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
}
subgraph cluster_ND {
label = "nominal/discrete";
bgcolor=lightblue;
nd_test_type[label="1, 2, or >2 variables"];
onesampND[label="chi square for\ngoodness of fit"];
twosampND[label="chi square for\nindependence"];
nd_test_type->onesampND[label="1 variable"];
nd_test_type->onesampND[label="n variables"];
nd_test_type->twosampND[label="2 variables"];
}
data[label="type of data?"];
data->IR[label="interval/ratio"];
data->nd_test_type[label="nominal/discrete"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
}

BIN
statistics/figs/fig05.pdf Normal file

Binary file not shown.

101
statistics/figs/fig06.dot Normal file
View File

@ -0,0 +1,101 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.95,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
subgraph cluster_IR {
label = "interval/ ratio";
bgcolor=lightblue;
IR[label="data normal distributed\nor n large?"];
normal[label="1, 2, or >2 groups?",color="green"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
trulynotnormal->twosampNN[label="2 groups"];
signrank[label="Wilcoxon signed\nrank test"];
trulynotnormal->signrank[label="1 group\n(fix other\ngroup to\n one value)"];
ANOVA;
normal->ANOVA[color="red"];
}
trulynotnormal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
twosampNN->signrank[label="paired"];
twosampNN->indepTwosampNN[label="independent"];
data->ordinal[label="ordinal"];
subgraph cluster_O {
label = "ordinal";
bgcolor=lightblue;
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
signtest[label="sign test"];
ordinal[label="1, 2, or >2 groups?"];
ordinal->signtest[label="1 group\n(fix other\ngroup to\n one value)"];
}
subgraph cluster_ND {
label = "nominal/discrete";
bgcolor=lightblue;
nd_test_type[label="1, 2, or >2 variables"];
onesampND[label="chi square for\ngoodness of fit"];
twosampND[label="chi square for\nindependence"];
nd_test_type->onesampND[label="1 variable"];
nd_test_type->onesampND[label="n variables"];
nd_test_type->twosampND[label="2 variables"];
}
data[label="type of data?"];
data->IR[label="interval/ratio"];
data->nd_test_type[label="nominal/discrete"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
}

BIN
statistics/figs/fig06.pdf Normal file

Binary file not shown.

22
statistics/figs/fig1.dot Normal file
View File

@ -0,0 +1,22 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="?"];
IR->normal[label="normal"];
}

BIN
statistics/figs/fig1.pdf Normal file

Binary file not shown.

58
statistics/figs/fig10.dot Normal file
View File

@ -0,0 +1,58 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.95,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="1, 2, or >2 groups?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
trulynotnormal->twosampNN[label="2 groups"];
twosampNN->indepTwosampNN[label="independent"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
signtest[label="sign test"];
signrank[label="Wilcoxon signed\nrank test",color="lightblue"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
twosampNN->signrank[label="paired"];
}

BIN
statistics/figs/fig10.pdf Normal file

Binary file not shown.

81
statistics/figs/fig11.dot Normal file
View File

@ -0,0 +1,81 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.95,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
subgraph cluster_IR {
label = "interval/ ratio";
bgcolor=lightblue;
IR[label="data normal distributed\nor n large?"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
trulynotnormal->twosampNN[label="2 groups"];
signrank[label="Wilcoxon signed\nrank test"];
}
twosampNN->signrank[label="paired"];
twosampNN->indepTwosampNN[label="independent"];
data->ordinal[label="ordinal"];
subgraph cluster_O {
label = "ordinal";
bgcolor=lightblue;
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
signtest[label="sign test"];
}
data[label="type of data?"];
ordinal[label="1, 2, or >2 groups?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
}

BIN
statistics/figs/fig11.pdf Normal file

Binary file not shown.

83
statistics/figs/fig12.dot Normal file
View File

@ -0,0 +1,83 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.95,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
subgraph cluster_IR {
label = "interval/ ratio";
bgcolor=lightblue;
IR[label="data normal distributed\nor n large?"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
trulynotnormal->twosampNN[label="2 groups"];
signrank[label="Wilcoxon signed\nrank test"];
trulynotnormal->signrank[label="1 group\n(fix other\ngroup to\n one value)",color="red"];
}
trulynotnormal->signtest[label="1 group\n(fix other\ngroup to\n one value)",color="red"];
twosampNN->signrank[label="paired"];
twosampNN->indepTwosampNN[label="independent"];
data->ordinal[label="ordinal"];
subgraph cluster_O {
label = "ordinal";
bgcolor=lightblue;
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
signtest[label="sign test"];
ordinal[label="1, 2, or >2 groups?"];
ordinal->signtest[label="1 group\n(fix other\ngroup to\n one value)",color="red"];
}
data[label="type of data?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
}

BIN
statistics/figs/fig12.pdf Normal file

Binary file not shown.

28
statistics/figs/fig2.dot Normal file
View File

@ -0,0 +1,28 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="?",color="lightblue"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
}

BIN
statistics/figs/fig2.pdf Normal file

Binary file not shown.

28
statistics/figs/fig3.dot Normal file
View File

@ -0,0 +1,28 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.75,ranksep=0.75];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
}

BIN
statistics/figs/fig3.pdf Normal file

Binary file not shown.

30
statistics/figs/fig4.dot Normal file
View File

@ -0,0 +1,30 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.75,ranksep=0.75];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
}

BIN
statistics/figs/fig4.pdf Normal file

Binary file not shown.

38
statistics/figs/fig5.dot Normal file
View File

@ -0,0 +1,38 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.75,ranksep=0.75];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
twosamp[label="paired or\nnot paired?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
}

BIN
statistics/figs/fig5.pdf Normal file

Binary file not shown.

49
statistics/figs/fig6.dot Normal file
View File

@ -0,0 +1,49 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.75,ranksep=0.75];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="1, 2, or >2 groups?",color="lightblue"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?",color="lightblue"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?",color="lightblue"];
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest",color="lightblue"];
trulynotnormal->twosampNN[label="2 groups"];
twosampNN->indepTwosampNN[label="independent"];
twosampOrd[label="paired or\nindependent?",color="lightblue"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
}

BIN
statistics/figs/fig6.pdf Normal file

Binary file not shown.

52
statistics/figs/fig7.dot Normal file
View File

@ -0,0 +1,52 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.75,ranksep=0.75];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="1, 2, or >2 groups?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
trulynotnormal->twosampNN[label="2 groups"];
twosampNN->indepTwosampNN[label="independent"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="indepdendent"];
ttest[label="?",color="lightblue"];
twosamp->ttest[label="independent"];
}

BIN
statistics/figs/fig7.pdf Normal file

Binary file not shown.

54
statistics/figs/fig8.dot Normal file
View File

@ -0,0 +1,54 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.75,ranksep=0.75];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="1, 2, or >2 groups?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
trulynotnormal->twosampNN[label="2 groups"];
twosampNN->indepTwosampNN[label="independent"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="indepdendent"];
ttest[label="t-test",color="lightblue"];
twosamp->ttest[label="independent"];
pairedTwosampNN[label="?",color="lightblue"];
twosampNN->pairedTwosampNN[label="paired"];
twosampOrd->pairedTwosampNN[label="paired"];
}

BIN
statistics/figs/fig8.pdf Normal file

Binary file not shown.

54
statistics/figs/fig9.dot Normal file
View File

@ -0,0 +1,54 @@
digraph G {
rankdir=TB;
ranksep=0.2;
node [fontsize=12, shape=rectangle, style=filled, nodesep=0.75,ranksep=0.95];
edge [penwidth=2, fontsize=10 ];
data[label="type of data?"];
IR[label="data normal distributed\nor n large?"];
ordinal[label="1, 2, or >2 groups?"];
nominal[label="?"];
data->IR[label="interval/ratio"];
data->nominal[label="nominal/discrete"];
data->ordinal[label="ordinal"];
normal[label="1, 2, or >2 groups?"];
notnormal[label="transform into\nnormal?"];
trulynotnormal[label="1, 2, or >2 groups?"];
IR->normal[label="normal"];
IR->notnormal[label="not normal"];
notnormal->normal[label="yes"];
notnormal->trulynotnormal[label="no"];
onesamp[label="one-sample\nt-test"];
normal->onesamp[label="1 group"];
twosamp[label="paired or\nindependent?"];
pairedttest[label="paired\nt-test"];
normal->twosamp[label="2 groups"];
twosamp->pairedttest[label="paired"];
twosampNN[label="paired or\nindependent?"];
indepTwosampNN[label="Wilcoxon-Mann-Whitney\ntest"];
trulynotnormal->twosampNN[label="2 groups"];
twosampNN->indepTwosampNN[label="independent"];
twosampOrd[label="paired or\nindependent?"];
ordinal->twosampOrd[label="2 groups"];
twosampOrd->indepTwosampNN[label="independent"];
ttest[label="t-test"];
twosamp->ttest[label="independent"];
signtest[label="sign test"];
twosampNN->signtest[label="paired"];
twosampOrd->signtest[label="paired"];
}

BIN
statistics/figs/fig9.pdf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

106
statistics/figs/generate.py Normal file
View File

@ -0,0 +1,106 @@
from __future__ import division
import seaborn as sns
import sys
sys.path.append('/home/fabee/code/')
from matplotlib.pyplot import *
from fabee.Plotting import *
from scipy import stats
from numpy import *
sns.set_context("talk", font_scale=1.5, rc={"lines.linewidth": 2.5})
# ---------------------------------------------------------------------------
fig, ax = subplots()
fig.subplots_adjust(bottom=.3, left=.3)
n = 50
x = loadtxt('scripts/thymusglandweights.dat')[:n]
ax.bar([0,1],[mean(x),mean(x)],yerr = [std(x,ddof=1), std(x,ddof=1)/sqrt(n)],
facecolor='dodgerblue', alpha=.8,width=.7, align='center',
error_kw={'color':'k','lw':2}, capsize=10, ecolor='k')
ax.set_title('standard deviation or standard error?',fontsize=14, fontweight='bold')
ax.set_xlim([-.5,1.5])
box_off(ax)
#disjoint_axes(ax)
ax.set_xticks([0,1])
ax.set_xticklabels([r'$\hat\sigma$', r'$\frac{\hat\sigma}{\sqrt{n}}$'], fontsize=30)
ax.set_ylabel(r'$\frac{1}{n}\sum_{i=1}^n x_i$',fontsize=30, fontweight='bold')
fig.savefig('figs/StandardErrorOrStandardDeviation.pdf')
# ---------------------------------------------------------------------------
fig, ax = subplots()
t = linspace(-5,5,1000)
t2 = linspace(stats.laplace.ppf(0.025),stats.laplace.ppf(1-0.025),1000)
ax.fill_between(t,stats.laplace.pdf(t),color='dodgerblue')
ax.set_xticks([])
ax.text(5,-0.05, r'$\hat m$',fontsize=30)
ax.text(0,0.7, r'$m$',fontsize=30)
ax.set_yticks([])
#disjoint_axes(ax)
box_off(ax)
ax.set_title('putative sampling distribution of the median',fontsize=14, fontweight='bold')
ax.axis([-5,5,0,.8])
ax.plot([0,0],[0,.7],'--k',lw=2)
fig.savefig('figs/samplingDistributionMedian00.pdf')
ax.fill_between(t2,stats.laplace.pdf(t2),color='crimson')
fig.savefig('figs/samplingDistributionMedian01.pdf')
# ---------------------------------------------------------------------------
fig, ax = subplots()
k = 7
N = 21
F = stats.f
t = linspace(1e-6,8,1000)
t2= linspace(F.ppf(0.95,k-1,N-k),8,1000)
ax.fill_between(t,F.pdf(t,k-1,N-k),color='dodgerblue')
ax.fill_between(t2,F.pdf(t2,k-1,N-k),color='crimson')
ax.set_xlabel('group MS/ error MS')
ax.set_ylabel(r'p(group MS/ error MS| $H_0$)')
ax.set_title('F-distribution',fontsize=14, fontweight='bold')
ax.set_ylim((0,0.8))
box_off(ax)
fig.savefig('figs/Fdistribution00.pdf')
# ---------------------------------------------------------------------------
fig, ax = subplots()
n = 5
p = stats.t.pdf
t = linspace(-5,8,1000)
t0 = 1.5
t00 = 1.
mu0 = 3
t1 = linspace(-5,t00,1000)
t2 = linspace(t0,8,1000)
t3 = linspace(-5,-t0,1000)
ax.fill_between(t,p(t,n-1),color='dodgerblue',alpha=1)
ax.fill_between(t2,p(t2,n-1),color='indigo',alpha=1)
ax.fill_between(t3,p(t3,n-1),color='indigo',alpha=1)
ax.set_xlabel('t')
ax.set_ylabel(r'sampling distribution')
ax.set_ylim((0,0.8))
box_off(ax)
fig.savefig('figs/experimentalDesign00.pdf')
ax.fill_between(t,p(t,n-1,loc=mu0),color='lime',alpha=.5)
ax.fill_between(t1,p(t1,n-1,loc=mu0),color='magenta',alpha=1)
ax.arrow(0,.4,mu0,0,head_width=0.05)
ax.arrow(mu0,.4,-mu0,0,head_width=0.05)
ax.text(mu0/2,.45,r'$\delta$',fontsize=20)
ax.set_xlabel('t')
ax.set_ylabel(r'sampling distribution')
ax.set_ylim((0,0.8))
box_off(ax)
fig.savefig('figs/experimentalDesign01.pdf')

View File

@ -0,0 +1,265 @@
import sys
import seaborn as sns
sys.path.append('/home/fabee/code/')
from matplotlib.pyplot import *
from fabee.Plotting import *
from scipy import stats
from numpy import *
sns.set_context("talk", font_scale=1.5, rc={"lines.linewidth": 2.5})
def hinton(matrix, max_weight=None, ax=None):
"""Draw Hinton diagram for visualizing a weight matrix."""
ax = ax if ax is not None else gca()
if not max_weight:
max_weight = 2**np.ceil(np.log(np.abs(matrix).max())/np.log(2))
ax.patch.set_facecolor('gray')
ax.set_aspect('equal', 'box')
ax.xaxis.set_major_locator(NullLocator())
ax.yaxis.set_major_locator(NullLocator())
for (x,y),w in np.ndenumerate(matrix):
color = 'white' if w > 0 else 'black'
size = np.sqrt(np.abs(w))
rect = Rectangle([x - size / 2, y - size / 2], size, size,
facecolor=color, edgecolor=color)
ax.add_patch(rect)
ax.autoscale_view()
ax.invert_yaxis()
# ---------------------------------------------------------------------------
fig, ax = subplots()
fig.subplots_adjust(bottom=.2)
ax.bar([0,1],[.2,.8],facecolor='dodgerblue', alpha=.8,width=.7, align='center')
ax.set_title('Bernoulli distribution',fontsize=16, fontweight='bold')
ax.set_xlim([-.5,1.5])
box_off(ax)
#disjoint_axes(ax)
ax.set_xlabel('outcomes',fontsize=14, fontweight='bold')
ax.set_ylabel('P(outcome)',fontsize=14, fontweight='bold')
ax.set_xticks([0,1])
ax.set_xticklabels([0,1])
ax.set_ylim((0,1))
fig.savefig('figs/Bernoulli.pdf')
# ---------------------------------------------------------------------------
fig, ax = subplots()
fig.subplots_adjust(bottom=.2)
n = 5
k = arange(0,n)
ax.bar(k,0*k+1./n,facecolor='dodgerblue', alpha=.8,width=.7, align='center')
ax.set_title('uniform distribution',fontsize=16, fontweight='bold')
box_off(ax)
#disjoint_axes(ax)
ax.set_xlabel('k',fontsize=14, fontweight='bold')
ax.set_ylabel('P(X=k)',fontsize=14, fontweight='bold')
ax.set_xticks(k)
ax.set_xticklabels(k+1)
ax.set_ylim((0,1))
fig.savefig('figs/Uniform.pdf')
# ---------------------------------------------------------------------------
for i,(n,p) in enumerate(zip([10,20],[.5,.8])):
fig, ax = subplots()
fig.subplots_adjust(bottom=.2)
k = arange(n+1)
ax.bar(k,stats.binom.pmf(k,n,p),facecolor='dodgerblue', alpha=.8,width=.7, align='center')
ax.set_title(r'binomial distribution $B\left(%.2f, %i\right)$' % (p,n),fontsize=16, fontweight='bold')
box_off(ax)
#disjoint_axes(ax)
ax.set_xlabel('k',fontsize=14, fontweight='bold')
ax.set_ylabel('P(k)',fontsize=14, fontweight='bold')
ax.set_xticks(k)
ax.set_xticklabels(k)
ax.set_xlim((-1,n+1))
ax.set_ylim((0,1))
fig.savefig('figs/Binomial%02i.pdf' % (i,))
# ---------------------------------------------------------------------------
n = 20
for i, lam in enumerate([5, 0.05]):
fig, ax = subplots()
fig.subplots_adjust(bottom=.2)
k = arange(n+1)
ax.bar(k,stats.poisson.pmf(k,lam),facecolor='dodgerblue', alpha=.8,width=.7, align='center')
ax.set_title(r'Poisson distribution $\lambda=%.2f$' % (lam,),fontsize=16, fontweight='bold')
box_off(ax)
#disjoint_axes(ax)
ax.set_xlabel('k',fontsize=14, fontweight='bold')
ax.set_ylabel('P(k)',fontsize=14, fontweight='bold')
ax.set_xticks(k)
ax.set_xticklabels(k)
ax.set_xlim((-1,n+1))
ax.set_ylim((0,1))
fig.savefig('figs/Poisson%02i.pdf' % (i,))
# ---------------------------------------------------------------------------
fig, ax = subplots()
fig.subplots_adjust(bottom=.2)
t = linspace(-3,3,200)
ax.fill_between(t,stats.norm.pdf(t),facecolor='dodgerblue', alpha=.8)
ax.set_title(r'Gaussian/Normal distribution $N(\mu,\sigma)$',fontsize=16, fontweight='bold')
box_off(ax)
#disjoint_axes(ax)
ax.set_xlabel('x',fontsize=14, fontweight='bold')
ax.set_ylabel('p(x)',fontsize=14, fontweight='bold')
fig.savefig('figs/Gaussian00.pdf')
# ---------------------------------------------------------------------------
fig, ax = subplots()
n = 10
kk = 5
p = .5
fig.subplots_adjust(bottom=.2)
k = arange(n+1)
ax.bar(k,stats.binom.pmf(k,n,p),facecolor='dodgerblue', alpha=.8,width=.7, align='center')
ax.bar(k[:kk+1],stats.binom.pmf(k[:kk+1],n,p),facecolor='crimson', alpha=.5,width=.7, align='center')
ax.set_title(r'binomial distribution $B\left(\frac{1}{2}, %i\right)$' % (n,), fontsize=16, fontweight='bold')
box_off(ax)
#disjoint_axes(ax)
ax.set_xlabel('k',fontsize=14, fontweight='bold')
ax.set_ylabel('P(k)',fontsize=14, fontweight='bold')
ax.set_xticks(k)
ax.set_xticklabels(k)
ax.set_xlim((-1,n+1))
ax.set_ylim((0,1))
fig.savefig('figs/BinomialCdf00.pdf' )
fig, ax = subplots()
n = 10
kk = 5
p = .5
fig.subplots_adjust(bottom=.2)
k = arange(n+1)
ax.bar(k,stats.binom.pmf(k,n,p),facecolor='dodgerblue', alpha=.8,width=.7, align='center',label='p.m.f.')
ax.bar(k[:kk+1],stats.binom.pmf(k[:kk+1],n,p),facecolor='crimson', alpha=.5,width=.7, align='center')
ax.plot(k,stats.binom.cdf(k,n,p),'ok',mfc='crimson', alpha=1.,label='c.d.f.', ms=15)
ax.set_title(r'binomial distribution $B\left(\frac{1}{2}, %i\right)$' % (n,), fontsize=16, fontweight='bold')
ax.legend(frameon=False, loc='best')
box_off(ax)
#disjoint_axes(ax)
ax.set_xlabel('k',fontsize=14, fontweight='bold')
ax.set_ylabel('P(k)',fontsize=14, fontweight='bold')
ax.set_xticks(k)
ax.set_xticklabels(k)
ax.set_xlim((-1,n+1))
ax.set_ylim((0,1.1))
fig.savefig('figs/BinomialCdf01.pdf' )
fig, ax = subplots()
n = 10
kk = 2
p = .5
fig.subplots_adjust(bottom=.2)
k = arange(n+1)
ax.bar(k,stats.binom.pmf(k,n,p),facecolor='dodgerblue', alpha=.8,width=.7, align='center',label='p.m.f.')
ax.bar(k[:kk+1],stats.binom.pmf(k[:kk+1],n,p),facecolor='crimson', alpha=.5,width=.7, align='center')
ax.bar(k[-kk-1:],stats.binom.pmf(k[-kk-1:],n,p),facecolor='crimson', alpha=.5,width=.7, align='center')
ax.set_title(r'binomial distribution $B\left(\frac{1}{2}, %i\right)$' % (n,), fontsize=16, fontweight='bold')
ax.legend(frameon=False, loc='best')
box_off(ax)
#disjoint_axes(ax)
ax.set_xlabel('k',fontsize=14, fontweight='bold')
ax.set_ylabel('P(k)',fontsize=14, fontweight='bold')
ax.set_xticks(k)
ax.set_xticklabels(k)
ax.set_xlim((-1,n+1))
ax.set_ylim((0,1.1))
fig.savefig('figs/BinomialExample00.pdf' )
#------------------------------------------------------
fig = figure(figsize=(10,3.5))
ax = fig.add_axes([.1,.13,.6,.3])
n = 10
p = [.5,.8]
q = [.7, .3]
fig.subplots_adjust(bottom=0.2)
k = arange(n+1)
P = vstack((stats.binom.pmf(k,n,p[0])*q[0], stats.binom.pmf(k,n,p[1])*q[1])).T
hinton(P, ax = None)
#disjoint_axes(ax)
ax.set_xticks(k)
ax.set_xticklabels(k)
ax.set_yticks([0,1])
ax.set_ylim((-.5,1.5))
ax.set_xlim((-.5,n+.5))
ax.set_yticklabels(['subject #1', 'subject #2'])
fig.savefig('figs/Joint00.pdf' )
ax = fig.add_axes([.75,.13,.2,.3])
ax.barh([0,1],q, facecolor='dodgerblue',alpha=.8, align='center')
box_off(ax)
#disjoint_axes(ax)
ax.set_xticks([0,.5,1.])
ax.set_yticks([])
ax.set_ylim((-.5,1.5))
fig.savefig('figs/Joint01.pdf' )
ax = fig.add_axes([.1,.6,.6,.2])
ax.bar(k,sum(P,axis=1), facecolor='dodgerblue',alpha=.8, align='center')
a = .7
ax.axis([-a,n-a+1.5,0,1])
box_off(ax)
#disjoint_axes(ax)
ax.set_xticks([])
ax.set_yticks([0,.3])
ax.set_ylim((0,.3))
fig.savefig('figs/Joint02.pdf' )
#------------------------------------------------------
n = 10
k = arange(n+1)
p = [.5,.8]
q = [.7, .3]
P = vstack((stats.binom.pmf(k,n,p[0])*q[0], stats.binom.pmf(k,n,p[1])*q[1]))
Pk = sum(P,axis=0)
fig = figure()
for i,kk in enumerate(k):
ax = fig.add_subplot(3,4,i+1)
fig.subplots_adjust(bottom=0.2)
ax.bar([0,1],P[:,i]/Pk[i], facecolor='dodgerblue',alpha=.8, align='center')
#disjoint_axes(ax)
ax.set_xticks([0,1])
ax.set_xticklabels(['#1','#2'], fontsize=8)
ax.set_yticks([0,.5,1])
ax.set_yticklabels([0,.5,1],fontsize=8)
ax.set_xlim((-.5,1.5))
ax.set_ylim((0,1))
ax.set_title('P({#1,#2}| %i successes)' % (i,), fontsize=8)
fig.subplots_adjust(wspace=.8, hspace=.8)
fig.savefig('figs/Posterior00.pdf')

View File

@ -0,0 +1,216 @@
import sys
sys.path.append('/home/fabee/code/')
import seaborn as sns
from matplotlib.pyplot import *
from scipy import stats
from numpy import *
from matplotlib.ticker import NullFormatter
sns.set_context("talk", font_scale=1.5, rc={"lines.linewidth": 2.5})
# --------------- PLOT 1 -------------------------
# the random data
distr = stats.uniform
col = '+*0<>v'
for k,distr in enumerate([stats.laplace, stats.norm, stats.expon,stats.uniform]):
col = [col[i] for i in random.permutation(6)]
x = random.randn(5000)
nullfmt = NullFormatter() # no labels
# definitions for the axes
left, width = 0.1, 0.65
bottom, height = 0.1, 0.65
bottom_h = left_h = left+width+0.02
rect_scatter = [left + 0.22, bottom + 0.22 , width, height]
rect_histx = [left + 0.22, bottom, width, 0.2]
rect_histy = [left, bottom + 0.22 , 0.2, height]
# start with a rectangular Figure
fig = figure(figsize=(8,8))
axQQ = axes(rect_scatter)
axHistx = axes(rect_histx)
axHisty = axes(rect_histy)
# no labels
axHistx.yaxis.set_major_formatter(nullfmt)
axHisty.xaxis.set_major_formatter(nullfmt)
axQQ.xaxis.set_major_formatter(nullfmt)
axQQ.yaxis.set_major_formatter(nullfmt)
# the scatter plot:
z = distr.ppf(stats.norm.cdf(x))
y = linspace(amin(z),amax(z),1000)
z = distr.ppf(stats.norm.cdf(x))
if distr != stats.norm:
if distr == stats.uniform:
axQQ.plot(x, z,'ok',marker=col[0],ms=5,label='c.d.f.')
else:
axQQ.plot(x, z,'ok',marker=col[0],ms=5,label='correct')
if distr != stats.expon:
axQQ.plot((z-amin(z))/(amax(z)-amin(z))*(amax(x)-amin(x)) + amin(x),\
(x-amin(x))/(amax(x)-amin(x))*(amax(z)-amin(z)) + amin(z),'ok',marker=col[1],ms=5)
axQQ.plot(x, (x-amin(x))/(amax(x)-amin(x))*(amax(z)-amin(z)) + amin(z),'ok',marker=col[2],ms=5)
# now determine nice limits by hand:
axHistx.hist(x, bins=100,normed=True)
if distr != stats.expon:
axHisty.plot(distr.pdf(y),y)
z2 = distr.pdf(y)
y = hstack((y[0],y,y[-1]))
z2 = hstack((0,z2,0))
axHisty.fill(z2,y,color=(.0,.0,1.))
axQQ.set_xlim(axHistx.get_xlim())
axQQ.set_ylim(axHisty.get_ylim())
if distr == stats.uniform:
axQQ.set_ylim((-.1,1.1))
axHisty.set_ylim((-.1,1.1))
axHisty.set_xlim((.0,1.1))
axHistx.set_xlabel('x',fontsize=16)
axHistx.set_ylabel('p(x)',fontsize=16)
axHisty.set_ylabel('y',fontsize=16)
axHisty.set_xlabel('p(y)',fontsize=16)
fig.savefig('figs/HE%i.png' % (k,))
if distr == stats.norm:
axQQ.plot(x, z,'ok',marker=col[0],ms=5)
elif distr == stats.expon:
axHisty.plot(distr.pdf(y),y)
z2 = distr.pdf(y)
y = hstack((y[0],y,y[-1]))
z2 = hstack((0,z2,0))
axHisty.fill(z2,y,color=(.0,.0,1.))
else:
axQQ.legend(loc=2)
fig.savefig('figs/HE%iSolution.png' % (k,))
# ####################################################3
fig = figure()
ax = fig.add_subplot(111)
xx = linspace(-3.,stats.norm.ppf(1-0.2),1000)
x = linspace(-3.,3.,1000)
y = stats.norm.pdf(x,scale=1)
yy = stats.norm.pdf(xx,scale=1)
yy[0] = 0
yy[-1] = 0
ax.plot(x,y,'k-',lw=2)
ax.plot(x,stats.norm.pdf(x),'k-',lw=1)
ax.set_xlabel('x',fontsize=16)
ax.set_ylabel('pdf',fontsize=16)
ax.fill(xx,yy,'b')
ax.set_xlim(-3.,3.)
ax.text(xx[-1],-.1,'b');
ax.text(xx[-1],.4,'p(x)',color='k');
ax.text(xx[0],.3,'F(b) = P(x <= b)',color='b');
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
fig.savefig('figs/cdf.png')
#-----------------------------
fig = figure()
ax = fig.add_subplot(111)
xx = linspace(-3.,stats.norm.ppf(1-0.2),1000)
x = linspace(-3.,3.,1000)
y = stats.norm.pdf(x,scale=1)
yy = stats.norm.pdf(xx,scale=1)
yy[0] = 0
yy[-1] = 0
ax.plot(x,y,'k-',lw=2)
ax.plot(x,stats.norm.cdf(x),'b-',lw=1)
ax.set_xlabel('x/b',fontsize=16)
ax.set_ylabel('pdf/cdf',fontsize=16)
ax.set_xlim(-3.,3.)
ax.text(xx[-1],.4,'p(x)',color='k');
ax.text(xx[0],.3,'F(b) = P(x <= b)',color='b');
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
fig.savefig('figs/cdf2.png')
# ####################################################3
fig = figure()
ax = fig.add_subplot(111)
x = hstack((linspace(-3.,stats.norm.ppf(0.13),1000),\
linspace(stats.norm.ppf(1-0.13),3.,1000)))
xx = hstack((linspace(-3.,stats.norm.ppf(0.2),1000),\
linspace(stats.norm.ppf(1-0.2),3.,1000)))
y = stats.norm.pdf(x,scale=1)
yy = stats.norm.pdf(xx,scale=1)
y[[0,999,1000,-1]] = 0
yy[[0,999,1000,-1]] = 0
t = linspace(-3.,3.,1000)
ax.plot(t,stats.norm.pdf(t),'k-',lw=2)
ax.fill(xx[:1000],yy[:1000],'b')
ax.fill(xx[1000:],yy[1000:],'b')
ax.text(xx[1000],-.1,'b')
ax.text(xx[999],-.1,'-b')
ax.text(.2,.7,'P(|x|>b) =$\\alpha$',color='b');
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
fig.savefig('figs/pval0.png')
#---------------------------------------------------
fig = figure()
ax = fig.add_subplot(111)
t = linspace(-3.,3.,1000)
ax.plot(t,stats.norm.pdf(t),'k-',lw=2)
ax.fill(x[:1000],y[:1000],'r')
ax.fill(x[1000:],y[1000:],'r')
ax.text(x[1000],-.1,'t')
ax.text(x[999],-.1,'-t')
ax.text(.2,.5,'P(|x| > t) = p-value',color='r');
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
fig.savefig('figs/ pval1.png')
# show()
#-----------------------------

View File

@ -0,0 +1,184 @@
import sys
import seaborn as sns
sys.path.append('/home/fabee/code')
from matplotlib.pyplot import *
from scipy import stats
from numpy import *
sns.set_context("talk", font_scale=1.5, rc={"lines.linewidth": 2.5})
# define the curves
x = np.linspace(2, 20, 200)
n = 16.
X =random.randn(n)*4.+12.5
fig = figure()
ax = fig.add_subplot(111)
ax.set_xlim(5, 18)
#ax.set_ylim(0, .5)
ax.plot([10,10],[-.2,.2],'k-',lw=2)
ax.text(10,.3,r'stimulus position',rotation=-30);
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
ax.set_xlabel('x eye position')
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
fig.savefig('figs/repetition0.png')
# ####################################################3
fig = figure()
ax = fig.add_subplot(111)
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
ax.set_xlim(5, 18)
# ax.set_ylim(0, .5)
ax.plot([10,10],[-.2,.2],'k-',lw=2)
ax.text(10,.3,r'stimulus position',rotation=-30);
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
ax.legend()
ax.set_xlabel('x eye position')
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
fig.savefig('figs/repetition1.png')
# ####################################################3
fig = figure()
ax = fig.add_subplot(111)
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
ax.plot(x,-stats.t.pdf(x,n-1,loc=10,scale=1),'b',label=r'Null distribution of $t$')
ax.set_xlim(5, 18)
# ax.set_ylim(0, .5)
ax.plot([10,10],[-.2,.2],'k-',lw=2)
ax.text(10,.3,r'stimulus position',rotation=-30);
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
ax.legend()
ax.set_xlabel('x eye position')
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
fig.savefig('figs/repetition2.png')
# ####################################################3
fig = figure()
ax = fig.add_subplot(111)
xx = linspace(stats.norm.ppf(0.05),stats.norm.ppf(1-0.05),100)
xx += 10.
yy = -stats.norm.pdf(xx,loc=10.,scale=1)
xx = hstack((xx[0],xx,xx[-1]))
yy = hstack((0,yy,0))
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
ax.plot(x,-stats.t.pdf(x,n-1,loc=10,scale=1),'b',label=r'Null distribution of $t$')
ax.fill(xx,yy,'c')
ax.set_xlim(5, 18)
# ax.set_ylim(0, .5)
ax.plot([10,10],[-.2,.2],'k-',lw=2)
ax.text(10,.3,r'stimulus position',rotation=-30);
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
ax.legend()
ax.set_xlabel('x eye position')
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
fig.savefig('figs/repetition3.png')
# ####################################################3
fig = figure()
ax = fig.add_subplot(111)
xx = linspace(stats.norm.ppf(0.05),stats.norm.ppf(1-0.05),100)
xx += 10.
yy = -stats.norm.pdf(xx,loc=10.,scale=1)
xx = hstack((xx[0],xx,xx[-1]))
yy = hstack((0,yy,0))
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
ax.plot(x,-stats.t.pdf(x,n-1,loc=10,scale=1),'b',label=r'Null distribution of $t$')
ax.fill(xx,yy,'c')
ax.set_xlim(5, 18)
# ax.set_ylim(0, .5)
ax.plot([10,10],[-.2,.2],'k-',lw=2)
ax.text(10,.3,r'stimulus position',rotation=-30);
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45)
ax.plot([xx[0],xx[-1]],[0,0],'-g',label=r'$H_0$',lw=4)
ax.plot([0,xx[0]],[0,0],'-r',label=r'$H_1$',lw=4)
ax.plot([xx[-1],20],[0,0],'-r',lw=4)
ax.legend()
ax.set_xlabel('x eye position')
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
fig.savefig('figs/repetition4.png')
# ####################################################3
fig = figure()
ax = fig.add_subplot(111)
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
ax.plot(x,-stats.t.pdf(x,n-1,loc=10,scale=1),'b',label=r'Null distribution of $t$')
xx = linspace(0,stats.norm.ppf(0.05)+10.,100)
yy = -stats.norm.pdf(xx,loc=10.,scale=1)
xx = hstack((xx[0],xx,xx[-1]))
yy = hstack((0,yy,0))
ax.fill(xx,yy,'magenta')
xx = linspace(stats.norm.ppf(1-0.05)+10.,20,100)
yy = -stats.norm.pdf(xx,loc=10.,scale=1)
xx = hstack((xx[0],xx,xx[-1]))
yy = hstack((0,yy,0))
ax.fill(xx,yy,'magenta')
ax.set_xlim(5, 18)
# ax.set_ylim(0, .5)
ax.plot([10,10],[-.2,.2],'k-',lw=2)
ax.text(10,.3,r'stimulus position',rotation=-30);
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
ax.legend()
ax.set_xlabel('x eye position')
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
fig.savefig('figs/repetition5.png')

BIN
statistics/figs/hunger.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,72 @@
from __future__ import division
from numpy import *
from scipy import stats
from matplotlib.pyplot import *
N = random.randn
m = 2000
n = 20
T = zeros((m,))
R = zeros((m,))
pT = zeros((m,))
pR = zeros((m,))
for k in xrange(m):
x = N(n)
y = N(n)
T[k], pT[k] = stats.ttest_ind(x,y)
R[k], pR[k] = stats.ranksums(x,y)
a = stats.t.ppf([0.025,1.-0.025], n-1)
b = stats.norm.ppf([0.025,1.-0.025])
fig = figure(figsize=(8,8),dpi=100)
ax = fig.add_axes([.3,.3,.6,.6])
axb = fig.add_axes([.3,.1,.6,.2])
axl = fig.add_axes([.1,.3,.2,.6])
ax.plot(T,R,'ok',mfc=(.7,.7,.7))
axb.hist(T,bins=50,facecolor=(1.,.7,.7),normed=True)
axl.hist(R,bins=50,facecolor=(.7,.7,1.),normed=True,orientation='horizontal')
axl.axis([0,1,-5,5])
axb.plot([a[0],a[0]],[0,1],'k--',lw=2)
axb.plot([a[1],a[1]],[0,1],'k--',lw=2)
axl.plot([0,1],[b[0],b[0]],'k--',lw=2)
axl.plot([0,1],[b[1],b[1]],'k--',lw=2)
axl.set_ylabel('standardized U statistic', fontsize=16)
axb.set_xlabel('t statistic', fontsize=16)
# print sum(1.*(T < a[0] ))/m + sum(1.*(T > a[1]))/m
# print sum(1.*(R < b[0] ))/m + sum(1.*(R > b[1]))/m
ax.fill([-5,a[0],a[0],-5],[-5,-5,5,5],color=(1.,.7,.7),alpha=.5)
ax.fill([a[1],5,5,a[1]],[-5,-5,5,5],color=(1.,.7,.7),alpha=.5)
axb.fill([-5,a[0],a[0],-5],[0,0,1,1],color=(1.,.7,.7),alpha=.5)
axb.fill([a[1],5,5,a[1]],[0,0,1,1],color=(1.,.7,.7),alpha=.5)
ax.fill([-5,-5,5,5],[-5,b[0],b[0],-5],color=(.7,.7,1.),alpha=.5)
ax.fill([-5,-5,5,5],[b[1],5,5,b[1]],color=(.7,.7,1.),alpha=.5)
axl.fill([0,0,1,1],[-5,b[0],b[0],-5],color=(.7,.7,1.),alpha=.5)
axl.fill([0,0,1,1],[b[1],5,5,b[1]],color=(.7,.7,1.),alpha=.5)
axb.axis([-5,5,0,1])
ax.axis([-5,5,-5,5])
axl.set_xticks([])
axb.set_yticks([])
axl = axl.twiny()
axb = axb.twinx()
axl.set_xticks([0,.5,1.])
axb.set_yticks([0,.5,1.])
fig.savefig('multipletesting.pdf')

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Some files were not shown because too many files have changed in this diff Show More