-
-
Save TobiasBouma/57a2ca2b9100b47d5056 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/W32TeX) | |
% pdflatex $synctexoption --enable-write18 -interaction=nonstopmode $fullname | |
\documentclass[10pt]{article} | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % P A C K A G E S % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % | |
\usepackage{etoolbox} | |
\usepackage[a4paper]{geometry} | |
\usepackage[dutch]{babel} | |
\usepackage[skins]{tcolorbox} | |
\usepackage{fancyhdr} | |
\usepackage{appendix} | |
\usepackage{imakeidx} | |
\usepackage{lastpage} | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % V I S U A L % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % A P P E A R A N C E % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% --> colors | |
\definecolor{MidnightBlue}{HTML}{191970} % color of hyperlinks | |
% --> footers | |
\setlength{\footskip}{\dimexpr\headsep+1.5\baselineskip+.4pt} | |
\renewcommand{\footrule}{\hbox to\headwidth{\color{FooterBlue}\leaders\hrule height \footrulewidth\hfill}} | |
% --> footers | |
\newcommand{\Contentsname}{Inhoudsopgave}% | |
\newcommand{\IndexName}{Index} % | |
% --> quick access to make body text fancier | |
\newcommand{\R}{\textcolor{blue}{\textbf{R}}~} | |
\newcommand{\Letop}{\textit{\textbf{Let op!}}~} | |
\newcommand{\Voorbeeld}{\textit{Voorbeeld}~} | |
% --> footers | |
\newcommand{\stextbar}[1][.7]{\scalebox{#1}[1]{\textbar}} | |
% --> COLOR BOX FOOTER | |
% ----> colors | |
\definecolor{FooterBlue}{HTML}{1975FF} % color of footer rule | |
% ---> footer links | |
\newrobustcmd{\CurrentSectionSymbol}{\textbf{\textcolor{blue}{$\rightarrow$}}~} | |
\newrobustcmd{\ToNextSectionSymbol}{\textbf{\textcolor{red}{$\rightarrow$}}~} | |
\newrobustcmd{\ToPreviousSectionSymbol}{\textbf{\textcolor{red}{$\leftarrow$}}~} | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % H O O K S % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% --> at begin document | |
\AtBeginDocument{% | |
\pagestyle{toc}% | |
}% | |
% --> end of document | |
\AtEndDocument{% | |
\LastSectionInFile% | |
\IndexSectionInFile% | |
\lfoot{\CurrentSectionTitle} | |
\thispagestyle{FootLinks} | |
}% | |
% --> start of appendix | |
\AtBeginEnvironment{appendices}{\FirstSectionInAppendix} | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % F O O T E R S % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% Some formats etc. (will clean up someday) | |
\newrobustcmd{\PreviousSectionName}{\nameref*{CurrentSection::Title::\number\value{PreviousSectionCounter}}}% | |
\newrobustcmd{\CurrentSectionName}{\nameref*{CurrentSection::Title::\number\value{CurrentSectionCounter}}}% | |
\newrobustcmd{\NextSectionName}{\nameref*{CurrentSection::Title::\number\value{NextSectionCounter}}}% | |
\newrobustcmd{\NextSectionHyperLinkFormat}[1]{#1}% | |
\newrobustcmd{\PreviousSectionHyperLinkFormat}[1]{#1}% | |
% Hyperlinks | |
% --> NEXT section | |
\newrobustcmd{\GenerateNextSectionHyperlink}[3]{% | |
\DoIfNumInequal{\number\value{#1}}{\number\value{#3}}{% | |
\DoIfNumNotZero{\number\value{PrintIndexSectionCounter}}{% | |
% only set a link of the next section is not the index section | |
\ifnumequal{\number\value{#1}+1}{\number\value{PrintIndexSectionCounter}}{% | |
\setcounter{InternalTitleCounter}{\number\value{#2}}% | |
\addtocounter{InternalTitleCounter}{1}% | |
\hyperlink{CurrentSection::\number\value{InternalTitleCounter}}{\NextSectionHyperLinkFormat{\nameref*{CurrentSection::Title::\number\value{InternalTitleCounter}}}~$\rightarrow$}% | |
}{ | |
\hyperlink{CurrentSection::\number\value{#2}}{\NextSectionHyperLinkFormat{\nameref*{CurrentSection::Title::\number\value{#2}}}~$\rightarrow$}% | |
}}% End of DoIfNumNotZero | |
{% | |
\hyperlink{CurrentSection::\number\value{#2}}{\NextSectionHyperLinkFormat{\nameref*{CurrentSection::Title::\number\value{#2}}}~$\rightarrow$}% | |
}% | |
}% End of inner \DoIfNumInEqual | |
}% | |
% --> PREVIOUS section | |
\newrobustcmd{\GeneratePreviousSectionHyperlink}[3]{% | |
\DoIfNumInequal{\number\value{#1}}{1}{% | |
\DoIfNumNotZero{\number\value{PrintIndexSectionCounter}}{% | |
\ifnumequal{\number\value{#1}-1}{\number\value{PrintIndexSectionCounter}}{% | |
\setcounter{InternalTitleCounter}{\number\value{#2}}% | |
\addtocounter{InternalTitleCounter}{-1}% | |
\hyperlink{CurrentSection::\number\value{InternalTitleCounter}}{$\leftarrow$~\PreviousSectionHyperLinkFormat{\nameref*{CurrentSection::Title::\number\value{InternalTitleCounter}}}}% | |
}{ | |
\hyperlink{CurrentSection::\number\value{#2}}{\PreviousSectionHyperLinkFormat{$\leftarrow$~\nameref*{CurrentSection::Title::\number\value{#2}}}}% | |
}% | |
}{% | |
\hyperlink{CurrentSection::\number\value{#2}}{\PreviousSectionHyperLinkFormat{$\leftarrow$~\nameref*{CurrentSection::Title::\number\value{#2}}}}% | |
}% | |
}% End of outer \DoIfNumInequal | |
}% End of command | |
% --> Declare the counters | |
\newcounter{LastDocumentPageCounter}% | |
\setcounter{LastDocumentPageCounter}{1} | |
\newcounter{IndexSectionCounterValue}% | |
\newcounter{PrintIndexSectionCounter}% | |
\newcounter{PreviousSectionCounter}% | |
\setcounter{PreviousSectionCounter}{0}% | |
\newcounter{NextSectionCounter}% | |
\setcounter{NextSectionCounter}{0} | |
\newcounter{CurrentSectionCounter}% | |
\setcounter{CurrentSectionCounter}{0} | |
\newcounter{LastSectionValue} | |
\newcounter{FirstSectionAppendixCounter} | |
\newcounter{FirstSectionValue} | |
\newcounter{InternalTitleCounter} | |
\newrobustcmd{\PreviousSectionTitle}{}% | |
\newrobustcmd{\CurrentSectionTitle}{}% | |
% --> metamacro | |
\newrobustcmd{\DoIfNumNotZero}[3]{\ifnumequal{#1}{0}{#3}{#2}}% | |
\newrobustcmd{\DoIfNumInequal}[3]{\ifnumequal{#1}{#2}{}{#3}}% | |
\newrobustcmd{\IfNumInequal}[4]{\ifnumequal{#1}{#2}{#3}{#4}}% | |
% --> initiate counters | |
\makeatletter | |
\newrobustcmd{\WriteUniqueTextLabelContent}[2]{% | |
\immediate\write\@auxout{% | |
\string\newlabel{#1}{{\thesection}{\thepage}{\unexpanded{#2}}{}}% | |
}% | |
}% | |
\newrobustcmd{\BeforeSectionStarts}[1]{% | |
\stepcounter{CurrentSectionCounter}% | |
\ifnumequal{\number\value{CurrentSectionCounter}}{1}{\setcounter{PreviousSectionCounter}{1}}{\setcounter{PreviousSectionCounter}{\number\value{CurrentSectionCounter}} | |
\addtocounter{PreviousSectionCounter}{-1} | |
} | |
\phantomsection | |
\hypertarget{CurrentSection::\number\value{CurrentSectionCounter}}{}% | |
\WriteUniqueTextLabelContent{CurrentSection::Title::\number\value{CurrentSectionCounter}}{#1}% | |
\setcounter{NextSectionCounter}{\number\value{CurrentSectionCounter}} | |
\ifnumequal{\number\value{CurrentSectionCounter}}{\number\value{LastSectionValue}}{}{% | |
\addtocounter{NextSectionCounter}{1}% | |
}% | |
\phantomsection | |
}% | |
\newrobustcmd{\InsertToIndexSymbol}[4]{% | |
\ifnumequal{\number\value{#1}}{0}{% | |
}{% | |
\ifnumless{\number\value{#1}}{\number\value{#2}}{% | |
\hyperlink{CurrentSection::\number\value{#1}}{#3}% | |
}{% | |
\ifnumgreater{\number\value{#1}}{\number\value{#2}}{% | |
\hyperlink{CurrentSection::\number\value{#1}}{#4}% | |
}{% | |
}% | |
}% | |
}% | |
}% | |
\makeatother | |
\newcommand{\mk}[1]{} | |
\mk{% | |
\newrobustcmd{\InsertToIndexSymbol}[4]{% | |
\ifnumless{\number\value{#1}}{\number\value{#2}}{% | |
\hyperlink{CurrentSection::\number\value{#1}}{#3}}{% | |
\ifnumgreater{\number\value{#1}}{\number\value{#2}}{% | |
\hyperlink{CurrentSection::\number\value{#1}}{#4}% | |
}{% | |
}% | |
}% | |
}% | |
}% | |
\newrobustcmd{\ProvideBool}[2][false]{\newbool{#2}\setbool{#2}{#1}}% | |
\ProvideBool[true]{DocumentSectionAutoClearpage}% | |
\newrobustcmd{\EnableSectionAutoClearpage}{\setbool{DocumentSectionAutoClearpage}{true}}% | |
\newrobustcmd{\DisableSectionAutoClearpage}{\setbool{DocumentSectionAutoClearpage}{false}}% | |
\AtBeginDocument{% | |
\setcounter{PrintIndexSectionCounter}{\number\value{IndexSectionCounterValue}} | |
\EnableSectionAutoClearpage% | |
\pagestyle{toc} | |
\hypertarget{document.toc}{}% | |
}% | |
% --> different type of sections, e.g. starred sections won't appear in ToC or FootLinks | |
\let\LaTeXStandardSection\section | |
\newrobustcmd{\improvedstarredsection}[1]{\LaTeXStandardSection*{#1}}% | |
\makeatletter | |
\newrobustcmd{\improvedsection@noopt}[1]{\BeforeSectionStarts{#1}\LaTeXStandardSection{#1}}% | |
\newrobustcmd{\improvedsection@opt}[2][]{\BeforeSectionStarts{#1}\LaTeXStandardSection[#1]{#2}}% | |
\newrobustcmd{\improvedsection}{\ifboolexpr{bool{DocumentSectionAutoClearpage}}{\clearpage}{}\@ifnextchar[{\improvedsection@opt}\improvedsection@noopt}% | |
\renewcommand{\section}{\@ifstar{\improvedstarredsection}{\improvedsection}} | |
\renewenvironment{theindex}{% | |
\if@twocolumn | |
\@restonecolfalse | |
\else | |
\@restonecoltrue | |
\fi | |
\phantomsection% | |
\section{\indexname}% | |
\setcounter{PrintIndexSectionCounter}{\number\value{CurrentSectionCounter}}% | |
\@mkboth{\MakeUppercase\indexname}% | |
{\MakeUppercase\indexname}% | |
\parindent\z@ | |
\parskip\z@ \@plus .3\p@\relax | |
\columnseprule \z@ | |
\columnsep 35\p@ | |
\let\item\@idxitem} | |
{\if@restonecol\onecolumn\else\clearpage\fi}% | |
% --> determine section counters at different moments in file | |
\newrobustcmd{\LastSectionInFile}{% | |
\immediate\write\@auxout{\string | |
\setcounter{LastSectionValue}{\number\value{CurrentSectionCounter}}% | |
}% | |
} | |
\newrobustcmd{\FirstSectionInAppendix}{% | |
\immediate\write\@auxout{\string | |
\setcounter{FirstSectionAppendixCounter}{\number\value{NextSectionCounter}}% | |
}% | |
} | |
\newrobustcmd{\IndexSectionInFile}{% | |
\immediate\write\@auxout{\string | |
\setcounter{IndexSectionCounterValue}{\number\value{PrintIndexSectionCounter}}% | |
}% | |
}% | |
\makeatother | |
% Small hack to affect footers on all pages | |
\newcommand{\RightFootColorBox}[1]{\raisebox{\dimexpr(-\height+\ht\strutbox-\dp\strutbox)/2}{% | |
\begin{tcolorbox}[nobeforeafter, | |
width=.3\linewidth, | |
frame hidden,boxrule=0pt, | |
top=.25\columnsep, | |
bottom=.25\columnsep, | |
colback=orange, | |
spartan | |
]\strut #1 \end{tcolorbox}}}% | |
\newcommand{\LeftFootColorBox}[1]{\raisebox{\dimexpr(-\height+\ht\strutbox-\dp\strutbox)/2}{% | |
\begin{tcolorbox}[nobeforeafter, | |
width=.3\linewidth, | |
frame hidden,boxrule=0pt, | |
top=.25\columnsep, | |
bottom=.25\columnsep, | |
colback=orange, | |
spartan | |
]\strut #1 \end{tcolorbox}}}% | |
\let\Rfoot\rfoot% | |
\let\Lfoot\lfoot% | |
\renewcommand\rfoot[1]{\Rfoot{\RightFootColorBox{\hfill #1}}}% | |
\renewcommand\lfoot[1]{\Lfoot{\LeftFootColorBox{#1 \hfill}}}% | |
\fancyhf{} % reset settings | |
\fancypagestyle{plain}{ | |
\renewcommand{\headrulewidth}{0pt} | |
\renewcommand{\footrulewidth}{2pt} | |
\cfoot{\thepage~\stextbar~\pageref{LastPage}} | |
} | |
\fancypagestyle{toc}{ | |
\renewcommand{\headrulewidth}{0pt} | |
\renewcommand{\footrulewidth}{2pt} | |
\cfoot{\thepage~\stextbar~\pageref{LastPage}} | |
} | |
\fancypagestyle{document}{ | |
\rfoot{\hyperlink{CurrentSection::\number\value{PrintIndexSectionCounter}}{\nameref*{CurrentSection::Title::\number\value{PrintIndexSectionCounter}}~$\rightarrow$}} | |
\lfoot{\hyperlink{document.toc}{$\leftarrow$~\Contentsname}} | |
\rhead{\textit{\CurrentSectionName}} | |
} | |
\fancypagestyle{FootLinks}{% | |
\lfoot{\ifnumequal{\number\value{CurrentSectionCounter}}{\number\value{FirstSectionAppendixCounter}}{}{\GeneratePreviousSectionHyperlink{CurrentSectionCounter}{PreviousSectionCounter}{1}}} | |
\rfoot{\GenerateNextSectionHyperlink{CurrentSectionCounter}{NextSectionCounter}{LastSectionValue}} | |
\lhead{\hyperlink{document.toc}{\textit{$\leftarrow$~\Contentsname}}} | |
} | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % O T H E R % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % S T U F F % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % | |
\makeindex | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % H Y P E R L I N K S % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % | |
\usepackage[pageanchor]{hyperref} | |
\hypersetup{colorlinks=true, | |
linkcolor=MidnightBlue, | |
hypertexnames=false, | |
pdfhighlight=/N, | |
pdfstartview={XYZ null null 1.00} | |
}% | |
% --> adjust bounding boxes | |
\makeatletter | |
\newcommand{\target}[1]{\Hy@raisedlink{\hypertarget{#1}{}\relax}} %for text, use \target | |
\makeatother | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % D O C U M E N T % % % % % % % % % % % % % % % | |
% % % % % % % % % % % % % % % % % % % % % % % % % % % | |
\begin{document} | |
\pagestyle{document} | |
\section{Week 1 - Intro \R}% | |
\subsection{Objecten} | |
\subsubsection{Objecten met \'e\'en getal}\index{object, een getal} | |
some text | |
\newpage | |
\subsubsection{Objecten met meerdere getallen}\label{subsubsec:objectmulti}\index{object, meerdere getallen} | |
texttttttttttttttttttttt | |
\newpage | |
\subsection{Opzoeken wat een commando doet}\label{anchor.commando.opzoeken} | |
Het kan altijd gebeuren dat je even niet meer weet wat een bepaald commando voor je kan betekenen. \R heeft een uitgebreide (maar ingewikkelde!) handleiding hiervoor. Je kunt deze handleiding specifiek voor een commando aanhalen, zoals bijvoorbeeld \texttt{help()} of \texttt{?}\index{opzoeken, commando}\index{commando, opzoeken}. | |
\R heeft daarom \texttt{apropos()} Met dit commando kun je een lijst opvragen\index{deel van commando}\index{commando, deel} het woord bevat tussen de citaattekens van apropos. | |
\newpage | |
\subsection{Een steekproef doen}\index{steekproef} | |
Deze \textbf{sampling error} kan in \textcolor{blue}{\textbf{R}} goed in kaart worden gebracht met behulp van een \textbf{frequentietabel}\index{frequentietabel}. \R heeft hiervoor het command \texttt{table()}\target{document.rcommand.table}. | |
\newpage | |
Ook kun je je gegevens sommeren en het gemiddelde nemen.\target{document.rcommand.mean} | |
\target{document.rcommand.sum}\index{sommeren, functie}\index{functie, sommeren} | |
\newpage | |
\noindent Soms, echter, zullen onze data uitgebreid geanalyseerd moeten worden om iets te kunnen zeggen over bijvoorbeeld de geldigheid van die data. E\'en van die maatstaven is de \textit{\textbf{variantie}}\index{variantie}. | |
\newpage | |
\subsection{Verdelingen en statistische eenheden} | |
\subsubsection{Variantie berekenen} | |
Om gegevens te laden in \R gebruik je \texttt{file.choose()}\index{bestand inlezen}\index{bestand laden} | |
\newpage | |
Om in \R de totale hoeveelheid\index{hoeveelheid samples}\index{samples, hoeveelheid} samples te berekenen is het nuttig om ook het commando \texttt{length()}\target{document.rcommand.length} paraat te hebben. Hiermee kun je makkelijk de $N$ berekenen van formule \textbf{(51)}. | |
Voor het gemiddelde\index{gemiddelde, functie}\index{functie, gemiddelde}. | |
\newpage | |
Uit de variantie is de \textit{\textbf{standaardafwijking}}\index{standaardafwijking} | |
\newpage | |
\subsection{Quartiles} | |
\subsubsection{Het berekenen van quartiles} | |
Soms is het van belang een bepaald percentage van de demografie te nemen voor je onderzoek. Quartiles\target{document.quartile}\index{Quartile} zijn een voorbeeld van zo'n percentage. Hierbij neem je in stapjes van 25\% steeds een deel van je data set. | |
Voordat we beginnen met quartiles is het van belang te snappen van een \textit{\textbf{mediaan}}\index{mediaan} | |
\newpage | |
\subsubsection{Het nut van quartiles} | |
\textit{\textbf{`outliers'}}\index{outlier} | |
\newpage | |
\subsection{Meer opties voor grafieken} | |
\subsubsection{Grafieken onder elkaar weergeven} | |
Als je dit commando uitvoert voordat je grafieken hebt getekent sullen de eerstvolgende grafieken in de matrix naar keuze geplaatst worden. Meer informatie over hoe je matrices (matrixen) moet maken, volgt in een later hoofdstuk. | |
\newpage | |
\subsubsection{Grafieken tekenen} | |
Je kunt ook grafieken tekenen\index{plotten, grafiek}\index{grafiek, plotten} | |
\newpage | |
\subsubsection{Pie-charts} % | |
Een ander soort plot die je kan maken is een \textbf{pie-chart}\index{pie-chart}. | |
\section{Week 3 en 4 - Hypothese toetsen}\index{hypothese toetsen} | |
Er vallen twee verschillende hypothesen te onderscheiden: de $H_0$, in andere woorden de \textbf{\textit{nulhypothese}}\index{nulhypothese} | |
\newpage | |
asfawsefgemiddelde afwijkt van het populatiegemiddelde\index{populatiegemiddelde}. | |
\subsection{Histogrammen tekenen}\index{histogram} | |
\subsubsection{Verschillende histogrammen} | |
\newpage | |
\textit{\textbf{uniforme verdeling}}\index{uniforme verdeling}. | |
\newpage | |
\index{breaks, histogram}\index{histogram, breaks} | |
\newpage | |
\subsection{Meerdere dobbelstenen} | |
\subsubsection{Verzamelingen aftellen} | |
In \R is het mogelijk om kettingen van verzamelingen\index{verzameling aftellen}\index{aftellen, verzameling} | |
\newpage | |
\textbf{rijen getallen}\index{sommeren, rijen}\index{rijen, sommeren}\index{aflezen als tabel}\index{tabel, aflezen als} | |
\subsubsection{Hoe weet ik welk soort tabel ik moet gebruiken?}\index{verschillende tabellen}\index{tabel} | |
\newpage | |
\subsection{De normale verdeling}\index{hypothese verwerpen} | |
gejaifgao | |
\newpage | |
\subsubsection{De p-waarde bepalen} | |
\index{p-waarde, normale verdeling}\index{normale verdeling, p-waarde} | |
\subsection{De binomiale verdeling}\target{document.binomialeverdeling} | |
\textbf{\textit{binomiale verdeling}}\index{verdeling, binomiaal}\index{binomiale verdeling}: | |
\subsection{Chi-kwadraat} | |
\textbf{Chi-kwadraattoets}\index{chi-kwadraat} | |
\subsubsection{P-waarde bij de chi-kwadraattoets} | |
De \textit{p-waarde} van de chi-kwadraattoets is afhankelijk van de\index{p-waarde, chi-kwadraat}\index{chi-kwadraat, p-waarde}\par \textbf{vrijheidsgraad}\index{vrijheidsgraad} | |
\newpage | |
vrijheidsgraden\index{vrijheidsgraden, meerdere} | |
\newpage | |
significante cijfers\index{significante cijfers} | |
\newpage | |
\textit{Contingency table}\index{contingency table, chi-kwadraat}\index{chi-kwadraat, contingency table} | |
\newpage | |
outer\index{uitproduct}\index{outer} | |
\clearpage | |
\begin{appendices} | |
\pagestyle{FootLinks} | |
\section{\R commando's} | |
\newpage | |
\section{Begrippenlijst} | |
\newpage | |
\begin{multicols}{2} | |
\printindex | |
\end{multicols} | |
\newpage | |
\section{Formules} | |
\newpage | |
\section{Nesting} | |
\end{appendices} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment