text:
% chap4.tex

\chapter{Training the Network}\label{chap:training}

For converging to favorable network configuration, network undergoes training. Training consist of network seeing the training data, adjust its parameters to minimize the training loss and finally settling to global possible minimum loss. However this situation is ideal, because in simple convex setting achieving the minimum is not possible as it requires exact small updates to settle to the minimum loss point.

The goal of training is to adjust network parameters in such a way its error performance on samples outside training data remains within the small bound, so it should generalize well. The probability of difference of expected training error and expected testing error bigger than $\epsilon$ is bounded by $\delta$, see \ref{eq:testlossbound}

\begin{equation}\label{eq:testlossbound}
Pr(E[\mathcal{L}(training)]-E[\mathcal{L}(testing)] > \epsilon) < \delta
\end{equation}

Neural network training has tougher challenges to deal than simple convex setting and hence there is no set methodology how to go about tuning the parameters to attain minimum loss possible, or how training should proceed so that network gets attracted in basin of global minimum and not stuck in local minima or saddle points.

These are few challenges which need to dealt with in training neural networks
\begin{enumerate}
	\item High dimensionality
	\item Non convex and existence of saddle points
	\item Vanishing gradients
    \item Hyper parameters search space
    \item stopping criterion
\end{enumerate}

\section{High Dimensionality}

Neural networks often have very high dimensions which is also known as network parameters. Also along with high dimension of network, training data size is huge and it directly affects convergence time. Also high dimensionality affects generalization capability of the network and they tend to over fit to training samples. Generally drop out, regularizers are used to reduce over-fitting Apart from this it needs a huge amount of data for high generalization performance of the network.

Network tend to under fit if parameters are not enough to get the full input feature representation. Balancing out number of network parameters for efficient representation is also very essential, which is not further examined in this work.

\section{Non Convexity}
Non linear transformation of neural networks make it very difficult optimization problem, apart from high dimensionality. Non convexity comes with its own challenges such as existence of more than one minima and saddle points.

\section{Vanishing gradients}
Deep learning has issue of vanishing gradient, which is, while back propagating gradients from output to input they start becoming smaller and smaller,so as number of layers increases this phenomenon led to saturated weights specially near to input layers. This takes training to almost standstill.
Once it comes to stand still it is even harder to understand what causes training to stop, is it because of local minima or vanishing gradients.

\section{Hyper Parameters}
Hyper-parameters are the most challenging part of neural network optimization. THis is due to the fact that number of parameters and their range is so high that search space becomes so huge that trying exhaustive possibilities are almost intractable. So we left only with random selection for these parameters. Some recommendations of these values are made from time to time and they almost become default choices for training routines now a days.

In our work we performed almost exhaustive set of experiments and suggested parameters,which performed really well. This could well serve as starting point for any deep learning problems.

\section{Stopping criterion}
It is very hard to determine when to stop the training or how many iterations are enough, it is always said that we should train network long enough, how long is long, is impossible to define and so heuristics are always used for deciding it.
This could well be one of the hyperparameters as number of epochs determine when the training should stop. In our work we just used early stopping, which is automatic stopping when performance is not improving.


text:
% LaTeX2e Template by Stephen Iota (https://stepheniota.github.io/)
% last updated: Oct. 2018

% for papers
%\documentclass[aps,onecolumn,superscriptaddress]{revtex4-1}
% https://www-d0.fnal.gov/Run2Physics/WWW/templates/revtex4.pdf
% https://cdn.journals.aps.org/files/revtex/auguide4-1.pdf
% for revTeX4-1 class options

% for other
\documentclass[11pt]{article}
\usepackage[margin=2cm]{geometry}

%%%%%%%%%%%%%%%%
%%% Packages %%%
%%%%%%%%%%%%%%%%

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts} % to remove math font when typesetting equations
\usepackage{graphicx}
\usepackage{enumitem} % to change labels in enum/item
\usepackage[dvipsnames]{xcolor} % for colored links

% always put this at the end
\usepackage[
	colorlinks=true,
	citecolor=green!50!black,
	linkcolor=NavyBlue!75!black,
	urlcolor=green!50!black,
	hypertexnames=false]{hyperref}

 %%%%%%%%%%%%%%%%%%
 %% New Commands %%
 %%%%%%%%%%%%%%%%%%

\newcommand{\email}[1]{\texttt{\href{mailto:#1}{#1}}}

\newcommand{\hint}[1]{\color{Blue}{#1}}

%----------------------------------------------------
%%%%%%%%%%%%%%%%%%
%% Front Matter %%
%%%%%%%%%%%%%%%%%%

\pagenumbering{gobble} % no page numbers
\graphicspath{{figures/}} % set directory for figures

%%%%%%%%%%%%%
%%% Title %%%
%%%%%%%%%%%%%
\begin{document}

\begin{center}

\Large{\textsc{Worksheet 2b}: \textbf{Gauss's Theorem}}

\end{center}

\vspace{.5mm}

%%%%%%%%%%
%% INFO %%
%%%%%%%%%%

\begin{tabular}{rl}
\textsc{SI Leader}:
&
Stephen Iota (\email{siota001@ucr.edu})
\\
\textsc{Course}:
&
Physics 40C (Fall 2018), Dr.~Laura Sales
\\
\textsc{Date}:
&
11 October 2018
\end{tabular}

%%%%%%%%%%%%%%
%% PROBLEMS %%
%%%%%%%%%%%%%%

\section{Conceptual Questions}

\begin{enumerate}[label=(\alph*)]

\item A metallic sphere of radius $r = 5 \ \mu$m with a total charge of $-12.3$ nC is placed in an electric field $\vec{E}(\vec{r}) = 3.2 \hat{x} + 5.7 \hat{y}  - 7.3 \hat{z}$ N/C. What is the electric field strength inside ($r<R$) the sphere?
\item Is Gauss's Law only valid for symmetric charge distributions?

\end{enumerate}

\section{What the Flux}

\begin{enumerate}[label=(\alph*)]

\item What is the net electric flux through the cylinder below?
\begin{center}
\includegraphics[width=.3\linewidth]{W2b_fig2}
\end{center}
\item What is the surface area of a sphere? What is the volume of a sphere?

\item For a symmetric sphere, prove:
$$\Phi_{e} = \oint_{S} \vec{E} \cdot \mathrm{d}\vec{A} = E\cdot4\pi r^2$$

\end{enumerate}

\section{Cylindrical Symmetry}
\begin{center}
\includegraphics[width=.3\linewidth]{W2b_fig1}
\end{center}
\begin{enumerate}[label=(\alph*)]
	\item What is the surface area of the rod of length $L$?
	\item The net electric flux coming out through the cylinder is $-1000$ Nm$^2$/C. How much charge is enclosed   within the cylinder?
\end{enumerate}

\end{document}

ext: tex


text:
\documentclass[11pt,a4paper,]{article}
\usepackage{lmodern}

\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \usepackage{unicode-math}
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\PassOptionsToPackage{hyphens}{url} % url is loaded by hyperref
\usepackage[unicode=true]{hyperref}
\hypersetup{
            pdftitle={Analysis of Australian victims from 2010 to 2019},
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
\usepackage{geometry}
\geometry{a4paper, centering, text={16cm,24cm}}
\usepackage[style=authoryear-comp,]{biblatex}
\addbibresource{references.bib}
\usepackage{longtable,booktabs}
% Fix footnotes in tables (requires footnote package)
\IfFileExists{footnote.sty}{\usepackage{footnote}\makesavenoteenv{long table}}{}
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}

% set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother

\title{Analysis of Australian victims from 2010 to 2019}

%% MONASH STUFF

%% CAPTIONS
\RequirePackage{caption}
\DeclareCaptionStyle{italic}[justification=centering]
 {labelfont={bf},textfont={it},labelsep=colon}
\captionsetup[figure]{style=italic,format=hang,singlelinecheck=true}
\captionsetup[table]{style=italic,format=hang,singlelinecheck=true}

%% FONT
\RequirePackage{bera}
\RequirePackage[charter,expert,sfscaled]{mathdesign}
\RequirePackage{fontawesome}

%% HEADERS AND FOOTERS
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\rfoot{\Large\sffamily\raisebox{-0.1cm}{\textbf{\thepage}}}
\makeatletter
\lhead{\textsf{\expandafter{\@title}}}
\makeatother
\rhead{}
\cfoot{}
\setlength{\headheight}{15pt}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\sffamily\thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}

%% MATHS
\RequirePackage{bm,amsmath}
\allowdisplaybreaks

%% GRAPHICS
\RequirePackage{graphicx}
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.85}
\renewcommand{\textfraction}{0.15}
\renewcommand{\floatpagefraction}{0.8}

%\RequirePackage[section]{placeins}

%% SECTION TITLES

%% SECTION TITLES (NEW: Changing sections and subsections color)
\RequirePackage[compact,sf,bf]{titlesec}
\titleformat*{\section}{\Large\sf\bfseries\color[rgb]{0.8, 0.7, 0.1 }}
\titleformat*{\subsection}{\large\sf\bfseries\color[rgb]{0.8, 0.7, 0.1 }}
\titleformat*{\subsubsection}{\sf\bfseries\color[rgb]{0.8, 0.7, 0.1 }}
\titlespacing{\section}{0pt}{2ex}{.5ex}
\titlespacing{\subsection}{0pt}{1.5ex}{0ex}
\titlespacing{\subsubsection}{0pt}{.5ex}{0ex}

%% TITLE PAGE
\def\Date{\number\day}
\def\Month{\ifcase\month\or
 January\or February\or March\or April\or May\or June\or
 July\or August\or September\or October\or November\or December\fi}
\def\Year{\number\year}

%% LINE AND PAGE BREAKING
\sloppy
\clubpenalty = 10000
\widowpenalty = 10000
\brokenpenalty = 10000
\RequirePackage{microtype}

%% PARAGRAPH BREAKS
\setlength{\parskip}{1.4ex}
\setlength{\parindent}{0em}

%% HYPERLINKS
\RequirePackage{xcolor} % Needed for links
\definecolor{darkblue}{rgb}{0,0,.6}
\RequirePackage{url}

\makeatletter
\@ifpackageloaded{hyperref}{}{\RequirePackage{hyperref}}
\makeatother
\hypersetup{
     citecolor=0 0 0,
     breaklinks=true,
     bookmarksopen=true,
     bookmarksnumbered=true,
     linkcolor=darkblue,
     urlcolor=blue,
     citecolor=darkblue,
     colorlinks=true}

\usepackage[showonlyrefs]{mathtools}
\usepackage[no-weekday]{eukdate}

%% BIBLIOGRAPHY

\makeatletter
\@ifpackageloaded{biblatex}{}{\usepackage[style=authoryear-comp, backend=biber, natbib=true]{biblatex}}
\makeatother
\ExecuteBibliographyOptions{bibencoding=utf8,minnames=1,maxnames=3, maxbibnames=99,dashed=false,terseinits=true,giveninits=true,uniquename=false,uniquelist=false,doi=false, isbn=false,url=true,sortcites=false}

\DeclareFieldFormat{url}{\texttt{\url{#1}}}
\DeclareFieldFormat[article]{pages}{#1}
\DeclareFieldFormat[inproceedings]{pages}{\lowercase{pp.}#1}
\DeclareFieldFormat[incollection]{pages}{\lowercase{pp.}#1}
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\DeclareFieldFormat[article]{title}{\MakeCapital{#1}}
\DeclareFieldFormat[article]{url}{}
%\DeclareFieldFormat[book]{url}{}
%\DeclareFieldFormat[inbook]{url}{}
%\DeclareFieldFormat[incollection]{url}{}
%\DeclareFieldFormat[inproceedings]{url}{}
\DeclareFieldFormat[inproceedings]{title}{#1}
\DeclareFieldFormat{shorthandwidth}{#1}
%\DeclareFieldFormat{extrayear}{}
% No dot before number of articles
\usepackage{xpatch}
\xpatchbibmacro{volume+number+eid}{\setunit*{\adddot}}{}{}{}
% Remove In: for an article.
\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{in}\intitlepunct}}}

\AtEveryBibitem{\clearfield{month}}
\AtEveryCitekey{\clearfield{month}}

\makeatletter
\DeclareDelimFormat[cbx@textcite]{nameyeardelim}{\addspace}
\makeatother

\author{\sf\Large\textbf{ Yiru Wang}\\ {\sf\large section1\\[0.5cm]} \sf\Large\textbf{ Kexin Xu}\\ {\sf\large section2\\[0.5cm]} \sf\Large\textbf{ Ruiqi Tang}\\ {\sf\large section3\\[0.5cm]}}

\date{\sf\Date~\Month~\Year}
\makeatletter
\lfoot{\sf Wang, Xu, Tang: \@date}
\makeatother

%%%% PAGE STYLE FOR FRONT PAGE OF REPORTS

\makeatletter
\def\organization#1{\gdef\@organization{#1}}
\def\telephone#1{\gdef\@telephone{#1}}
\def\email#1{\gdef\@email{#1}}
\makeatother
  \organization{Australian Government COVID19}

  \def\name{Our consultancy \newline Yiru Wang \&\newline Kexin XU \&\newline Ruiqi Tang}

  \telephone{(03) 9905 2478}

  \email{questions@company.com}                 %NEW: New email addresss

\def\webaddress{\url{http://company.com/stats/consulting/}} %NEW: URl
\def\abn{12 377 614 630}                                    % NEW: ABN
\def\logo{\includegraphics[width=6cm]{Figures/logo}}  %NEW: Changing logo
\def\extraspace{\vspace*{1.6cm}}
\makeatletter
\def\contactdetails{\faicon{phone} & \@telephone \\
                    \faicon{envelope} & \@email}
\makeatother

%%%% FRONT PAGE OF REPORTS

\def\reporttype{Report for}

\long\def\front#1#2#3{
\newpage
\begin{singlespacing}
\thispagestyle{empty}
\vspace*{-1.4cm}
\hspace*{-1.4cm}
\hbox to 16cm{
  \hbox to 6.5cm{\vbox to 14cm{\vbox to 25cm{
    \logo
    \vfill
    \parbox{6.3cm}{\raggedright
      \sf\color[rgb]{0.8, 0.7, 0.1 }    % NEW color
      {\large\textbf{\name}}\par
      \vspace{.7cm}
      \tabcolsep=0.12cm\sf\small
      \begin{tabular}{@{}ll@{}}\contactdetails
      \end{tabular}
      \vspace*{0.3cm}\par
      ABN: \abn\par
    }
  }\vss}\hss}
  \hspace*{0.2cm}
  \hbox to 1cm{\vbox to 14cm{\rule{4pt}{26.8cm}\vss}\hss\hfill}  %NEW: Thicker line
  \hbox to 10cm{\vbox to 14cm{\vbox to 25cm{
      \vspace*{3cm}\sf\raggedright
      \parbox{11cm}{\sf\raggedright\baselineskip=1.2cm
         \fontsize{24.88}{30}\color[rgb]{0, 0.29, 0.55}\sf\textbf{#1}}   % NEW: title color blue
      \par
      \vfill
      \large
      \vbox{\parskip=0.8cm #2}\par
      \vspace*{2cm}\par
      \reporttype\\[0.3cm]
      \hbox{#3}%\\[2cm]\
      \vspace*{1cm}
      {\large\sf\textbf{\Date~\Month~\Year}}
   }\vss}
  }}
\end{singlespacing}
\newpage
}

\makeatletter
\def\titlepage{\front{\expandafter{\@title}}{\@author}{\@organization}}
\makeatother

\usepackage{setspace}
\setstretch{1.5}

%% Any special functions or other packages can be loaded here.
\usepackage{float} \floatplacement{figure}{H} \floatplacement{table}{H}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}

\begin{document}
\titlepage

\clearpage

\section*{Introduction}

This report aims to analyze the changes in the victims of various crimes in Australia from 2010 to 2019. We hope to find some problems by analyzing the data: From the perspective of state, gender and age, how have the victims of various crimes changed in the past ten years?

The report is based on \href{https://www.abs.gov.au/statistics/people/crime-and-justice/recorded-crime-victims/latest-release}{victim data} from the \href{https://www.abs.gov.au/}{Australian Bureau of Statistics}. It is a data set generated by regular judicial and criminal investigations and aims to provide the number and rate of victims across Australia in terms of state, gender and age. All ABS data displayed on this website are provided under the Creative Commons Attribution 4.0 international license. It is open data and can be shared freely and adapted for any purpose.

\clearpage

\section*{State}

In this section, the number of victims of various crimes in eight Australian states and the number (and rate) of victims per 100,000 people will be analyzed from 2010 to 2019, and the types of crimes with the most victims will be analyzed.

\begin{figure}
\centering
\includegraphics{report_files/figure-latex/plot1-1.pdf}
\caption{\label{fig:plot1}Comparison of the number of victims of various crimes in each state in the same year}
\end{figure}

As can be clearly seen in Figure \ref{fig:plot1}, the number of victims of sexual assault and armed robbery was the largest in the same year.

\begin{figure}
\centering
\includegraphics{report_files/figure-latex/plot2-1.pdf}
\caption{\label{fig:plot2}Rate of change in the number of victims of various crimes by state}
\end{figure}

Figure \ref{fig:plot2} shows the change in the number of crime victims by state over 10 years.Sexual assault and armed robbery are the most victimized crime categories in every state, while other crimes are victimized in relatively small numbers.

\begin{table}

\caption{\label{tab:table1}Ten-year rate of change in the number of victims of various crimes by state}
\centering
\begin{tabu} to \linewidth {>{\raggedright}X>{\raggedleft}X>{\raggedleft}X>{\raggedleft}X>{\raggedleft}X>{\raggedleft}X>{\raggedleft}X}
\toprule
State & robbery rate & robbery change & Sexual assault rate & Sexual assault change & Murder rate & Murder change\\
\midrule
Capital & -19.867550 & -30 & 69.430052 & 134 & -100.000000 & -3\\
NewSouthWales & -43.953488 & -945 & 51.451369 & 3740 & 4.109589 & 3\\
Northern Territory & 43.478261 & 20 & 7.926829 & 26 & -9.090909 & -1\\
Queensland & 73.246753 & 564 & 14.626091 & 620 & -2.083333 & -1\\
South Australia & -34.482759 & -180 & 13.719736 & 187 & -33.333333 & -5\\
\addlinespace
Tasmania & 1.176471 & 1 & 9.604520 & 17 & -33.333333 & -2\\
Victoria & 40.751043 & 586 & 60.622761 & 2200 & 19.148936 & 9\\
Western Australia & 13.358071 & 72 & 67.412334 & 1115 & -10.000000 & -3\\
\bottomrule
\end{tabu}
\end{table}

\begin{table}

\caption{\label{tab:table2}Ten-year rate of change in the number of victims of various crimes by state}
\centering
\begin{tabu} to \linewidth {>{\raggedright}X>{\raggedleft}X>{\raggedleft}X>{\raggedleft}X>{\raggedleft}X>{\raggedleft}X>{\raggedleft}X}
\toprule
State & extortion rate & extortion change & Manslaughter rate & Manslaughter change & Kidnapping rate & Kidnapping change\\
\midrule
Capital & Inf & 6 & NaN & 0 & Inf & 7\\
NewSouthWales & -46.24277 & -80 & 18.18182 & 2 & -31.610942 & -104\\
Northern Territory & Inf & 3 & -100.00000 & -3 & NaN & 0\\
Queensland & 108.69565 & 50 & -57.14286 & -4 & -13.235294 & -9\\
South Australia & 96.77419 & 30 & NaN & 0 & -9.230769 & -6\\
\addlinespace
Tasmania & NaN & 0 & NaN & 0 & Inf & 3\\
Victoria & 43.06569 & 59 & 366.66667 & 11 & 36.206897 & 42\\
Western Australia & 20.00000 & 18 & 0.00000 & 0 & 21.052632 & 4\\
\bottomrule
\end{tabu}
\end{table}

Table \ref{tab:table1} and Table \ref{tab:table2} show the ten-year change and rate of change in the number of victims of the above six types of crime. Sexual assault was the only crime category in which victims increased in all states, with increases of 51.45 per cent in New South Wales, 67.4 per cent in Western Australia, 60.6 per cent in Victoria and 69.4 per cent in the Australian Capital Territory. Victoria was also the only state to see an increase in the number of victims of all six types of crime.

\begin{figure}
\centering
\includegraphics{report_files/figure-latex/plot3-1.pdf}
\caption{\label{fig:plot3}The rate of change in the rate of various crime victims by state}
\end{figure}

Since sexual assault is the most victimized crime category and the only one with a 10-year increase in the number of victims in all eight states, we will look at it separately.

Figure \ref{fig:plot3} shows how the rate of victims of sexual assault (the number of victims per 100,000 people) changed in eight states from 2010 to 2019. New South Wales had the highest rate of victims, while Tasmania had the lowest. Rates of sexual assault victims fluctuated in most states.

\begin{table}

\caption{\label{tab:table3}A 10-year change in the proportion of victims of sexual assault}
\centering
\begin{tabular}[t]{lrr}
\toprule
State & 2010-2011 & rate\_change\\
\midrule
NewSouthWales & 34.4 & 33.8249754\\
Victoria & 21.9 & 32.9323308\\
Queensland & -0.8 & -0.8316008\\
South Australia & 4.7 & 5.6085919\\
Western Australia & 33.4 & 46.2603878\\
\addlinespace
Tasmania & 1.5 & 4.3103448\\
Northern Territory & 23.3 & 43.7148218\\
Capital & 23.3 & 43.7148218\\
\bottomrule
\end{tabular}
\end{table}

Table \ref{tab:table3} shows the change of the proportion of victims of sexual assault in all states. Except Queensland, the proportion of victims in all states is increasing. The increase of the proportion of victims in Western Australia, Northern Territory, Australian Capital Territory is more than 40\%. Western Australia saw the highest increase of 46.3\%.

Based on the above analysis, we can conclude that the state with the most victims among the eight states is New South Wales, and the type of crime with the most victims is sexual assault. The number of victims of sexual assault in each state has increased over the past 10 years, and Western Australia has even increased by 46.3\%. Only Queensland has a decrease in the number of victims of sexual assault, which shows that Queensland attaches importance to such crimes.

\clearpage

\section*{Gender}

In this section we are going to take a look at crimes across different genders.

\begin{figure}
\centering
\includegraphics{report_files/figure-latex/gendertotal-1.pdf}
\caption{\label{fig:gendertotal}Total number by gender}
\end{figure}

Figure \ref{fig:gendertotal} shows:\\
* On the whole, it shows an upward trend year by year recently.\\
* The number of female victims is much higher than that of male victims, almost twice.

\begin{figure}
\centering
\includegraphics{report_files/figure-latex/gendertype-1.pdf}
\caption{\label{fig:gendertype}Number by gender by crime type}
\end{figure}

Figure \ref{fig:gendertype} shows:\\
* With the exception of sexual assault and kidnapping, the majority of victims are men.
* The vast majority of cases are sexual assaults.\\
* The number of robberies among the remaining crime categories is also considerable. (Including both armed and unarmed)\\
* Possible reasons:
+ Women generally have stronger safety awareness
+ Women are less likely to be seen alone at night in areas where they are likely to be robbed

According to statistics of gender-specific crimes in various countries, male victims are the majority in almost all crimes except for sex-related crimes in which more women are victims.

\begin{table}

\caption{\label{tab:tablesa}Sexual Assault Rate}
\centering
\begin{tabular}[t]{l|l|r}
\hline
Gender & Year & sa\_rate\\
\hline
Female & 2010 & 81.14353\\
\hline
Female & 2011 & 80.92590\\
\hline
Female & 2012 & 81.71220\\
\hline
Female & 2013 & 83.46100\\
\hline
Female & 2014 & 85.77439\\
\hline
Female & 2015 & 87.63073\\
\hline
Female & 2016 & 87.29571\\
\hline
Female & 2017 & 88.86702\\
\hline
Female & 2018 & 88.74093\\
\hline
Female & 2019 & 87.99638\\
\hline
Male & 2010 & 21.67991\\
\hline
Male & 2011 & 23.79634\\
\hline
Male & 2012 & 27.87459\\
\hline
Male & 2013 & 30.70995\\
\hline
Male & 2014 & 34.46328\\
\hline
Male & 2015 & 38.35306\\
\hline
Male & 2016 & 38.22735\\
\hline
Male & 2017 & 39.55563\\
\hline
Male & 2018 & 35.52154\\
\hline
Male & 2019 & 33.06397\\
\hline
\end{tabular}
\end{table}

Table \ref{tab:tablesa}
Take sexual assault, female victims of sexual assault make up a very high proportion of total female victims.

\begin{figure}
\centering
\includegraphics{report_files/figure-latex/gendersa-1.pdf}
\caption{\label{fig:gendersa}Rate by gender in Sexual Assault}
\end{figure}

Figure \ref{fig:gendersa} shows:

\begin{itemize}
\tightlist
\item
  Rate is calculated by victim number divided by 100,000 persons.
\item
  Show an upward pattern over years.
\item
  Higher than 0.15\% in recent years which means 3 out of every 2,000 people have been sexually assaulted.
\item
  Possible reasons:

  \begin{itemize}
  \tightlist
  \item
    Women are physically vulnerable
  \item
    Men are more sexually impulsive
  \item
    Many women may choose not to report the crime

    \begin{itemize}
    \tightlist
    \item
      relationship to the offender
    \item
      confidence in the justice system
    \item
      fear of revenge
    \item
      public opinion
    \end{itemize}
  \end{itemize}
\end{itemize}

ABS personal safety survey also measures the number of women who contacted the police about the most recent incident within the last 10 years. Only 13.4\% of women did so.

\clearpage

\section*{Age}

For my part, my main job is to investigate the victims for the different age groups. I divide the age into four group, teenage, adult, elder adult, and elder. I will compare different class of victims for different groups

\begin{figure}
\centering
\includegraphics{report_files/figure-latex/ageplot-1.pdf}
\caption{\label{fig:ageplot}Age groups between 2010 to 2019}
\end{figure}

From \ref{fig:ageplot}, we can see that the trend for both teenage and adult is very similar. it has a decrease trend from 2010 to 2015. Then, it has a increase trend from 2015 to 2019. For the elder adult and elder, they have increase trend for all year.

\begin{figure}
\centering
\includegraphics{report_files/figure-latex/agedist-1.pdf}
\caption{\label{fig:agedist}Age in class}
\end{figure}

From \ref{fig:agedist}. the largest group of victim is 20-34 years old, the small group of victim is 55 years and over. Then, the most of victim of sexual and abduction are very young, which is 0-19 year old.

For all class of victims

\begin{figure}
\centering
\includegraphics{report_files/figure-latex/classplot-1.pdf}
\caption{\label{fig:classplot}all class}
\end{figure}

The \ref{fig:classplot} shows that the the number of people committed Sexual is the largest, the total number is more than 20000. the number of people who are 0-19 is the largest. the second largest class of victims is robbery, the total number is about 100000 people.

Then, There are the each class victims for the different groups

\includegraphics{report_files/figure-latex/unnamed-chunk-9-1.pdf}

\includegraphics{report_files/figure-latex/unnamed-chunk-10-1.pdf}

\includegraphics{report_files/figure-latex/unnamed-chunk-11-1.pdf}

\clearpage
\section*{Conclusion}

Our group just investage victims of various crimes in Australia from 2010 to 2019. We analysis in this topic in \textbf{State}, \textbf{Gender} and \textbf{Age}. Overall, We find that the number of crimes has increase in recent five years and sexual assualt makes up the vast majority of victims of all types of crime. To some extent the government needs more strict laws and controls so that fewer people suffer from these.

\clearpage
\section*{References}

\textbf{R packages}

\begin{itemize}
\tightlist
\item
  Hao Zhu (2021). kableExtra: Construct Complex Table with `kable' and Pipe Syntax. R package version 1.3.4.
  \url{https://CRAN.R-project.org/package=kableExtra}\\
\item
  Yihui Xie (2021). tinytex: Helper Functions to Install and Maintain TeX Live, and Compile LaTeX
  Documents. R package version 0.31.\\
\item
  Baptiste Auguie (2017). gridExtra: Miscellaneous Functions for ``Grid'' Graphics. R package version 2.3.
  \url{https://CRAN.R-project.org/package=gridExtra}\\
\item
  Hadley Wickham and Jim Hester (2020). readr: Read Rectangular Text Data. R package version 1.4.0.
  \url{https://CRAN.R-project.org/package=readr}\\
\item
  Yihui Xie (2021). bookdown: Authoring Books and Technical Documents with R Markdown. R package version
  0.22.\\
\item
  Hadley Wickham and Jennifer Bryan (2019). readxl: Read Excel Files. R package version 1.3.1.
  \url{https://CRAN.R-project.org/package=readxl}\\
\item
  Yihui Xie (2021). knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version
  1.33.\\
\item
  C. Sievert. Interactive Web-Based Data Visualization with R, plotly, and shiny. Chapman and Hall/CRC
  Florida, 2020.
\end{itemize}

\textbf{Data Resources}

\begin{itemize}
\tightlist
\item
  \href{https://www.abs.gov.au/statistics/people/crime-and-justice/recorded-crime-victims/latest-release}{Recorded Crime - Victims, Australia}
\end{itemize}

\textbf{Software}

\begin{itemize}
\tightlist
\item
  \href{http://www.rstudio.com/}{RStudio}\\
\item
  \href{https://www.R-project.org/}{R}
\end{itemize}

\textbf{Literature}\\
* \href{https://www.aihw.gov.au/getmedia/0375553f-0395-46cc-9574-d54c74fa601a/aihw-fdv-5.pdf.aspx?inline=true}{Sexual assault in Australia}\\
* \href{https://www.aic.gov.au/publications/tbp/tbp7}{An exploratory analysis of armed robbery in Australia}

\printbibliography

\end{document}


text:
\documentclass[a4paper,man,natbib]{apa6}
\usepackage[english]{babel}

\usepackage[cache=false]{minted}
\usemintedstyle{vs}
\usepackage{xcolor}
\definecolor{bg}{rgb}{.95,.95,.95}

\graphicspath{ {./images/} }
\usepackage{graphicx}
\usepackage{caption}

\usepackage{setspace}
%\usepackage{titlesec}
%\titleformat{\subsection}[runin]% runin puts it in the same paragraph
%	{\normalfont\bfseries}% formatting commands to apply to the whole heading
%	{\thesubsection}% the label and number
%	{0.5em}% space between label/number and subsection title
%	{}% formatting commands applied just to subsection title
%	[]% punctuation or other commands following subsection title
% End Packages %

\title{Advanced Statistical Methods Homework 4}
\shorttitle{DAT 530 HW4}
\author{Brandon Hosley}
\date{\today}
\affiliation{University of Illinois - Springfield}
%\abstract{}

\begin{document}
\maketitle
\singlespacing

\section{Introduction to Statistical Learning \\ Chapter 4.7 : Problem 13}
\emph{
Using the \textbf{\textcolor{red}{Boston}} data set,
fit classification models in order to predict
whether a given suburb has a crime rate above or below the median.
Explore logistic regression, LDA, and KNN models using various sub-sets of the predictors. Describe your findings.}

Prepare the data set:

\begin{minted}[bgcolor=bg]{r}
library(MASS)
attach(Boston)
library(Metrics)

dim(Boston)
cor(Boston[,-14])

summary(crim)
b <- Boston
medCrim = median(b$crim)
b$highCrim <- ifelse(b$crim < medCrim, 0, 1)
summary(b$highCrim)

set.seed(123)
train_ind <- sample(seq_len(nrow(b)), size = floor(0.8 * nrow(b)))
train <- b[train_ind, ]
test <- b[-train_ind, ]
\end{minted}

\subsection{(a)}
\emph{Logistic Regression}
%\includegraphics[width=\linewidth]{}
\begin{minted}[bgcolor=bg]{r}
glm.fits=glm(highCrim~rad+tax+lstat, data=train, family=binomial)
summary(glm.fits)
\end{minted}

Train the model on the training data. Then we will test it against the test data.

\begin{minted}[bgcolor=bg]{r}
glm.pred=predict(glm.fits, test, type="response")
mse(test$highCrim,glm.pred)
[1] 0.1520493
\end{minted}

The mean-squared error result from the model applied to test data is fairly low. It suggests a model substantially better than random guessing; though it is likely that there is room for improvement.

\clearpage
\subsection{(b)}
\emph{LDA}
%\includegraphics[width=\linewidth]{}
\begin{minted}[bgcolor=bg]{r}
lda.fit = lda(highCrim~rad+tax+lstat, data=train)
lda.fit
lda.pred=predict(lda.fit, test)
names(lda.pred)
lda.class=lda.pred$class
table(lda.class, test$highCrim)
\end{minted}

\begin{minted}[bgcolor=bg]{r}
lda.class  0  1
	0 49 20
	1  3 30
\end{minted}

Based on the same predictors as the Logistic regression, the LDA produces far less accurate results. Where the addition of predictors caused overfit on the logistic regression, adding predictors for LDA improved the results.

\begin{minted}[bgcolor=bg]{r}
lda.fit = lda(highCrim~rad+tax+lstat+nox+dis, data=train)
lda.fit
lda.pred=predict(lda.fit, test)
names(lda.pred)
lda.class=lda.pred$class
table(lda.class, test$highCrim)
\end{minted}

\begin{minted}[bgcolor=bg]{r}
lda.class  0  1
	0 50 12
	1  2 38
\end{minted}

The addition of the next two highest correlated predictors reduces the error to just below that given by the logistic regression. Adding one or more predictors after this begins to increase the error rate, suggesting over fitting. Current results are slightly better than the previous method.

\clearpage
\subsection{(c)}
\emph{KNN}
%\includegraphics[width=\linewidth]{}
\begin{minted}[bgcolor=bg]{r}
library(class)

knn.pred=knn(train,test,train$highCrim ,k=1)
table(knn.pred, test$highCrim)
\end{minted}

\begin{minted}[bgcolor=bg]{r}
knn.pred  0  1
	0 51  6
	1  1 44
\end{minted}

Even with just a single nearest neighbor the results are far better than what has been achieved by the regression or discriminator.

\begin{minted}[bgcolor=bg]{r}
knn.pred=knn(train,test,train$highCrim ,k=2)
table(knn.pred, test$highCrim)
\end{minted}

\begin{minted}[bgcolor=bg]{r}
knn.pred  0  1
	0 48  4
	1  4 46
\end{minted}

Somewhat surprisingly, increasing the number of neighbors above one only decreases the accuracy of the model on the test data.

\end{document}

max_stars_repo_path: 2020-Fall Advanced Statistical Methods/HW 04/HW 04.2_Hosley.tex

max_stars_repo_name: bhosley/Schoolwork

max_issues_repo_name: bhosley/Schoolwork

max_forks_repo_name: bhosley/Schoolwork


text:
\chapter*{Bidirectional payment channels}
\addcontentsline{toc}{chapter}{Bidirectional payment channels}
\markboth{Bidirectional payment channels}{}
\label{chap:bidir-pc}
\section{The whitepaper}
After studying the whitepaper\cite{decker2015fast} that describes a bidirectional payment channel that we'll try to implement, I decided to go simple and start by implementing a single node bidirectional payment channel implementation. The whitepaper goes further and implements a multi-node bidirectional payment channels, but depending on how the project develops, we may not be able to implement it before the project deadline arrives.

At the moment of writing this document, I've reviewed the paper and started implementing the funding script, but without having tested the script on the network yet.


text:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Deedy - One Page Two Column Resume
% LaTeX Template
% Version 1.3 (22/9/2018)
%
% Original author:
% Debarghya Das (http://debarghyadas.com)
%
% Original repository:
% https://github.com/deedydas/Deedy-Resume
%
% v1.3 author:
% Zachary Taylor
%
% v1.3 repository:
% https://github.com/ZDTaylor/Deedy-Resume
%
% IMPORTANT: THIS TEMPLATE NEEDS TO BE COMPILED WITH XeLaTeX
%
% This template uses several fonts not included with Windows/Linux by
% default. If you get compilation errors saying a font is missing, find the line
% on which the font is used and either change it to a font included with your
% operating system or comment the line out to use the default font.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% TODO:
% 1. Add various styling and section options and allow for multiple pages smoothly.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CHANGELOG:
% v1.3:
% 1. Removed MacFonts version as I have no desire to maintain it nor access to macOS
% 2. Switched column ordering
% 3. Changed font styles/colors for easier human readability
% 4. Added, removed, and rearranged sections to reflect my own experience
% 5. Hid last updated
%
% v1.2:
% 1. Added publications in place of societies.
% 2. Collapsed a portion of education.
% 3. Fixed a bug with alignment of overflowing long last updated dates on the top right.
%
% v1.1:
% 1. Fixed several compilation bugs with \renewcommand
% 2. Got Open-source fonts (Windows/Linux support)
% 3. Added Last Updated
% 4. Move Title styling into .sty
% 5. Commented .sty file.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Known Issues:
% 1. Overflows onto second page if any column's contents are more than the vertical limit
% 2. Hacky space on the first bullet point on the second column.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[]{deedy-resume-reversed}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%     LAST UPDATED DATE
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \lastupdated

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%     TITLE NAME
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\namesection{Anmol Gautam}{ %\urlstyle{same}\href{http://example.com}{example.com}| \href{http://example2.co}{example2.co}\\
\href{mailto:anmolgautam445@gmail.com}{anmolgautam445@gmail.com} | \href{tel:16156635675}{202-468-6153}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%     COLUMN ONE
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{minipage}[t]{0.60\textwidth}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     EXPERIENCE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Experience}

\runsubsection{F5 Networks Inc}
\descript{| SWE Intern(Quality) }
\location{May 2019 – Aug 2019 | Seattle, Washington}
\vspace{\topsep} % Hacky fix for awkward extra vertical space
\begin{tightemize}
\item Worked with Quality Engineering team on project \textbf{Expected To Fail Developer Workflow}.
\item Created a pytest decorator that unblocked quality engineers if they completed writing tests before the developers completed their features.
\item The decorator increased the efficiency of squad workflow by making creation and execution of tests easier.
\item Had a hands-on experience on Kubernetes architecture by capturing and storing pod logs in artifactory for error analysis in CI/CD pipeline's end-to-end testing.
\end{tightemize}
\sectionsep

\runsubsection{Google}
\descript{| Engineering Practicum Intern }
\location{May 2018 – Aug 2018 | Kirkland, WA}
\vspace{\topsep} % Hacky fix for awkward extra vertical space
\begin{tightemize}
\item Worked on project \textbf{System Notification admin page Angular Rewrite} in Display &  Video 360 platform team.
\item Added feature to allow technical support staff members to create and update notifications.
\item Used AngularDart2 for the client side to allow users to create notifications in the GUI.
\item Used Java at the back-end to store the notifications user created and update if they existed in database.
\item The product helped the admins to manage notifications efficiently that would be shown to 60k+ users.
\end{tightemize}
\sectionsep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     PROJECTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Projects}
% \runsubsection{WHATS THE STOCK}
% \descript{| Stock Price Predictor 2018 }
% \begin{tightemize}
% \item Built a stock price predictor app to help people invest in cryptocurrencies.
% \item Used the moving average algorithm for predicting the stock price for different cryptocurrencies.
% \item Used packages such as Panda and Numpy for the data analysis and Matplot library to denote the stock predictor graphically
% \end{tightemize}
% \sectionsep
\runsubsection{QtSpim Counter}
\descript{| Runtime Statistics Feature in QtSpim IDE 2019}
\begin{tightemize}
\item Added an instruction counter in QtSpim to keep track of how many of each instructions is executed in a given MIPS program.
\item Added a cycle counter to keep track of how many clock cycles the given MIPS stimulation use.
\end{tightemize}
\sectionsep

\runsubsection{Project ‘One-Spot’ }
\descript{| A hotspot sharing app 2017}
\begin{tightemize}
\item Built a website for host registration to allow sharing data in the class in the absence of Wi-Fi.
\item Designed the host registration page using HTML and CSS.
\item Used Django framework to display the records of all users on webpage.
\item Used Twilio API to create a message system that allowed users to ask if there are any hosts in the class willing to share data and let them communicate.
\end{tightemize}
\sectionsep

\runsubsection{Snake}
\descript{| A Console Singleplayer Game 2017}
\begin{tightemize}
\item Created a snake game (in C++) that allowed players to score by eating fruits in the screen and recorded the score in the dashboard.
\end{tightemize}
\sectionsep
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     RESEARCH
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \section{Research}
% \runsubsection{Cornell Robot Learning Lab}
% \descript{| Researcher}
% \location{Jan 2014 – Jan 2015 | Ithaca, NY}
% Worked with \textbf{\href{http://www.cs.cornell.edu/~ashesh/}{Ashesh Jain}} and \textbf{\href{http://www.cs.cornell.edu/~asaxena/}{Prof Ashutosh Saxena}} to create \textbf{PlanIt}, a tool which  learns from large scale user preference feedback to plan robot trajectories in human environments.
% \sectionsep

% \runsubsection{Cornell Phonetics Lab}
% \descript{| Head Undergraduate Researcher}
% \location{Mar 2012 – May 2013 | Ithaca, NY}
% Led the development of \textbf{QuickTongue}, the first ever breakthrough tongue-controlled game with \textbf{\href{http://conf.ling.cornell.edu/~tilsen/}{Prof Sam Tilsen}} to aid in Linguistics research.
% \sectionsep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     COMMUNITY SERVICE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \section{Community Service}

% \begin{tabular}{rll}
% 2013 -- 2018    & Tennessee     & St. Baldrick's Foundation\\
% 2014 -- 2017	& Tennessee     & American Cancer Society's Hope Lodge\\
% 2013 -- 2015    & Tennessee     & Habitat for Humanity\\
% 2011 -- 2015    & Tennessee     & Special Olympics\\
% \end{tabular}
% \sectionsep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     SOCIETIES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \section{Societies}

% \begin{tabular}{rll}
% 2018 -- 2018    & National      & Association of Computing Machinery (ACM)\\
% 2017 -- 2019	& National      & Scrum Alliance Certified ScrumMaster\\
% 2015 -- 2019    & University    & Shackouls Honors College\\
% \end{tabular}
% \sectionsep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     AWARDS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \section{Awards}
% \begin{tabular}{rll}
% 2015        & 99\textsuperscript{th} percentile & National Merit Scholarship Finalist\\
% \end{tabular}
% \sectionsep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     PUBLICATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \section{Publications}
% \renewcommand\refname{\vskip -1.5cm} % Couldn't get this working from the .cls file
% \bibliographystyle{abbrv}
% \bibliography{publications}
% \nocite{*}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%     COLUMN TWO
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{minipage}
\hfill
\begin{minipage}[t]{0.33\textwidth}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     EDUCATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Education}

\subsection{Howard University}
\descript{Bachelor of Science in Computer Science}
\location{Expected MAY 2021 | Washington, DC}
% College of Engineering \\
\location{GPA: 4.0}
\sectionsep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     SKILLS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Skills}
\subsection{Programming Languages}
Python \\
C++ \\
Dart \\
Java \\
HTML \\
\sectionsep

\subsection{Web frameworks}
AngularDart \\
Django \\
\sectionsep

\subsection{Version Control}
Git \\
\sectionsep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     COURSEWORK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Coursework}
Intro to Computer Science \\
Computer Science I, II, III \\
Fundamental of Algorithms \\
Software Engineering \\
Discrete Structures \\
Computer Organization I, II\\
Large Scale Programming \\

\sectionsep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     Societies
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Organizations}
Association for Computing Machinery (ACM)\\
National Society of Black Engineers (NSBE) \\
Howard University Math Club \\
\sectionsep

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     LINKS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Honors and Awards}
\subsection{Dean's High Honors List 2017}
Awarded for high GPA. \\
\sectionsep

\subsection{Winner of Google and ACM Hackathon 2017}
Awarded 'Best Solutions' for the project of hotspot app. \\
\sectionsep

\subsection{Capstone Scholar 2017}
Awarded \$138,748 for bachelor studies for good high school academic scores. \\
\sectionsep

\end{minipage}
\end{document}  \documentclass[]{article}


text:
\documentclass[12pt]{article}

\include{preamble}

\title{Math 341 / 650 Spring 2017 \\ Final Examination}
\author{Professor Adam Kapelner}

\date{Thursday, May 25, 2017}

\begin{document}
\maketitle

\noindent Full Name \line(1,0){410}

\thispagestyle{empty}

\section*{Code of Academic Integrity}

\footnotesize
Since the college is an academic community, its fundamental purpose is the pursuit of knowledge. Essential to the success of this educational mission is a commitment to the principles of academic integrity. Every member of the college community is responsible for upholding the highest standards of honesty at all times. Students, as members of the community, are also responsible for adhering to the principles and spirit of the following Code of Academic Integrity.

Activities that have the effect or intention of interfering with education, pursuit of knowledge, or fair evaluation of a student's performance are prohibited. Examples of such activities include but are not limited to the following definitions:

\paragraph{Cheating} Using or attempting to use unauthorized assistance, material, or study aids in examinations or other academic work or preventing, or attempting to prevent, another from using authorized assistance, material, or study aids. Example: using an \emph{unauthorized} cheat sheet in a quiz or exam, altering a graded exam and resubmitting it for a better grade, etc.
\\

\noindent I acknowledge and agree to uphold this Code of Academic Integrity. \\

\begin{center}
\line(1,0){250} ~~~ \line(1,0){100}\\
~~~~~~~~~~~~~~~~~~~~~signature~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date
\end{center}

\normalsize

\section*{Instructions}

This exam is seventy five minutes and closed-book. You are allowed \textbf{three} pages (front and back) of \qu{cheat sheets.} You may use a graphing calculator of your choice. Please read the questions carefully. If the question reads \qu{compute,} this means the solution will be a number otherwise you can leave the answer in \textit{any} widely accepted mathematical notation which could be resolved to an exact or approximate number with the use of a computer. I advise you to skip problems marked \qu{[Extra Credit]} until you have finished the other questions on the exam, then loop back and plug in all the holes. I also advise you to use pencil. The exam is 100 points total plus extra credit. Partial credit will be granted for incomplete answers on most of the questions. \fbox{Box} in your final answers. Good luck!

\pagebreak

\begin{table}[htp]
\centering
\small
\begin{tabular}{l | llll}
Distribution                  & Quantile  & PMF / PDF  &CDF       & Sampling  \\
of r.v. &  Function & function         & function &  Function \\ \hline
beta & \texttt{qbeta}($p$, $\alpha$, $\beta$)
& \texttt{d-}($x$, $\alpha$, $\beta$)
& \texttt{p-}($x$, $\alpha$, $\beta$)
& \texttt{r-}($\alpha$, $\beta$) \\
betabinomial & \texttt{qbetabinom}($p$, $n$, $\alpha$, $\beta$)
& \texttt{d-}($x$, $n$, $\alpha$, $\beta$)
& \texttt{p-}($x$, $n$, $\alpha$, $\beta$)
& \texttt{r-}($n$, $\alpha$, $\beta$) \\

betanegativebinomial & \texttt{qbeta\_nbinom}($p$, $r$, $\alpha$, $\beta$)
& \texttt{d-}($x$, $r$, $\alpha$, $\beta$)
& \texttt{p-}($x$, $r$, $\alpha$, $\beta$)
& \texttt{r-}($r$, $\alpha$, $\beta$) \\

binomial & \texttt{qbinom}($p$, $n$, $\theta$)
& \texttt{d-}($x$, $n$, $\theta$)
& \texttt{p-}($x$, $n$, $\theta$)
& \texttt{r-}($n$, $\theta$) \\

exponential & \texttt{qexp}($p$, $\theta$)
& \texttt{d-}($x$, $\theta$)
& \texttt{p-}($x$, $\theta$)
& \texttt{r-}($\theta$) \\

gamma & \texttt{qgamma}($p$, $\alpha$, $\beta$)
& \texttt{d-}($x$, $\alpha$, $\beta$)
& \texttt{p-}($x$, $\alpha$, $\beta$)
& \texttt{r-}($\alpha$, $\beta$) \\

geometric & \texttt{qgeom}($p$, $\theta$)
& \texttt{d-}($x$, $\theta$)
& \texttt{p-}($x$, $\theta$)
& \texttt{r-}($\theta$) \\

inversegamma & \texttt{qinvgamma}($p$, $\alpha$, $\beta$)
& \texttt{d-}($x$, $\alpha$, $\beta$)
& \texttt{p-}($x$, $\alpha$, $\beta$)
& \texttt{r-}($\alpha$, $\beta$) \\

negative-binomial & \texttt{qnbinom}($p$, $r$, $\theta$)
& \texttt{d-}($x$, $r$, $\theta$)
& \texttt{p-}($x$, $r$, $\theta$)
& \texttt{r-}($r$, $\theta$) \\

normal (univariate) & \texttt{qnorm}($p$, $\theta$, $\sigma$)
& \texttt{d-}($x$, $\theta$, $\sigma$)
& \texttt{p-}($x$, $\theta$, $\sigma$)
& \texttt{r-}($\theta$, $\sigma$) \\

normal (multivariate) &
& \multicolumn{2}{l}{\texttt{dmvnorm}($\x$, $\muvec$, $\bSigma$)}
& \texttt{r-}($\muvec$, $\bSigma$) \\

poisson & \texttt{qpois}($p$, $\theta$)
& \texttt{d-}($x$, $\theta$)
& \texttt{p-}($x$, $\theta$)
& \texttt{r-}($\theta$) \\

T (standard) & \texttt{qt}($p$, $\nu$)
& \texttt{d-}($x$, $\nu$)
& \texttt{p-}($x$, $\nu$)
& \texttt{r-}($\nu$) \\

T (nonstandard) & \texttt{qt.scaled}($p$, $\nu$, $\mu$, $\sigma$)
& \texttt{d-}($x$, $\nu$, $\mu$, $\sigma$)
& \texttt{p-}($x$, $\nu$, $\mu$, $\sigma$)
& \texttt{r-}($\nu$, $\mu$, $\sigma$) \\

uniform & \texttt{qunif}($p$, $a$, $b$)
& \texttt{d-}($x$, $a$, $b$)
& \texttt{p-}($x$, $a$, $b$)
& \texttt{r-}($a$, $b$) \\
\end{tabular}
\caption{Functions from $\texttt{R}$ (in alphabetical order) that can be used on this exam. The hyphen in colums 3, 4 and 5 is shorthand notation for the full text of the r.v. which can be found in column 2.
}
\label{tab:eqs}
\end{table}

\problem Assume a binomial likelihood with a known sample size $n$ with a beta prior with parameters $\alpha$ and $\beta$.

\benum

\subquestionwithpoints{3} What is the kernel of $\prob{\theta}$? \spc{3}

\subquestionwithpoints{3} What is the kernel of $\cprob{\theta}{X,~n}$? \spc{3}

\subquestionwithpoints{4} What is the kernel of $\cprob{\theta,~X}{n}$? \spc{3}

\subquestionwithpoints{5} Find $\int \cprob{\theta,~X}{n} d\theta$ explicitly (i.e. saying the answer is e.g. $\cprob{\theta}{X}$ is unacceptable. You can use any notation we used in class. Hint: nothing from Table~\ref{tab:eqs} is the answer. \spc{5}

\subquestionwithpoints{6} Create a Gibbs sampler that will sample from $\cprob{\theta,~X}{n}$. Outline the steps of the sampler and describe explicitly how you do each step using functions from Table~\ref{tab:eqs}. You do not need to write about burning and thinning. \spc{11}

\subquestionwithpoints{2} [Extra Credit] If the $X$'s resulting from the Gibbs sampler were examined after burning and thinning, what would $\oneover{n} \sum x_i$ be approximately equal to? \spc{1}
\eenum

\problem The table below displays an excerpt of daily historical data of the S\&P500 index for American equities going back to 1950, a total of $n = 16,428$ days. You had a similar dataset for the homework, but that was yearly returns.

\begin{table}[htp]
\centering
\begin{tabular}{c|cc}
Day  & Ending Price & Gain or Loss (\%) \\ \hline
1/4/1950 &16.85  & 1.14 \\
1/5/1950   & 16.93  & 0.47 \\
1/6/1950    &16.98  & 0.29 \\
1/9/1950    & 17.08  &0.58 \\
1/10/1950   & 17.03 & -0.29 \\
\vdots
\end{tabular}
\end{table}

\noindent For the daily percent gains (or losses) we calculate the sample average and sample standard deviation:

\beqn
\xbar &=& 0.03\% \\
s &=& 0.97\%
\eeqn

\noindent We also assume that the daily percent gains (or losses) is modeled via

\beqn
\Xoneton ~|~\theta,\sigsq \iid \normnot{\theta}{\sigsq}
\eeqn

For the remainder of this problem, you are to answer explicitly using numbers for all arguments.  If you use any substitutions, make it clear as to the value of or how the substitutions are calculated. They can only be a function of the $x_i$'s.

\benum

\subquestionwithpoints{4} Assume $\sigsq$ was known to be $0.97\%^2$, what is the distribution of $\theta$ given the data? Assume $\theta \sim \normnot{0\%}{100\%^2}$. Compute explicitly for this problem and the remainder of this question. \spc{9}

\subquestionwithpoints{4} Assume $\theta$ was known to be 0.03\%, what is the distribution of $\sigsq$ given the data?  Assume $\prob{\sigsq} \propto 1 / \sigsq$. \spc{5}

\subquestionwithpoints{4} Assume neither $\theta$ nor $\sigsq$ was known, what is the distribution of $\theta$ given the data assuming the Jeffrey's prior for the parameters? \spc{5}

\subquestionwithpoints{4} Assume neither $\theta$ nor $\sigsq$ was known, what is the distribution of $\sigsq$ given the data assuming the Jeffrey's prior for the parameters? \spc{5}

\subquestionwithpoints{4} Assume neither $\theta$ nor $\sigsq$ was known, what is the distribution of tomorrow's return given the data assuming the Jeffrey's prior for the parameters? \spc{5}

\subquestionwithpoints{6} [Extra Credit] Assume neither $\theta$ nor $\sigsq$ was known and assume the priors in (a) and (b). Explain how you would sample pairs  $\bracks{\theta, \sigsq}$ from $\cprob{\theta,~\sigsq}{X}$. Use functions from Table~\ref{tab:eqs}. \spc{10}

\subquestionwithpoints{4} Using your answer from (d), provide a 99\% credible region for $\sigsq$. Use functions from Table~\ref{tab:eqs}. \spc{3}

\subquestionwithpoints{4} Using your answer from (e), provide a 95\% credible region for tomorrow's return. Use functions from Table~\ref{tab:eqs}. \spc{4}

\subquestionwithpoints{4} We now want to make sure we picked a realistic likelihood model and realistic priors on its parameters (the uninformative Jeffrey's prior). We plot the true data and seven replicates using $\cprob{X^*}{X}$ where the dimension of $X^*$ is the same as of $X$, i.e. $n=16428$. You can see the result in Figure~\ref{fig:model_check} on page~\pageref{fig:model_check}. Was our choice for the likelihood (and priors) a good choice to model this data? Yes / no. If not, where exactly did we go wrong? \spc{2}

\eenum

\begin{figure}[h]
\centering
\includegraphics[width=7in]{data_and_reps}
\caption{Replicates of the original data assuming the model and the prior.}
\label{fig:model_check}
\end{figure}

\problem A call center at a large company receives many calls per day. In each minute, calls are approximately Poisson distributed as they are the result of millions of potential callers with a minuscule probability each can call in. For a particular day, the manager is trying to locate the \qu{slightly busier period} between the calm period of the early morning and the calm period of the late evening. Figure~2 on page \pageref{fig:call_data} shows a plot of a day's data where each point is the number of calls in one minute for all 24 hours:

\begin{figure}[h]
\centering
\includegraphics[width=6in]{call_data}
\label{fig:call_data}
\caption{The call data.}
\end{figure}

You can barely see there is a busy period sandwiched between two calm periods. We will now build a Bayesian model to detect all parameters:

\begin{itemize}
\item $m_1$ --- the first change point i.e. the minute of the day that indicates the transition from the calm of the morning to the busy of the day
\item $m_2$ --- the second change point i.e. the minute of the day that indicates the transition from the busy of the day to the calm of the evening
\item $\lambda_c$ --- the mean number of calls during the calm of the morning \textit{and} evening
\item $\lambda_b$ --- the mean number of calls during the busy part of the day
\end{itemize}

We will assume each caller is independent. Let $x_1, x_2, \ldots, x_{n}$ represent the data (where $n=1440$, the number of minutes in a 24hr day). For example, $x_{20}$ is the number of calls in the 20th minute of the day i.e. from 12:19:00AM to 12:19:59AM.

\benum

\subquestionwithpoints{6} Write the likelihood of the model. Answer as explicitly as possible. \spc{6}

\subquestionwithpoints{3} Assume the prior of Gamma(0, 0) for both $\lambda_c$ and $\lambda_b$ and assume a discrete uniform prior for $m_1$ and $m_2$. Write each prior formally and indicate if each of them are proper or improper. \spc{3}

\subquestionwithpoints{6} Assume the likelihood model from (a) and the priors from (b). Find the kernel of the posterior. \spc{6}

\subquestionwithpoints{6} Assume your expression for proportional posterior from (c). Find $\cprob{\lambda_b}{x_1, \ldots, x_n, \lambda_c, m_1, m_2}$. \spc{3}

\subquestionwithpoints{4} Using the conditional from (d) and all other conditionals, we build a Gibbs sampler with 1,000 iterations. Figure~3 on page \pageref{fig:burn} shows the first 80 iterations of each chain. It seems to burn in right away, at about the 10th iteration. Figure~4 on page \pageref{fig:acf} shows the autocorrelation of the chains. After thinning the burned-in chains, how many samples are we left with from the posterior? \spc{2}

\subquestionwithpoints{2} Are these \qu{left over samples} considered $\iid$? Yes / no.

\subquestionwithpoints{4} Figure~5 on page \pageref{fig:marginals} shows the histograms from the burned and thinned chains. Provide an approximate 95\% credible region for $m_2$.  \spc{3}

\subquestionwithpoints{3} Approximate the MMSE Bayesian estimate for $\lambda_c$.  \spc{1}

\subquestionwithpoints{3} Approximate the MAE Bayesian estimate for $\lambda_b$.  \spc{1}

\subquestionwithpoints{4} Test if $m_1$ is greater than 500.  \spc{3}

\subquestionwithpoints{6} Devise a means to test $H_0$: there was no busy period to begin with i.e. for the whole day there was only one homogeneous Poisson.

\eenum

\begin{figure}[htp]
\centering
\includegraphics[width=6.5in]{burn}
\label{fig:burn}
\caption{First 80 iterations of the Gibbs sampler in Problem 3.}
\end{figure}

\begin{figure}[htp]
\centering
\includegraphics[width=6.5in]{acf}
\label{fig:acf}
\caption{Autocorrelation estimates for the Gibbs sampler after burn-in in Problem 3.}
\end{figure}

\begin{figure}[htp]
\centering
\includegraphics[width=6.5in]{marginals}
\label{fig:marginals}
\caption{Histograms for the Gibbs sampler after burn-in and thinning in Problem 3.}
\end{figure}

\end{document}


text:
\documentclass{article}
\begin{document}

\section{Introduction}
\label{sec:intro}

In Section \ref{sec:method}, ...

\section{Method}
\label{sec:method}

\begin{equation}
\label{eq:euler}
e^{i\pi} + 1 = 0
\end{equation}

In Equation \ref{eq:euler}, ...

\end{document}

max_stars_repo_name: balunet/latex-course

max_issues_repo_name: balunet/latex-course

max_forks_repo_name: balunet/latex-course


text:
\section{Reaction paths}\index{Reaction paths}\index{Reaction path calculation}
\label{rpaths}
\index{Path calculations}

\begin{figure}
\begin{makeimage}
\end{makeimage}
\begin{verbatim}
 CHARGE=-1
 SN2 reaction, Cl(-) + CH3F = CH3Cl + F(-)
   C
   F   1.4  1
   H   1.1  1   109.5 1     0    0    1 2
   H   1.1  1   109.5 1   120.0  0    1 2 3
   H   1.1  1   109.5 1   120.0  0    1 2 3
   Cl 20.0 -1   127.3 1   180.0  0    1 2 3
   0   0.00 0     0.0 0     0.0  0    0 0 0
  10.0 5.0 4.0 3.0 2.9 2.8 2.7 2.6 2.5
   2.4 2.3 2.2 2.1 2.0 1.9 1.8 1.7 1.6
\end{verbatim}
\index{S$_{N^2}$!reaction}
\caption{\label{sn2} Example of an S$_{N^2}$ reaction path calculation}
\end{figure}

\begin{figure}
\begin{makeimage}
\end{makeimage}
\begin{verbatim}
step=5 points=13  SYMMETRY
Ethane, Barrier to Rotation
C
C  1.5 1    0 0    0  0   1 0 0
H  1.0 1  111 1    0  0   2 1 0
H  1.0 0  111 0  120  0   2 1 3
H  1.0 0  111 0 -120  0   2 1 3
H  1.0 0  111 0   60 -1   1 2 3
H  1.0 0  111 0  180  0   1 2 3
H  1.0 0  111 0  -60  0   1 2 3
0  0.0 0    0 0    0  0   0 0 0
3 1 4 5 6 7 8
3 2 4 5 6 7 8
6 7 7
6 11 8
\end{verbatim}
\index{Rotation barrier calculation}
\caption{\label{c2h6p} Example of a rotation barrier calculation}
\end{figure}

\begin{figure}
\begin{makeimage}
\end{makeimage}
\begin{verbatim}
step=0.05 points=20
Trans-polyparaphenylene benzobisthiazole
Stretching the polymer
  C    0.0  0      0  0      0  0    0  0  0
  N    1.3  1      0  0      0  0    1  0  0
  S    1.7  1    115  1      0  0    1  2  0
  C    1.6  1     92  1      0  1    3  1  2
  C    1.4  1    109  1     -0  1    2  1  3
  C    1.4  1    124  1   -180  1    5  2  1
  C    1.4  1    116  1    180  1    6  5  2
  C    1.4  1    121  1      0  1    7  6  5
  C    1.4  1    129  1    180  1    4  3  1
  S    1.6  1    129  1    180  1    7  6  5
  C    1.7  1     92  1    180  1   10  7  6
  N    1.4  1    113  1   -180  1    8  7  6
  C    1.4  1    121  1   -180  1   11 10  7
  C    1.4  1    120  1    -90  1   13 11 10
  C    1.4  1    120  1    180  1   14 13 11
  C    1.4  1    120  1      0  1   15 14 13
  C    1.4  1    118  1     -0  1   16 15 14
  C    1.4  1    120  1      0  1   17 16 15
  H    1.0  1    121  1     -0  1    6  5  2
  H    1.0  1    121  1      0  1    9  4  3
  H    1.0  1    120  1     -0  1   14 13 11
  H    1.0  1    119  1   -180  1   15 14 13
  H    1.0  1    120  1   -180  1   17 16 15
  H    1.0  1    119  1    180  1   18 17 16
 xx    1.4  1    120  1    180  1   16 15 14
 Tv   12.6 -1      0  0      0  0    1 25 24
\end{verbatim}
\index{Polymers!stretching}
\index{PBT}
\caption{\label{hook} Data set to stretch a polymer}\index{Hook's law calculation}
\end{figure}

MOPAC has the capability to model the effects of changing an internal
coordinate. In the data-set, the relevant internal coordinate is flagged with a
`-1' rather than a `1' or `0'.  Two options then exist to allow the values of
the changing coordinate to be defined.

First, the various values of the coordinate can be supplied after the geometry
and any symmetry data have been entered.  An example for the S$_{N^2}$ reaction
Cl$^-$ + CH$_3$F $\rightarrow$ CH$_3$Cl + F$^-$  is given in Figure~\ref{sn2}.

\index{Symmetry!use in reaction paths}
\index{Rotation barriers|ff}
\index{Ethane!barrier in}
Second, if the step-size is a constant, then the step-size and number of steps
can be defined on the keyword line.  An example of such a ``reaction'' would be
the rotation of a methyl group in, e.g., ethane, Figure~\ref{c2h6p}. Here,
symmetry is used to maintain D$_3$ symmetry as the rotation takes place. Note
that \comp{SYMMETRY} can be used to relate coordinates to the reaction
coordinate. The path calculations work by optimizing the geometry while the
reaction coordinate is fixed at the starting value.  Once the geometry is
optimized, the reaction coordinate is changed, and the geometry re-optimized.
This is done for all points on the reaction path.

Reaction paths can be used for calculating mechanical properties.  For example,
to calculate Hook's force constant for stretching polyethylene, the translation
vector could be steadily increased, Figure~\ref{hook}.

\section{Grid Calculation}
\label{grid}
\index{Grid Calculation|ff}
The GRID calculation is the two-dimensional analog of the PATH calculation.  In
a PATH calculation, one coordinate is flagged with a `-1'.  In a GRID
calculation, two coordinates are flagged by `-1's.  An example of a  GRID
calculation is shown in Figure~\ref{exgrid}. Note that the keywords
\comp{STEP1=$n.nn$} and \comp{STEP2=$m.mm$} are essential.

\begin{figure}
\begin{makeimage}
\end{makeimage}
\begin{verbatim}
SYMMETRY STEP1=0.01 STEP2=1
Water, potential energy surface for

 H
 O   0.92 -1     0  0    0 0   1
 H   0.92  0   104 -1    0 0   2 1

 2 1 3
\end{verbatim}
\caption{\label{exgrid} Example of a GRID Calculation}
\end{figure}

In this example, the potential energy surface for water is generated.  For one
axis of the 2-D plot, the O--H bond length is varied from 0.92\AA\ to 1.02\AA ,  in 11 steps of 0.01\AA , and in the other axis, the H--O--H angle is varied
from 104  to 114$^{\circ}$ in 11 steps of 1.0 degree.  Because of the use of
symmetry, there are no variables to be optimized.  If symmetry were not used,
then the second O--H bond length could either be optimized, by setting its flag
to 1, or held constant, by setting its flag to 0.

Other keywords which can be used with the GRID option are: \comp{MAX}: to use
23 points in each direction, rather than the default 11; \comp{POINT1=n} and
\comp{POINT2=m}: to use $n$ and $m$ points in directions 1 and 2; and keywords
to specify how the geometry should be optimized.

max_stars_repo_name: openmopac/MOPAC-archive

max_issues_repo_name: openmopac/MOPAC-archive

max_forks_repo_name: openmopac/MOPAC-archive


text:
%
%$Id: introduction.tex,v 1.3 2005-08-11 13:58:17 lars Exp $
%

\section{Introduction}

\subsection{What is GOTM?}
GOTM is the abbreviation for `General Ocean Turbulence Model'. It is a
one-dimensional water column model for the most important hydrodynamic
and thermodynamic processes related to vertical mixing in natural
waters. In addition, it has been designed such that it can easily be
coupled to 3-D circulation models, and used as a module for the
computation of vertical turbulent mixing. The core of the model
computes solutions for the one-dimensional versions of the transport
equations of momentum, salt and heat. The key component in solving
these equations is the model for the turbulent fluxes of these
quantities. The strength of GOTM is the vast number of well-tested
turbulence models that have been implemented in the code. These models
span the range from simple prescribed expressions for the turbulent
diffusivities up to complex Reynolds-stress models with several
differential transport equations to solve. Even though, evidently, not
all turbulence models published in oceanography could be implemented,
at least one member of every relevant model family can be found in
GOTM (empirical models, energy models, two-equation models, Algebraic
Stress Models, K-profile parameterisations, etc).

Besides the classic combination of the hydrodynamic and turbulent part
of the model, GOTM has been growing considerably with the years, and
new parts have been developed. Sediment transport and the dynamics of
sea grass have been added, state-of-the-art numerical schemes have
been implemented, and an environment for the assimilation of data and
the computation of atmosphere-ocean interactions exists now. In
addition, there is a number of scientific research groups that adopted
GOTM for their own projects. Even though the modules developed by
these groups (biological and bio-geochemical components, air-sea
interaction modules, plotting routines, etc) are not part of the core
structure of GOTM, as downloadable from our web-site at {\tt
www.gotm.net}, they are in most cases available directly from these
groups. In that sense, GOTM is an integrated, community based software
environment for an almost unlimited range of applications in
geophysical turbulence modelling.

\subsection{The idea behind GOTM}
Computer codes similar to pieces of GOTM can be found at many
scientific institutions. However, different researchers have different
goals. Some are interested in the development of turbulence models,
others in oceanic applications of these models, and yet others want to
compare the effects of different turbulence models on different
processes in the ocean or in lakes. The attempt to use one of their
specialised programs for one's own project resulted in many cases in
spending weeks of work for deciphering non-documented FORTRAN lines,
scattered with pre-historic fragments of code from more or, in some
cases, less talented programmers. Additional time had to be spend for
providing components for atmospheric forcing, etc, before the own
research project could finally be attacked.

To overcome these problems, the GOTM project was intiated, its
purpose being twofold. First, GOTM should provide an integrative
environment for all researchers interested in the \emph{application}
of a turbulence model in studies of oceanic processes. Such a software
should contain a core part for solving transport equations of mean and
turbulent quantities, but equally well routines to compute the
atmosphere-ocean fluxes from meteorological or measured data,
including routines to interpolate and manipulate them. Second,
however, GOTM should also be a research tool for those interested in
the \emph{development} of turbulence models and numerical
algorithms. This implies that GOTM should always contain the
state-of-the-art models and algorithms in these disciplines. The
current version of GOTM was developed under these premises.

In both cases, a detailed and comprehensible documentation is crucial,
and we spent a lot of effort to come close to this goal.  All methods
and models embedded in GOTM can be traced back to scientific
publications, a key requirement for the scientific use of a program.
Also, we took great care to make the FORTRAN95 code as safe, easily
understandable, and extensible, as possible.

\subsection{How to read the documentation}
This document is the official scientific documentation of GOTM. Due to
the fast and continuing evolution of GOTM, we have been looking for a
new and flexible way of giving a comprehensive and up-to-date
documentation for GOTM. We decided for the following strategy.

Every module of GOTM is accompanied by an introductory text on the
general theory of the subject, including mathematical derivations,
bibliographic references, and the definition of the most important
variables. These introductory parts, which should give the reader a
brief theoretical overview of what is coded in the modules, are
expected to be relatively stable. References are given to more
comprehensive introductory or advanced media for each subject.

For the actual documentation of the FORTRAN95 code, which is more
likely subject to frequent changes and extensions, a different
strategy has been followed. For every {\tt module}, internal or
external {\tt subroutine} or {\tt function}, a short piece of
documentation in \LaTeX\ has been directly written into the
code. These fragments of the documentation will be updated every time
the code changes. We use a software called PROTEX, which looks into
\emph{every} FORTRAN file of GOTM, extracts the \LaTeX\ parts, and
compiles some information about the FORTRAN interfaces, public member
functions, public data members, defined parameters, etc. All these
pieces of information are assembled by PROTEX to yield a nice
documentation including table of contents, figures, tables,
references, and formulae for each part of the program. The largest
part of the report has been created in this way. Note that PROTEX
looks for certain key words in the FORTRAN code to organise the
structure of the final document. Therefore, don't be confused if you
find things like {\tt !DESCRIPTION:}, {\tt !INTERFACE:}, {\tt !PUBLIC
DATA MEMBERS:}, etc, in the FORTRAN files. These are always preceded
by an exclamation mark, and thus invisible for your FORTRAN compiler.

If you are new to GOTM, we recommend to completely go through the core
parts of GOTM described in \sect{sec:mainIntro}, \sect{sec:meanflowIntro},
and \sect{sec:turbulenceIntro}. In these sections, you will find also
references to the relevant introductory literature. The other
parts of this documentation should be used like an encyclopedia: you
can look up things fast when you need more information about parts
of the program. Extra comments can be found in the form of standard
FORTRAN comments that should help users to find their way through the
lines of the code.

A special status in this documentation has \sect{sec:cases}
illustrating particular scenarios prepared for GOTM. This section contains
useful information about the theoretical background and the
implementation of each scenario currently available in GOTM. Scenarios
range from simple test cases, like a turbulent Couette flow, to full
oceanic applications including meteorological forcing and comparison
to measured data. The most simple scenarios descibed in \sect{sec:cases}
serve as a little tutorial, in which the key algorithms of
GOTM are introduced in a practical way.

This documentation does not contain information about how to download,
compile and run the code and the test cases. All information necessary
to run GOTM on a number of well-known platforms is compiled at {\tt
www.gotm.net}. If you wish to directly contact to the GOTM developers,
please write an e-mail to {\tt gotm-devel@gotm.net}. All users of GOTM,
who signed up on the GOTM web page, will be on the users' mailing
list, {\tt gotm-users@gotm.net}. Information about updates, bug fixes, and
new versions of GOTM are communicated via this list.

\subsection{Acknowledgements}

The authors of this report are grateful to the former members of the
GOTM Team for their persisting cooperation. These are particularly
members from the very first days of GOTM which took place at the Joint
Research Centre in Ispra (Italy) in 1998: Manuel Ruiz Villarreal who
worked after the Ispra time in Santiago de Compostela (Spain), Lisboa
(Portugal), Hamburg (Germany), and Warnem\"unde (Germany) before he
moved back to his home country for working in A Coru\~na
(Spain). Pierre-Phillipe Mathieu who went to Reading (U.K.) for some
time before he arrived in Frascati (Italy) recently.  We further want
to acknowledge those of the almost 200 subscribed users of GOTM from
all over the world who helped us to improve GOTM, reported bugs, and
motivated us to go on with this zero-budget project.  It was also the
important role which GOTM played in several projects, mostly funded by
the European Commission, which helped a lot to maintain GOTM.  These
projects were MAS3-CT96-0053 ('PHASE'), MAS3-CT96-0051 ('MTP
II-MATER'), MAS3-CT97-0025 ('PROVESS'), and especially CARTUM
(Comparative Analysis and Rationalisation of Second-Moment Turbulence
Models), a brainstorming activity (MAS3-CT98-0172), which brought
together turbulence specialists from all over the world.  We are
finally grateful to all those other people working on the Public
Domain Software without which a project like GOTM would be
unthinkable: \LaTeX, PROTEX, LINUX and many others.

max_stars_repo_name: rustychris/schism

max_issues_repo_name: rustychris/schism

max_forks_repo_name: rustychris/schism