diff --git a/bootstrap/exercises/Makefile b/bootstrap/exercises/Makefile new file mode 100644 index 0000000..27691d9 --- /dev/null +++ b/bootstrap/exercises/Makefile @@ -0,0 +1,34 @@ +TEXFILES=$(wildcard exercises??.tex) +EXERCISES=$(TEXFILES:.tex=.pdf) +SOLUTIONS=$(EXERCISES:exercises%=solutions%) + +.PHONY: pdf exercises solutions watch watchexercises watchsolutions clean + +pdf : $(SOLUTIONS) $(EXERCISES) + +exercises : $(EXERCISES) + +solutions : $(SOLUTIONS) + +$(SOLUTIONS) : solutions%.pdf : exercises%.tex instructions.tex + { echo "\\documentclass[answers,12pt,a4paper,pdftex]{exam}"; sed -e '1d' $<; } > $(patsubst %.pdf,%.tex,$@) + pdflatex -interaction=scrollmode $(patsubst %.pdf,%.tex,$@) | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $(patsubst %.pdf,%.tex,$@) || true + rm $(patsubst %.pdf,%,$@).[!p]* + +$(EXERCISES) : %.pdf : %.tex instructions.tex + pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true + +watch : + while true; do ! make -q pdf && make pdf; sleep 0.5; done + +watchexercises : + while true; do ! make -q exercises && make exercises; sleep 0.5; done + +watchsolutions : + while true; do ! make -q solutions && make solutions; sleep 0.5; done + +clean : + rm -f *~ *.aux *.log *.out + +cleanup : clean + rm -f $(SOLUTIONS) $(EXERCISES) diff --git a/bootstrap/exercises/UT_WBMW_Black_RGB.pdf b/bootstrap/exercises/UT_WBMW_Black_RGB.pdf new file mode 100644 index 0000000..9aed921 Binary files /dev/null and b/bootstrap/exercises/UT_WBMW_Black_RGB.pdf differ diff --git a/statistics/exercises/bootstrapmean.m b/bootstrap/exercises/bootstrapmean.m similarity index 100% rename from statistics/exercises/bootstrapmean.m rename to bootstrap/exercises/bootstrapmean.m diff --git a/statistics/exercises/bootstraptymus-datahist.pdf b/bootstrap/exercises/bootstraptymus-datahist.pdf similarity index 100% rename from statistics/exercises/bootstraptymus-datahist.pdf rename to bootstrap/exercises/bootstraptymus-datahist.pdf diff --git a/statistics/exercises/bootstraptymus-meanhist.pdf b/bootstrap/exercises/bootstraptymus-meanhist.pdf similarity index 100% rename from statistics/exercises/bootstraptymus-meanhist.pdf rename to bootstrap/exercises/bootstraptymus-meanhist.pdf diff --git a/statistics/exercises/bootstraptymus-samples.pdf b/bootstrap/exercises/bootstraptymus-samples.pdf similarity index 100% rename from statistics/exercises/bootstraptymus-samples.pdf rename to bootstrap/exercises/bootstraptymus-samples.pdf diff --git a/statistics/exercises/bootstraptymus.m b/bootstrap/exercises/bootstraptymus.m similarity index 100% rename from statistics/exercises/bootstraptymus.m rename to bootstrap/exercises/bootstraptymus.m diff --git a/statistics/exercises/correlationsignificance.m b/bootstrap/exercises/correlationsignificance.m similarity index 100% rename from statistics/exercises/correlationsignificance.m rename to bootstrap/exercises/correlationsignificance.m diff --git a/statistics/exercises/correlationsignificance.pdf b/bootstrap/exercises/correlationsignificance.pdf similarity index 100% rename from statistics/exercises/correlationsignificance.pdf rename to bootstrap/exercises/correlationsignificance.pdf diff --git a/statistics/exercises/statistics03.tex b/bootstrap/exercises/exercises01.tex similarity index 100% rename from statistics/exercises/statistics03.tex rename to bootstrap/exercises/exercises01.tex diff --git a/bootstrap/exercises/instructions.tex b/bootstrap/exercises/instructions.tex new file mode 100644 index 0000000..12e9e24 --- /dev/null +++ b/bootstrap/exercises/instructions.tex @@ -0,0 +1,41 @@ +\vspace*{-6.5ex} +\begin{center} +\textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[1ex] +{\large Jan Grewe, Jan Benda}\\[-3ex] +Abteilung Neuroethologie \hfill --- \hfill Institut f\"ur Neurobiologie \hfill --- \hfill \includegraphics[width=0.28\textwidth]{UT_WBMW_Black_RGB} \\ +\end{center} + +\ifprintanswers% +\else + +% Die folgenden Aufgaben dienen der Wiederholung, \"Ubung und +% Selbstkontrolle und sollten eigenst\"andig bearbeitet und gel\"ost +% werden. Die L\"osung soll in Form eines einzelnen Skriptes (m-files) +% im ILIAS hochgeladen werden. Jede Aufgabe sollte in einer eigenen +% ``Zelle'' gel\"ost sein. Die Zellen \textbf{m\"ussen} unabh\"angig +% voneinander ausf\"uhrbar sein. Das Skript sollte nach dem Muster: +% ``variablen\_datentypen\_\{nachname\}.m'' benannt werden +% (z.B. variablen\_datentypen\_mueller.m). + +\begin{itemize} +\item \"Uberzeuge dich von jeder einzelnen Zeile deines Codes, dass + sie auch wirklich das macht, was sie machen soll! Teste dies mit + kleinen Beispielen direkt in der Kommandozeile. +\item Versuche die L\"osungen der Aufgaben m\"oglichst in + sinnvolle kleine Funktionen herunterzubrechen. + Sobald etwas \"ahnliches mehr als einmal berechnet werden soll, + lohnt es sich eine Funktion daraus zu schreiben! +\item Teste rechenintensive \code{for} Schleifen, Vektoren, Matrizen + zuerst mit einer kleinen Anzahl von Wiederholungen oder kleiner + Gr\"o{\ss}e, und benutze erst am Ende, wenn alles \"uberpr\"uft + ist, eine gro{\ss}e Anzahl von Wiederholungen oder Elementen, um eine gute + Statistik zu bekommen. +\item Benutze die Hilfsfunktion von \code{matlab} (\code{help + commando} oder \code{doc commando}) und das Internet, um + herauszufinden, wie bestimmte \code{matlab} Funktionen zu verwenden + sind und was f\"ur M\"oglichkeiten sie bieten. + Auch zu inhaltlichen Konzepten bietet das Internet oft viele + Antworten! +\end{itemize} + +\fi diff --git a/bootstrap/exercises/savefigpdf.m b/bootstrap/exercises/savefigpdf.m new file mode 100644 index 0000000..fbe2dc2 --- /dev/null +++ b/bootstrap/exercises/savefigpdf.m @@ -0,0 +1,28 @@ +function savefigpdf( fig, name, width, height ) +% Saves figure fig in pdf file name.pdf with appropriately set page size +% and fonts + +% default width: +if nargin < 3 + width = 11.7; +end +% default height: +if nargin < 4 + height = 9.0; +end + +% paper: +set( fig, 'PaperUnits', 'centimeters' ); +set( fig, 'PaperSize', [width height] ); +set( fig, 'PaperPosition', [0.0 0.0 width height] ); +set( fig, 'Color', 'white') + +% font: +set( findall( fig, 'type', 'axes' ), 'FontSize', 12 ) +set( findall( fig, 'type', 'text' ), 'FontSize', 12 ) + +% save: +saveas( fig, name, 'pdf' ) + +end + diff --git a/statistics/exercises/tdistribution-n03.pdf b/bootstrap/exercises/tdistribution-n03.pdf similarity index 100% rename from statistics/exercises/tdistribution-n03.pdf rename to bootstrap/exercises/tdistribution-n03.pdf diff --git a/statistics/exercises/tdistribution-n05.pdf b/bootstrap/exercises/tdistribution-n05.pdf similarity index 100% rename from statistics/exercises/tdistribution-n05.pdf rename to bootstrap/exercises/tdistribution-n05.pdf diff --git a/statistics/exercises/tdistribution-n10.pdf b/bootstrap/exercises/tdistribution-n10.pdf similarity index 100% rename from statistics/exercises/tdistribution-n10.pdf rename to bootstrap/exercises/tdistribution-n10.pdf diff --git a/statistics/exercises/tdistribution-n50.pdf b/bootstrap/exercises/tdistribution-n50.pdf similarity index 100% rename from statistics/exercises/tdistribution-n50.pdf rename to bootstrap/exercises/tdistribution-n50.pdf diff --git a/statistics/exercises/tdistribution.m b/bootstrap/exercises/tdistribution.m similarity index 100% rename from statistics/exercises/tdistribution.m rename to bootstrap/exercises/tdistribution.m diff --git a/statistics/exercises/thymusglandweights.dat b/bootstrap/exercises/thymusglandweights.dat similarity index 100% rename from statistics/exercises/thymusglandweights.dat rename to bootstrap/exercises/thymusglandweights.dat diff --git a/likelihood/exercises/Makefile b/likelihood/exercises/Makefile new file mode 100644 index 0000000..27691d9 --- /dev/null +++ b/likelihood/exercises/Makefile @@ -0,0 +1,34 @@ +TEXFILES=$(wildcard exercises??.tex) +EXERCISES=$(TEXFILES:.tex=.pdf) +SOLUTIONS=$(EXERCISES:exercises%=solutions%) + +.PHONY: pdf exercises solutions watch watchexercises watchsolutions clean + +pdf : $(SOLUTIONS) $(EXERCISES) + +exercises : $(EXERCISES) + +solutions : $(SOLUTIONS) + +$(SOLUTIONS) : solutions%.pdf : exercises%.tex instructions.tex + { echo "\\documentclass[answers,12pt,a4paper,pdftex]{exam}"; sed -e '1d' $<; } > $(patsubst %.pdf,%.tex,$@) + pdflatex -interaction=scrollmode $(patsubst %.pdf,%.tex,$@) | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $(patsubst %.pdf,%.tex,$@) || true + rm $(patsubst %.pdf,%,$@).[!p]* + +$(EXERCISES) : %.pdf : %.tex instructions.tex + pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true + +watch : + while true; do ! make -q pdf && make pdf; sleep 0.5; done + +watchexercises : + while true; do ! make -q exercises && make exercises; sleep 0.5; done + +watchsolutions : + while true; do ! make -q solutions && make solutions; sleep 0.5; done + +clean : + rm -f *~ *.aux *.log *.out + +cleanup : clean + rm -f $(SOLUTIONS) $(EXERCISES) diff --git a/likelihood/exercises/UT_WBMW_Black_RGB.pdf b/likelihood/exercises/UT_WBMW_Black_RGB.pdf new file mode 100644 index 0000000..9aed921 Binary files /dev/null and b/likelihood/exercises/UT_WBMW_Black_RGB.pdf differ diff --git a/statistics/exercises/statistics04.tex b/likelihood/exercises/exercises01.tex similarity index 100% rename from statistics/exercises/statistics04.tex rename to likelihood/exercises/exercises01.tex diff --git a/likelihood/exercises/instructions.tex b/likelihood/exercises/instructions.tex new file mode 100644 index 0000000..12e9e24 --- /dev/null +++ b/likelihood/exercises/instructions.tex @@ -0,0 +1,41 @@ +\vspace*{-6.5ex} +\begin{center} +\textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[1ex] +{\large Jan Grewe, Jan Benda}\\[-3ex] +Abteilung Neuroethologie \hfill --- \hfill Institut f\"ur Neurobiologie \hfill --- \hfill \includegraphics[width=0.28\textwidth]{UT_WBMW_Black_RGB} \\ +\end{center} + +\ifprintanswers% +\else + +% Die folgenden Aufgaben dienen der Wiederholung, \"Ubung und +% Selbstkontrolle und sollten eigenst\"andig bearbeitet und gel\"ost +% werden. Die L\"osung soll in Form eines einzelnen Skriptes (m-files) +% im ILIAS hochgeladen werden. Jede Aufgabe sollte in einer eigenen +% ``Zelle'' gel\"ost sein. Die Zellen \textbf{m\"ussen} unabh\"angig +% voneinander ausf\"uhrbar sein. Das Skript sollte nach dem Muster: +% ``variablen\_datentypen\_\{nachname\}.m'' benannt werden +% (z.B. variablen\_datentypen\_mueller.m). + +\begin{itemize} +\item \"Uberzeuge dich von jeder einzelnen Zeile deines Codes, dass + sie auch wirklich das macht, was sie machen soll! Teste dies mit + kleinen Beispielen direkt in der Kommandozeile. +\item Versuche die L\"osungen der Aufgaben m\"oglichst in + sinnvolle kleine Funktionen herunterzubrechen. + Sobald etwas \"ahnliches mehr als einmal berechnet werden soll, + lohnt es sich eine Funktion daraus zu schreiben! +\item Teste rechenintensive \code{for} Schleifen, Vektoren, Matrizen + zuerst mit einer kleinen Anzahl von Wiederholungen oder kleiner + Gr\"o{\ss}e, und benutze erst am Ende, wenn alles \"uberpr\"uft + ist, eine gro{\ss}e Anzahl von Wiederholungen oder Elementen, um eine gute + Statistik zu bekommen. +\item Benutze die Hilfsfunktion von \code{matlab} (\code{help + commando} oder \code{doc commando}) und das Internet, um + herauszufinden, wie bestimmte \code{matlab} Funktionen zu verwenden + sind und was f\"ur M\"oglichkeiten sie bieten. + Auch zu inhaltlichen Konzepten bietet das Internet oft viele + Antworten! +\end{itemize} + +\fi diff --git a/statistics/exercises/mlepdffit.m b/likelihood/exercises/mlepdffit.m similarity index 100% rename from statistics/exercises/mlepdffit.m rename to likelihood/exercises/mlepdffit.m diff --git a/statistics/exercises/mlepdffit.pdf b/likelihood/exercises/mlepdffit.pdf similarity index 100% rename from statistics/exercises/mlepdffit.pdf rename to likelihood/exercises/mlepdffit.pdf diff --git a/statistics/exercises/mlepropfit.m b/likelihood/exercises/mlepropfit.m similarity index 100% rename from statistics/exercises/mlepropfit.m rename to likelihood/exercises/mlepropfit.m diff --git a/statistics/exercises/mlepropfit.pdf b/likelihood/exercises/mlepropfit.pdf similarity index 100% rename from statistics/exercises/mlepropfit.pdf rename to likelihood/exercises/mlepropfit.pdf diff --git a/statistics/exercises/mleslope.m b/likelihood/exercises/mleslope.m similarity index 100% rename from statistics/exercises/mleslope.m rename to likelihood/exercises/mleslope.m diff --git a/statistics/exercises/mlestd.m b/likelihood/exercises/mlestd.m similarity index 100% rename from statistics/exercises/mlestd.m rename to likelihood/exercises/mlestd.m diff --git a/statistics/exercises/mlestd.pdf b/likelihood/exercises/mlestd.pdf similarity index 100% rename from statistics/exercises/mlestd.pdf rename to likelihood/exercises/mlestd.pdf diff --git a/likelihood/exercises/savefigpdf.m b/likelihood/exercises/savefigpdf.m new file mode 100644 index 0000000..fbe2dc2 --- /dev/null +++ b/likelihood/exercises/savefigpdf.m @@ -0,0 +1,28 @@ +function savefigpdf( fig, name, width, height ) +% Saves figure fig in pdf file name.pdf with appropriately set page size +% and fonts + +% default width: +if nargin < 3 + width = 11.7; +end +% default height: +if nargin < 4 + height = 9.0; +end + +% paper: +set( fig, 'PaperUnits', 'centimeters' ); +set( fig, 'PaperSize', [width height] ); +set( fig, 'PaperPosition', [0.0 0.0 width height] ); +set( fig, 'Color', 'white') + +% font: +set( findall( fig, 'type', 'axes' ), 'FontSize', 12 ) +set( findall( fig, 'type', 'text' ), 'FontSize', 12 ) + +% save: +saveas( fig, name, 'pdf' ) + +end + diff --git a/likelihood/lecture/likelihood-chapter.tex b/likelihood/lecture/likelihood-chapter.tex index 2bcc35b..38d02d4 100644 --- a/likelihood/lecture/likelihood-chapter.tex +++ b/likelihood/lecture/likelihood-chapter.tex @@ -18,6 +18,11 @@ \section{TODO} \begin{itemize} +\item Fitting psychometric functions: + Variable $x_i$, responses $r_i$ either 0 or 1. + $p(x_i, \theta)$ is Weibull or Boltzmann function. + Likelihood is $L = \prod p(x_i, \theta)^{r_i} (1-p(x_i, \theta))^{1-r_i}$. + Use fminsearch for fitting. \item GLM model fitting? \end{itemize} diff --git a/statistics/exercises/Makefile b/statistics/exercises/Makefile index 925485d..27691d9 100644 --- a/statistics/exercises/Makefile +++ b/statistics/exercises/Makefile @@ -1,6 +1,6 @@ -TEXFILES=$(wildcard statistics??.tex) +TEXFILES=$(wildcard exercises??.tex) EXERCISES=$(TEXFILES:.tex=.pdf) -SOLUTIONS=$(EXERCISES:statistics%=solutions%) +SOLUTIONS=$(EXERCISES:exercises%=solutions%) .PHONY: pdf exercises solutions watch watchexercises watchsolutions clean @@ -10,7 +10,7 @@ exercises : $(EXERCISES) solutions : $(SOLUTIONS) -$(SOLUTIONS) : solutions%.pdf : statistics%.tex instructions.tex +$(SOLUTIONS) : solutions%.pdf : exercises%.tex instructions.tex { echo "\\documentclass[answers,12pt,a4paper,pdftex]{exam}"; sed -e '1d' $<; } > $(patsubst %.pdf,%.tex,$@) pdflatex -interaction=scrollmode $(patsubst %.pdf,%.tex,$@) | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $(patsubst %.pdf,%.tex,$@) || true rm $(patsubst %.pdf,%,$@).[!p]* diff --git a/statistics/exercises/statistics01.tex b/statistics/exercises/exercises01.tex similarity index 100% rename from statistics/exercises/statistics01.tex rename to statistics/exercises/exercises01.tex diff --git a/statistics/exercises/statistics02.tex b/statistics/exercises/exercises02.tex similarity index 100% rename from statistics/exercises/statistics02.tex rename to statistics/exercises/exercises02.tex