text:
%!TEX root = ../OGUSAdoc.tex

In this chapter, we define the stationary nonsteady-state equilibrium of the \ogindia model. Chapters \ref{Chap_Demog} through \ref{Chap_MarkClr} derive the equations that characterize the equilibrium of the model. We also need the steady-state solution from Chapter \ref{Chap_SSeqlb} to solve for the nonsteady-state equilibrium transition path. As with the steady-state equilibrium, we must use the stationarized version of the characterizing equations from Chapter \ref{Chap_Stnrz}.

\section{Stationary Nonsteady-State Equilibrium Definition}\label{SecEqlbNSSdef}

  We define a stationary nonsteady-state equilibrium as the following.

  \vspace{5mm}
  \hrule
  \vspace{-1mm}
  \begin{definition}[\textbf{Stationary Nonsteady-state functional equilibrium}]\label{DefNSSEql}
    A non autarkic nonsteady-state functional equilibrium in the \ogindia model is defined as stationary allocation functions of the state $\bigl\{n_{j,s,t} = \phi_s\bigl(\bm{\hat{\Gamma}}_t\bigr)\bigr\}_{s=E+1}^{E+S}$ and $\bigl\{\hat{b}_{j,s+1,t+1}=\psi_{s}\bigl(\bm{\hat{\Gamma}}_t\bigr)\bigr\}_{s=E+1}^{E+S}$ for all $j$ and $t$ and stationary price functions $\hat{w}(\bm{\hat{\Gamma}}_t)$ and $r(\bm{\hat{\Gamma}}_t)$ for all $t$ such that:
    \begin{enumerate}
      \item households have symmetric beliefs $\Omega(\cdot)$ about the evolution of the distribution of savings as characterized in \eqref{EqBeliefs}, and those beliefs about the future distribution of savings equal the realized outcome (rational expectations),
      \begin{equation*}
        \bm{\hat{\Gamma}}_{t+u} = \bm{\hat{\Gamma}}^e_{t+u} = \Omega^u\left(\bm{\hat{\Gamma}}_t\right) \quad\forall t,\quad u\geq 1
      \end{equation*}
      \item households optimize according to \eqref{EqStnrzHHeul_n}, \eqref{EqStnrzHHeul_b}, and \eqref{EqStnrzHHeul_b},
      \item firms optimize according to \eqref{EqStnrzFOC_L} and \eqref{EqFirmFOC_K},
      \item Government activity behaves according to \eqref{EqStnrzGovBC} and \eqref{EqStnrzClosureRule}, and
      \item markets clear according to \eqref{EqStnrzMarkClrLab}, \eqref{EqStnrzMarkClrCap}, and \eqref{EqStnrzMarkClrBQ}.
    \end{enumerate}
  \end{definition}
  \vspace{-2mm}
  \hrule
  \vspace{5mm}

\section{Stationary Nonsteady-state Solution Method}\label{SecEqlbNSSsoln}

  \renewcommand\theenumi{\arabic{enumi}}
  \renewcommand\theenumii{\alph{enumii}}
  \renewcommand\theenumiii{\roman{enumiii}}

  This section describes the solution method for the stationary nonsteady-state equilibrium described in Definition \ref{DefNSSEql}. We use the time path iteration (TPI) method. This method was originally outlined in a series of papers between 1981 and 1985\footnote{See \citet{AuerbachEtAl:1981,AuerbachEtAl:1983}, \citet{AuerbachKotlikoff:1983a,AuerbachKotlikoff:1983b,AuerbachKotlikoff:1983c}, and \citet{AuerbachKotlikoff:1985}.} and in the seminal book \citet[ch. 4]{AuerbachKotlikoff:1987} for the perfect foresight case and in \citet[Appendix II]{NishiyamaSmetters:2007} and \citet[Sec. 3.1]{EvansPhillips:2014} for the stochastic case. The intuition for the TPI solution method is that the economy is infinitely lived, even though the agents that make up the economy are not. Rather than recursively solving for equilibrium policy functions by iterating on individual value functions, one must recursively solve for the policy functions by iterating on the entire transition path of the endogenous objects in the economy (see \citet[ch. 17]{StokeyLucas1989}).

  The key assumption is that the economy will reach the steady-state equilibrium $\bm{\bar{\Gamma}}$ described in Definition \ref{DefSSEql} in a finite number of periods $T<\infty$ regardless of the initial state $\bm{\hat{\Gamma}}_1$. The first step in solving for the nonsteady-state equilibrium transition path is to solve for the steady-state using the method described in Section \ref{SecEqlbSSsoln}. After solving for the steady-state, one must then find a fixed point over the entire path of endogenous objects.  We do this by first making an initial guess at these objects in a the general equilibrium ``outer loop'' step, analogous to the outer loop described in the steady-state solution method. The time path iteration method then uses functional iteration to converge on a fixed point for the path of these objects.  The paths of aggregate variables that must be guessed in this outer loop are $\{\bm{r}^i,\bm{\hat{w}}^i,\bm{\hat{BQ}}^i, \bm{\hat{TR}}^i\}$, where $\bm{r}^i = \left\{r_1^i,r_2^i,...r_T^i\right\}$, $\bm{\hat{BQ}}^i = \left\{\hat{BQ}_1^i,\hat{BQ}_2^i,...\hat{BQ}_T^i\right\}$, and $\bm{\hat{TR}}^i = \left\{\hat{TR}_1^i,\hat{TR}_2^i,...\hat{TR}_T^i\right\}$. The only requirement on these transition paths is that the initial total bequests $\hat{BQ}_1^i$ conform to the initial state of the economy $\bm{\hat{\Gamma}}_1$, and that the economy has reached the steady-state by period $t=T$ $\{r_T^i, \hat{BQ}_T^i, \hat{TR}_T^i\} = \{\bar{r}, \bar{w}, \overline{BQ}, \overline{TR}\}$.

  The ``inner loop'' of the nonsteady-state transition path solution method is to solve for the full set of lifetime savings decisions $\bar{b}_{j,s+1,t+1}$ and labor supply decisions $\bar{n}_{j,s,t}$ for every household alive between periods $t=1$ and $t=T$.  To solve for the $2JS$ equations and unknowns for each household's lifetime decisions we use a multivariate root finder.

  We outline the stationary non-steady state solution algorithm in the following steps.

  \begin{enumerate}
    \item Compute the steady-state solution $\{\bar{n}_{j,s},\bar{b}_{j,s}\}_{s=E+1}^{E+S}$ corresponding to Definition \ref{DefSSEql}.

    \item Given initial state of the economy $\bm{\hat{\Gamma}}_1$ and steady-state solutions $\{\bar{n}_{j,s},\bar{b}_{j,s+1}\}_{s=E+1}^{E+S}$, guess transition paths of outer loop macroeconomic variables $\{\bm{r}^i,\bm{\hat{BQ}}^i, \bm{\hat{TR}}^i\}$ such that $\hat{BQ}_1^i$ is consistent with $\bm{\hat{\Gamma}}_1$ and $\{r_t^i, \hat{BQ}_t^i, \hat{TR}_t^i\} = \{\bar{r}, \overline{BQ}, \overline{TR}\}$ for all $t\geq T$.

    \item Given initial condition $\bm{\hat{\Gamma}}_1$, guesses for the aggregate time paths $\{\bm{r}^i,\bm{\hat{BQ}}^i, \bm{\hat{TR}}^i\}$, we solve for the inner loop lifetime decisions of every household that will be alive across the time path $\{n_{j,s,t},\hat{b}_{j,s+1,t+1}\}_{s=E+1}^{E+S}$ for all $j$ and $1\leq t\leq T$.
    \begin{enumerate}
      \item Given time path guesses $\{\bm{r}^i,\bm{\hat{BQ}}^i, \bm{\hat{TR}}^i\}$, we can compute the path of wages, $\bm{w}^i$ and then solve for each household's lifetime decisions $\{n_{j,s,t},\hat{b}_{j,s+1,t+1}\}_{s=E+1}^{E+S}$ for all $j$, $E+1\leq s \leq E+S$, and $1\leq t\leq T_2+S-1$.
      \begin{enumerate}
        \item The household problem can be solved with a multivariate root finder solving the $2S$ equations and unknowns at once for all $j$ and $1\leq t\leq T+S-1$. The root finder uses $2S$ household Euler equations \eqref{EqStnrzHHeul_n}, \eqref{EqStnrzHHeul_b}, and \eqref{EqStnrzHHeul_bS} to solve for each household's $2S$ lifetime decisions.
        \item After solving the first iteration of time path iteration, subsequent initial values for the $J$, $2S$ root finding problems are based on the solution in the prior iteration. This speeds up computation further and makes the initial guess for the highly nonlinear system of equations start closer to the solution value.
      \end{enumerate}
    \end{enumerate}
    \item Given partial equilibrium household nonsteady-state solutions $\{n_{j,s,t},\hat{b}_{j,s+1,t+1}\}_{s=E+1}^{E+S}$ for all $j$ and $1\leq t\leq T$ based on macroeconomic variable time path guesses $\{\bm{r}^i,\bm{\hat{BQ}}^i, \bm{\hat{TR}}^i\}$, compute new values for these aggregates implied by the households' solutions, $\{\bm{r}^{i'},\bm{\hat{BQ}}^{i'}, \bm{\hat{TR}}^{i'}\}$.
    \begin{enumerate}
          \item We solve for the updated interest rate as follows:
    		\begin{enumerate}
    			\item Use the guess at the path of total transfers, $\hat{TR}_{t}^{i}$ and the transfer spending rule given in Equation \eqref{EqUnbalGBCtfer} to find the implied path of GDP: $\hat{Y}_{t}^{i} = \frac{\hat{TR}_{t}^{i}}{\alpha_{tr}}$.
    			\item Using the path of GDP and the household savings and labor supply decisions, $\{n_{j,s,t},\hat{b}_{j,s+1,t+1}\}_{s=E+1}^{E+S}$, compute the path of stationarizaed total tax revenue, $\hat{Revenue}_{t}^{i}$.
    			\item Using the long-run debt-to-GDP ratio, the path of GDP, the path of total tax revenue, and Equation \eqref{EqUnbalGBCclosure_Gt}, find the path of stationarized government debt, $\hat{D}_{t}^{i}$.
    			\item Use the capital market clearing condition from Equation \eqref{EqStnrzMarkClrCap} and $D_{t}^{i}$ to find aggregate capital in each period,

    			\begin{equation*}
    				\hat{K}_{t}^{i}=\frac{1}{1 + g_{n,t}}\sum_{s=E+2}^{E+S+1}\sum_{j=1}^{J}\Bigl(\omega_{s-1,t-1}\lambda_j \hat{b}_{j,s,t} + i_s\omega_{s,t}\lambda_j \hat{b}_{j,s,t}\Bigr) - D_{t}^{i}
    			\end{equation*}

    		\item Use the labor market clearing condition from Equation \eqref{EqStnrzMarkClrLab} to find the path of aggregate labor supply:

    			\begin{equation*}
    				\hat{L}_{t}^{i}=\sum_{s=E+1}^{E+S}\sum_{j=1}^{J} \omega_{s,t}\lambda_j e_{j,s}n_{j,s,t}
    			\end{equation*}

    		\item Use the firm's production function from Equation \eqref{EqStnrzCESprodfun} to compute an updated value of $\hat{Y}_{t}$ given the values for the factors of production:

    		\begin{equation*}
    			\hat{Y}_{t}^{i'} = Z_{t}\biggl[(\gamma)^\frac{1}{\ve}(\hat{K}_{t}^{i})^\frac{\ve-1}{\ve} + (1-\gamma)^\frac{1}{\ve}(\hat{L}_{t}^{i})^\frac{\ve-1}{\ve}\biggr]^\frac{\ve}{\ve-1}
    		\end{equation*}

    		\item Use the firm's first order condition for its choice of capital to find the updated path of interest rates,

    		\begin{equation*}
    			r_{t}^{i'} = (1 - \tau_{t}^{corp})(Z_{t})^\frac{\ve-1}{\ve}\left[\gamma\frac{\hat{Y}_{t}^{i'}}{\hat{K}_{t}^{i}}\right]^\frac{1}{\ve} - \delta + \tau_{t}^{corp}\delta_{t}^\tau
    		\end{equation*}

    	\end{enumerate}

    	\item The stationarized law of motion for total bequests \eqref{EqStnrzMarkClrBQ} provides the expression in which household savings decisions $\{b_{j,s+1,t+1}\}_{s=E+1}^{E+S}$ imply a value for aggregate bequests, $BQ_{t}^{\,i'}$. When computing aggregate bequests, we use the updated path of interest rates found above.
    		\begin{equation*}
    			\hat{BQ}_{t}^{\,i'} = \left(\frac{1+r_{t}^{i'}}{1 + g_{n,t}}\right)\left(\sum_{s=E+2}^{E+S+1}\sum_{j=1}^J\rho_{s-1}\lambda_j\omega_{s-1,t-1}\hat{b}_{j,s,t}\right)
    		\end{equation*}

    	\item In equation \eqref{EqStnrzTfer}, we defined total household transfers as a fixed percentage of GDP ($\hat{TR}_t=\alpha_{tr}\hat{Y}_t$).  To find the updated value for transfers, we find the amount of transfers implied by the most updated value of GDP, $\hat{TR}_{t}^{i'}=\alpha_{tr}\hat{Y}_{t}^{i'}$.

	\end{enumerate}
	\item The updated values for the outer loop variables are then used to compute the percentage differences between the initial and implied values:
		\begin{enumerate}
			\item $error_r = max\left\{\frac{r_{t}^{i'} - r_{t}^i}{r_{t}^i}\right\}_{t=0}^{T}$
			\item $error_{bq} =  max\left\{\frac{\hat{BQ}_{t}^{\,i'} - \hat{BQ}_{t}^{\,i}}{\hat{BQ}_{t}^{\,i}}\right\}_{t=0}^{T}$
			\item $error_{tr} = \left\{\frac{\hat{TR}_{t}^{\,i'} - \hat{TR}_{t}^{\,i}}{\hat{TR}_{t}^{\,i}}\right\}_{t=0}^{T}$
		\end{enumerate}
	\item If the maximum absolute error among the three outer loop error terms is greater than some small positive tolerance $toler_{tpi,out}$,
		\begin{equation*}
			\max\big|\left(error_r,error_{bq},error_{tr},error_f\right)\bigr| > toler_{tpi,out}
		\end{equation*}
	then update the guesses for the outer loop variables as a convex combination governed by $\xi_{tpi}\in(0,1]$ of the respective initial guesses and the new implied values and repeat steps (3) through (5).
	\begin{equation*}
		\begin{split}
			\left[\bm{r}^{i+1},\bm{\hat{BQ}}^{\,i+1},\bm{\hat{TR}}^{\,i+1}\right] &= \xi_{tpi}\left[\bm{r}^{i'},\bm{\hat{BQ}}^{\,i'},\bm{\hat{TR}}^{\,i'}\right] + \\
			&\qquad(1-\xi_{tpi})\left[\bm{r}^{i},\bm{\hat{BQ}}^{\,i},\bm{\hat{TR}}^{\,i}\right]
		\end{split}
	\end{equation*}
	\item If the maximum absolute error among the five outer loop error terms is less-than-or-equal-to some small positive tolerance $toler_{tpi,out}$ in each period along the transition path,
		\begin{equation*}
			\max\big|\left(error_r,error_{bq},error_{tr},error_f\right)\bigr| \leq toler_{tpi,out}
		\end{equation*}
	then the non-steady-state equilibrium has been found.
		\begin{enumerate}
			\item Make sure that the resource constraint (goods market clearing) \eqref{EqStnrzMarkClrGoods} is satisfied in each period along the time path. It is redundant, but this is a good check as to whether everything worked correctly.
			\item Make sure that the government budget constraint \eqref{EqStnrzGovBC} binds.
			\item Make sure that all the $(T+S)\times2JS$ household Euler equations are solved to a satisfactory tolerance.
		\end{enumerate}
  \end{enumerate}

  \renewcommand\theenumi{\roman{enumi}}

\section{Baseline Nonsteady-state Results}\label{SecNSSeqlbResults}

  asdf


text:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% "ModernCV" CV and Cover Letter
% LaTeX Template
% Version 1.2 (25/3/16)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Xavier Danaux (xdanaux@gmail.com) with modifications by:
% Vel (vel@latextemplates.com)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
% Important note:
% This template requires the moderncv.cls and .sty files to be in the same
% directory as this .tex file. These files provide the resume style and themes
% used for structuring the document.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%	PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[10pt,a4paper,roman]{moderncv} % Font sizes: 10, 11, or 12; paper sizes: a4paper, letterpaper, a5paper, legalpaper, executivepaper or landscape; font families: sans or roman

\moderncvstyle{casual} % CV theme - options include: 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{black} % CV color - options include: 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'

\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
\usepackage{color}
\usepackage[scale=0.75]{geometry} % Reduce document margins
%\usepackage[top=1.5in, bottom=1.5in, left=1.5in, right=1.5in, footskip=0.66in]{geometry}
\setlength{\hintscolumnwidth}{3.3cm} % Uncomment to change the width of the dates column
%\setlength{\makecvtitlenamewidth}{7cm} % For the 'classic' style, uncomment to adjust the width of the space allocated to your name
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, norsk]{babel}
\usepackage{hyperref}
\usepackage{xcolor}

%----------------------------------------------------------------------------------------
%	NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------

\firstname{F.Ceren} % Your first name
\familyname{Ay} % Your last name

% All information in this block is optional, comment out any lines you don't need
\title{Curriculum Vitae}
\address{Norwegian School of Economics-Department of Economics}{ Helleveien 30, 5045,Bergen, Norway}
%\mobile{+41 (0) 76 534 08 17}
\phone{+47 92 25 66 45}
\email{Fehime.ay@nhh.no}
%\homepage{https://wwz.unibas.ch/personen/profil/person/roth/}{https://wwz.unibas.ch/personen/profil/person/roth/} % The first argument is the url for the clickable link, the second argument is the url displayed in the template - this allows special characters to be displayed such as the tilde in this example
%\extrainfo{additional information}
%\photo[70pt][0.4pt]{pictures/picture} % The first bracket is the picture height, the second is the thickness of the frame around the picture (0pt for no frame)
%\quote{"A witty and playful quotation" - John Smith}

%----------------------------------------------------------------------------------------

\begin{document}
%\color{gray}
%----------------------------------------------------------------------------------------
%	COVER LETTER
%----------------------------------------------------------------------------------------

% To remove the cover letter, comment out this entire block

%\clearpage
%
%\recipient{HR Department}{Corporation\\123 Pleasant Lane\\12345 City, State} % Letter recipient
%\date{\today} % Letter date
%\opening{Dear Sir or Madam,} % Opening greeting
%\closing{Sincerely yours,} % Closing phrase
%\enclosure[Attached]{curriculum vit\ae{}} % List of enclosed documents
%
%\makelettertitle % Print letter title
%
%\lipsum[1-3] % Dummy text
%
%\makeletterclosing % Print letter signature
%
%\newpage

%----------------------------------------------------------------------------------------
%	CURRICULUM VITAE
%----------------------------------------------------------------------------------------

\makecvtitle % Print the CV title
\section{Personal Information}
%\cvitem{Affiliation}{Bocconi University - Department of Accounting}
%\cvitem{E-mail}{mert.erinc@phd.unibocconi.it}
\cvitem{Citizenship}{Turkish}
\cvitem{Date of Birth}{11 April 1991}
\cvitem{Web Page:}{\href{https://cerenay.github.io}{\color{blue}cerenay.github.io}}
%----------------------------------------------------------------------------------------
%	EDUCATION SECTION
%----------------------------------------------------------------------------------------
\section{Research Interests}
\cvitem{}{Behavioral Economics, Experimental Economics, Self and Social Image Effects,
Information Preferences, Social Decisions}
%----------------------------------------------------------------------------------------
%	Employment
%----------------------------------------------------------------------------------------

\section{Employment}

\cvitem{10/2020- today}{Part Time Lecturer at Norwegian School of Economics(NHH), Department
of Economics}
\cvitem{08/2016- today}{PhD Research Scholar at Norwegian School of Economics(NHH), Department
of Economics, FAIR - The Choice Lab}

\cvitem{10/2014-08/2016}{Research Assistant at Istanbul University- Faculty of Economics}

  % Arguments not required can be left empty
%----------------------------------------------------------------------------------------
%	EDUCATION SECTION
%----------------------------------------------------------------------------------------

\section{Education}

\cvitem{08/2016 - 12/2020(Expected)}{ PhD in Economics at NHH - Department of Economics, FAIR - The Choice Lab
supervised by Erik \O iolf S\o rensen
\textit{(External supervisor: Pedro Dal B\'{o})}}

\cvitem{01/2019 -- 06/2019}{Visiting Researcher - Brown University, Department of Economics, USA \newline
\textit{Host: Louis Putterman}}
%\cvitem{Research Visit - Brown University (January 2019 - June 2019)}}

\cvitem{09/2014 - 07/2016}{Master of Arts in Economics, Galatasaray University \newline
	\textit{ Thesis: "A Voting Experiment on Promises and Fairness Perceptions"}}

\cvitem{09/2009 - 01/2014}{ Bachelor of Arts in Economics, Hacettepe University\newline
    \textit{Thesis:  "Game Theoretical Approach to Tax Evasion and Vickrey-Clark-Groves Mechanism"}}

%\cvitem{2011 -- 2012}{Exchange Program - Antwerp University, Belgium}

%\cvitem{2009 -- 2013}{Bachelor of Arts in Business Administration, Marmara University, Turkey \newline
%	\textit{Major: `` Accounting and Finance'' }}

\newpage
\section{Research}
\cvitem{Work in Progress}{\textbf{Information Avoidance and Image Concerns in Reciprocal Decisions}}
\cvitem{}{\textit{This paper provides evidence on strategic use of information to dampen moral pressure when making decisions. Strategic use of information refers to people actively avoiding or acquiring information rather than exogenously given setting. In a manipulated trust game two aspects of information about the consequences of the decision is varied: time of the information and exogenous information / ignorance. Results show that when people make decisions under exogenous ignorance, reciprocity drops substantially compared to the settings with exogenous information. When people are given the chance to choose whether to know or not to know the consequences of their decisions, there is a clear relation between more selfish decisions and information avoidance. Contrary to previous literature, this pattern is observed both before making the decision (ex-ante) and after the decision is already made (ex-post). This provides evidence on the psychological utility of information by signalling the prosociality to one's self both in ex-ante and ex-post perspective. This study provides an insightful view on information preferences in a relatively complex social settings by showing how information preferences are used to make more selfish decisions.}}
%\cvitem{Progress:}{\textit{Currently writing - Data collection is completed in October 2018}}

\cvitem{Work in Progress}{\textbf{Strategic Curiosity - joint with Katrine B. Nødvedt (NHH) and Joel Berge (NHH)}}
\cvitem{}{\textit{This study provides experimental evidence on a novel phenomenon in information preferences: people strategically collect additional non-instrumental information to justify morally questionable decisions. We conduct a virtual dice-rolling experiment in which we vary the extent to which participants can collect additional information before reporting as well as the content of information. We document a tendency to systematically collect more information \textit{-be more curious-} when tempted to misreport. Curiosity is positively correlated with the size of the lie. Interestingly, neither curiosity nor dishonesty respond to the content of information as people roll the dice and misreport to the same extent even when information is irrelevant to the decision. Our study provides new insights into how individuals actively shape their information environment in pursuit of self-interest. }}
%\cvitem{Progress:}{\textit{Currently writing - Data collection is completed in August 2019}}

\cvitem{Work in Progress}{\textbf{Reasoning Avoidance - joint with Hallgeir Sj\aa stad (NHH) and Steven Sloman (Brown University)}}
\cvitem{}{\textit{This research project aims to investigate individuals' behavior when they are asked to explain a spurious relation between a main event and a side effect which can potentially challenge existing beliefs on the main event in an experimental setup. The main contribution of the present research is showing how causal relations can be misconceived by individuals when they challenge the beliefs and preferences about the main event -policy.}}

%\cvitem{Work in Progress}{\textbf{Self-Image Considerations in the Provision of Helpful Feedback - joint with Stefan Mei{\ss}ner (NHH)}}
%\cvitem{}{\textit{The goal of the project is to see how individuals view others' self-image concerns and information avoidance decision and is that view affected by the material and ego utility/disutility of the information}}

%\cvitem{Work in Progress}{\textbf{Perform Better Under Self-selected Incentives? A Study on Performance Effects of Self-selection of Incentive Choice -joint with Xiaogeng Xu (Hanken School of Economics)}}
%\cvitem{}{\textit{This study aims to explore the role of self-selection of incentive in performance with a lab experiment where participants perform a task with real efforts. Piece-rate payment and incentives for performance are either selected by the workers themselves, or exogenously imposed.}}

\cvitem{Work in Progress}{\textbf{An International Collaboration on Social and Moral Psychology of Covid-19 - joint with Jay van Bavel and others}}
\cvitem{}{\textit{The goal of this collaboration is to bring together scholars from around the globe to examine psychological factors underlying the attitudes and behavioral intentions related to Covid-19. To date, data from over 44.000 citizens in 67 countries are collected.}
\href{https://psyarxiv.com/ydt95}{\color{blue}Working Paper} and \href{https://icsmp-covid19.netlify.app}{\color{blue}Project website}}

\newpage
\section{Presentations at Conferences and Seminars}
\cvitem{November 2019}{Joint PhD Workshop NHH and University of Bergen (NHH Bergen, Norway)}
\cvitem{September 2019}{PhD Course with Lise Vesterlund - Identification Through Experiments (NHH, Bergen Norway)}
\cvitem{April 2019}{Brown Bag Seminar (Brown University, Sloman Lab, Providence, USA)}
\cvitem{March 2019}{Spring School in Behavioral Economics - Poster Session (Rady School of Management, UC San Diego, USA)}
\cvitem{January 2019}{Brown Bag Seminar (Brown University, Department of Economics, Providence, USA)}
\cvitem{November 2018}{Joint PhD Workshop NHH and University of Bergen (NHH Bergen, Norway)}
\cvitem{June 2018}{FAIR Inaugural Conference - Poster Session (NHH, Bergen, Norway)}
\cvitem{June 2016}{7th International Conference of the French Association of Experimental Economics (Essec Business School, Cergy, France)}
%----------------------------------------------------------------------------------------
%	WORK EXPERIENCE SECTION
%----------------------------------------------------------------------------------------
%\section{Awards and Scholarships}
%\cvitem{2016 - present}{PhD Scholarship, Bocconi University}
\section{Workshop Attendance}
\cvitem{July 2019}{2nd briq Summer School in Behavioral Economics, University of Bonn}
\cvitem{March 2019}{Spring School in Behavioral Economics, Rady School of Management, UC San Diego, US}
\section{Teaching Assistance}
\cvitem{Spring 2020}{Behavioral Economics, NHH}
\cvitem{Fall 2019}{Econometric Techniques, NHH}
\cvitem{Fall 2018}{Human Capital, Mobility and Diversity in Firms, NHH}
\cvitem{Fall 2018}{Econometric Techniques, NHH}
\cvitem{Spring 2018}{Long Term Macroeconomic Analysis, NHH}
\cvitem{Fall 2017}{Ethics and Diversity in Firms, NHH}

\section{Languages and Skills}
\cvitem{Languages}{Turkish (native), English (fluent), Norwegian (intermediate)}
\cvitem{Software}{ Latex, Mathematica, oTree, Python, R, Stata, zTree}

\section{PhD Courses}
\cvitem{}

\section{Academic References}

\cvitem{Prof. Erik \O iolf
S\o rensen}{NHH - Department of Economics, FAIR-The Choice Lab,   \hspace{10em} \strut\hspace{0.5em}
Helleveien 30, 5045, Bergen, Norway \hspace{15em} \strut    \hspace{5em}
erik.sorensen@nhh.no}

\cvitem{Prof. Bertil
Tungodden}{NHH - Department of Economics, FAIR-The Choice Lab,   \hspace{10em} \strut    \hspace{0.5em}
Helleveien 30, 5045, Bergen, Norway \hspace{15em} \strut    \hspace{5em}
bertil.tungodden@nhh.no}

%\cvitem{Prof. Alexander Cappelen}{NHH - %Department of Economics, FAIR-The Choice Lab,   %\hspace{10em} \strut    \hspace{0.5em}
%Helleveien 30, 5045, Bergen, Norway %\hspace{15em} \strut    \hspace{5em}
%alexander.cappelen@nhh.no}

\cvitem{Prof. Louis Putterman}{Brown University - Department of Economics,   \hspace{12em} \strut    \hspace{0.5em}
70 Waterman Street, Providence, RI 02912, USA \hspace{8em} \strut    \hspace{0em}
louis\_putterman@brown.edu}

\cvitem{Prof. Pedro
Dal B\'{o}}{Brown University - Department of Economics,   \hspace{13em} \strut    \hspace{10em}
70 Waterman Street, Providence, RI 02912, USA \hspace{8em} \strut    \hspace{0em}
pedro\_dal\_bo@brown.edu}

%\cvitem{Assoc. Prof. Bilge {\"O}zt{\"u}rk G{\"o}ktuna}{Galatasaray University, Department of Economics,
%\hspace{12em} \strut    \hspace{0.5em}
%Ortakoy Mh., Ciragan Cd. No:36, 34349, Besiktas,Istanbul  \hspace{8em} \strut
%    \hspace{0em}
%bozturk@gsu.edu.tr}

%\cvitem{Assoc. Prof. Mehmet Yi\u{g}it G{\"u}rdal} {Bogazici University, Department of Economics,
%\hspace{12em} \strut    \hspace{0.5em}
%Bebek Mh., 34342, Besiktas, Istanbul  \hspace{15em}
%\strut  \hspace{5em}
%mehmet.gurdal@boun.edu.tr}

%----------------------------------------------------------------------------------------
%	WORK EXPERIENCE SECTION
%----------------------------------------------------------------------------------------
%
%\section{Experience}
%
%\subsection{Vocational}
%
%\cventry{2012--Present}{1\textsuperscript{st} Year Analyst}{\textsc{Lehman Brothers}}{Los Angeles}{}{Developed spreadsheets for risk analysis on exotic derivatives on a wide array of commodities (ags, oils, precious and base metals), managed blotter and secondary trades on structured notes, liaised with Middle Office, Sales and Structuring for bookkeeping.
%\newline{}\newline{}
%Detailed achievements:
%\begin{itemize}
%\item Learned how to make amazing coffee
%\item Finally determined the reason for \textsc{PC LOAD LETTER}:
%\begin{itemize}
%\item Paper jam
%\item Software issues:
%\begin{itemize}
%\item Word not sending the correct data to printer
%\item Windows trying to print in letter format
%\end{itemize}
%\item Coffee spilled inside printer
%\end{itemize}
%\item Broke the office record for number of kitten pictures in cubicle
%\end{itemize}}
%
%%------------------------------------------------
%
%\cventry{2010--2011}{Summer Intern}{\textsc{Lehman Brothers}}{Los Angeles}{}{Rated "truly distinctive" for Analytical Skills and Teamwork.}
%
%%------------------------------------------------
%
%\subsection{Miscellaneous}
%
%\cventry{2008--2009}{Computer Repair Specialist}{Buy More}{Burbank}{}{Worked in the Nerd Herd and helped to solve computer problems by asking customers to turn their computers off and on again.}

%----------------------------------------------------------------------------------------
%	COMPUTER SKILLS SECTION
%----------------------------------------------------------------------------------------
%
%\section{Computer skills}
%
%\cvitem{Basic}{\textsc{java}, Adobe Illustrator}
%\cvitem{Intermediate}{\textsc{python}, \textsc{html}, \LaTeX, OpenOffice, Linux, Microsoft Windows}
%\cvitem{Advanced}{Computer Hardware and Support}
%
%%----------------------------------------------------------------------------------------
%%	COMMUNICATION SKILLS SECTION
%%----------------------------------------------------------------------------------------
%
%\section{Communication Skills}
%
%\cvitem{2010}{Oral Presentation at the California Business Conference}
%\cvitem{2009}{Poster at the Annual Business Conference in Oregon}
%
%%----------------------------------------------------------------------------------------
%%	LANGUAGES SECTION
%%----------------------------------------------------------------------------------------
%
%\section{Languages}
%
%\cvitemwithcomment{English}{Mothertongue}{}
%\cvitemwithcomment{Spanish}{Intermediate}{Conversationally fluent}
%\cvitemwithcomment{Dutch}{Basic}{Basic words and phrases only}
%
%%----------------------------------------------------------------------------------------
%%	INTERESTS SECTION
%%----------------------------------------------------------------------------------------
%
%\section{Interests}
%
%\renewcommand{\listitemsymbol}{-~} % Changes the symbol used for lists
%
%\cvlistdoubleitem{Piano}{Chess}
%\cvlistdoubleitem{Cooking}{Dancing}
%\cvlistitem{Running}
%
%%----------------------------------------------------------------------------------------

\end{document}

ext: tex

max_stars_repo_path: assets/pdf/Ay_CV copy.tex

max_issues_repo_path: assets/pdf/Ay_CV copy.tex

max_forks_repo_path: assets/pdf/Ay_CV copy.tex


text:
\documentclass{article} % For LaTeX2e
\usepackage[dvipdfmx]{graphicx}
\usepackage{bm}
\usepackage{nips14submit_e,times}
%\usepackage{hyperref}
\usepackage{url}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[numbers]{natbib}
\usepackage{enumitem}
\usepackage{amsmath}  % required if you use \overset
%\documentstyle[nips14submit_09,times,art10]{article} % For LaTeX 2.09
\usepackage{array}
\newtheorem{proposition}{Proposition}
\newtheorem{lemma}{Lemma}
\newtheorem{corollary}{Corollary}
\newtheorem{theorem}{Theorem}
\newtheorem*{thmnonumber}{Theorem}

% For algorithms
\usepackage{algorithm}
\usepackage{algorithmic}

\usepackage{graphicx}
%\usepackage{wrapfigure}
%\usepackage{savetrees}
% Packages hyperref and algorithmic misbehave sometimes.  We can fix
% this with the following command.
\newcommand{\theHalgorithm}{\arabic{algorithm}}

\title{Generative Adversarial Nets}

\author{
Ian J. Goodfellow,
\ \  Jean Pouget-Abadie\thanks{Jean Pouget-Abadie is visiting Universit\'e de Montr\'eal from Ecole Polytechnique.
},\ \  Mehdi Mirza,\ \  Bing Xu,\ \ David Warde-Farley,\\
{\bf Sherjil Ozair\thanks{Sherjil Ozair is visiting Universit\'e de Montr\'eal from Indian Institute of Technology Delhi},\ \ Aaron Courville,\ \ Yoshua Bengio\thanks{Yoshua Bengio is a CIFAR Senior Fellow.}}\\
D\'epartement d'informatique et de recherche op\'erationnelle\\
Universit\'e de Montr\'eal\\
Montr\'eal, QC H3C 3J7 \\
}

% The \author macro works with any number of authors. There are two commands
% used to separate the names and addresses of multiple authors: \And and \AND.
%
% Using \And between authors leaves it to \LaTeX{} to determine where to break
% the lines. Using \AND forces a linebreak at that point. So, if \LaTeX{}
% puts 3 of 4 authors names on the first line, and the last on the second
% line, try using \AND instead of \And before the third author name.

\newcommand{\fix}{\marginpar{FIX}}
\newcommand{\new}{\marginpar{NEW}}

\nipsfinalcopy % Uncomment for camera-ready version

\begin{document}

\maketitle

\begin{abstract}
We propose a new framework for estimating generative models
via an adversarial process, in which we simultaneously train
two models: a generative model $G$ that captures the data
distribution, and a discriminative model $D$ that estimates the
probability that a sample came from the training data rather than $G$.
The training procedure for $G$ is to maximize the probability of $D$ making
a mistake. This framework corresponds to a minimax two-player game. In the
space of arbitrary functions $G$ and $D$, a unique solution exists, with $G$
recovering the training data distribution and $D$ equal to $\frac{1}{2}$
everywhere. In the case where $G$ and $D$ are defined by multilayer perceptrons,
the entire system can be trained with backpropagation. There is no need for any Markov chains
or unrolled approximate inference networks during either training or generation
of samples. Experiments demonstrate the potential of the framework
through qualitative and quantitative evaluation of the generated
samples.
\end{abstract}

\section{Introduction}

The promise of deep learning is to discover rich, hierarchical models~\citep{Bengio-2009-book} that represent
probability distributions over the kinds of data encountered in artificial intelligence applications,
 such as natural images, audio waveforms containing speech, and symbols in natural language corpora.
So far, the most striking successes in deep learning have involved discriminative models,
usually those that map a high-dimensional, rich sensory input to a class
label~\citep{Hinton-et-al-2012,Krizhevsky-2012-small}. These
striking successes have primarily been based on the backpropagation and dropout algorithms, using
piecewise linear units
~\cite{Jarrett-ICCV2009,Glorot+al-AI-2011-small,Goodfellow_maxout_2013} which have a particularly well-behaved gradient
. Deep {\em generative} models have had less of an impact, due to the difficulty of approximating
many intractable probabilistic computations that arise in maximum likelihood estimation and
related strategies, and due to difficulty of leveraging the benefits of piecewise linear units in
the generative context. We propose a new generative model estimation procedure that sidesteps these difficulties.
\footnote{All code and hyperparameters available at \url{http://www.github.com/goodfeli/adversarial}}

In the proposed {\em adversarial nets} framework, the generative model is pitted against an
adversary: a discriminative model that learns to determine whether a sample is
from the model distribution or the data distribution. The generative model can be thought of
as analogous to a team of counterfeiters, trying to produce fake currency and use it without
detection, while the discriminative model is analogous to the police, trying to detect the
counterfeit currency. Competition in this game drives both teams to improve their methods until the counterfeits
are indistiguishable from the genuine articles.

This framework can yield specific training algorithms for many kinds of model and optimization
algorithm. In this article, we explore the special case when the generative model generates
samples by passing random noise through a multilayer perceptron, and the discriminative model
is also a multilayer perceptron. We refer to this special case as {\em adversarial nets}.
In this case, we can train both models using only
the highly successful backpropagation and dropout algorithms~\citep{Hinton-et-al-arxiv2012}
and sample from the generative
model using only forward propagation. No approximate inference or Markov chains are necessary.

\section{Related work}
\label{sec:related}

%
% In principle, an SBN could be trained using AMF using an appropriate estimator of the gradient
% (basically to ``back-prop'' through stochastic binary units), e.g., using the REINFORCE
% algorithm~\citep{Williams-1992} or other variants such as previously explored by~\citet{bengio2013estimating}.
% On the other hand, as we show here, a generative network similar to an SBN but with continuous latent variables
% can be trained using AMF.

% I THINK WE SHOULD BE VERY CAREFUL NOT TO BE TOO CRITICAL OF ALL THE PREVIOUS APPROACHES.
% the way I would put it is that unsupervised learning of generative models is fundamentally hard,
% and that many different approaches have been explored in the past, yet without a breakthrough
% similar to what we have seen with supervised deep nets. What we offer here is the possibility
% of a completely different approach, which sidesteps issues that may hurt some (but not all)
% of the other approaches.

% YB: not necessary

An alternative to directed graphical models with latent variables are undirected graphical models
with latent variables, such as restricted Boltzmann machines (RBMs)~\citep{Smolensky86,Hinton06},
deep Boltzmann machines (DBMs)~\citep{Salakhutdinov+Hinton-2009-small} and their numerous variants.
The interactions within such models are represented as the product of
unnormalized potential functions, normalized by a global
summation/integration over all states of the random variables.
This quantity (the \textit{partition function}) and
its gradient are intractable for all but the most trivial
instances, although they can be estimated by Markov chain Monte
Carlo (MCMC) methods. Mixing poses a significant problem for learning
algorithms that rely on
MCMC~\citep{Bengio-et-al-ICML2013,Bengio-et-al-ICML2014}.
% many typical transition operators are very local, making it difficult
% to cross deserts of low probability that can exist between modes.
% Tempering methods have been proposed to
% handle this
% problem~\citep{Neal94b,Desjardins+al-2010,Cho10IJCNN,Salakhutdinov-ICML2010},
% although rejected swaps and the requirement of maintaining several
% parallel Markov chains at different temperatures renders these methods
% computationally expensive in practice.

Deep belief networks (DBNs)~\citep{Hinton06} are hybrid models containing a single undirected layer and several directed layers.
While a fast approximate layer-wise training criterion exists, DBNs incur the computational
difficulties associated with both undirected and directed models.

Alternative criteria that do not approximate or bound
the log-likelihood have also been proposed, such as score matching~\citep{Hyvarinen-2005-small}
and noise-contrastive estimation (NCE)~\citep{Gutmann+Hyvarinen-2010-small}.
Both of these require the learned probability density to be analytically specified
up to a normalization constant. Note that in many interesting generative models with several
layers of latent variables (such as
DBNs and DBMs), it is not even possible to derive a tractable unnormalized probability density.
Some models such as denoising auto-encoders~\citep{VincentPLarochelleH2008-small} and contractive
autoencoders have learning rules very similar to score matching applied to RBMs.
In NCE, as in this work, a discriminative training criterion is
employed to fit a generative model. However, rather than fitting a separate discriminative
model, the generative model itself is used to discriminate generated data from samples
a fixed noise distribution. Because NCE uses a fixed noise distribution, learning slows
dramatically after the model has learned even an approximately correct distribution over
a small subset of the observed variables.

%Noise-contrastive estimation is similar in spirit to the AMF, in that one trains a classifier that
%distinguishes the generated data from another distribution but maximizes the
%probability that the classifier gives to training examples being classified
%as coming from the learned model. A major difference with the AMF is that
%the NCE framework requires the learned probabilistic model of the data
%to be formulated in terms of an unnormalized probability (from an
%observation $x$ to an unnormalized probability $p$). Instead,
%with the AMF, the learned model is formulated as a generative procedure,
%as a function from randomly generated noise $z$ to a generated sample $x$.
%In addition, with the AMF, one learns to distinguish the training data from
%the generated data (instead of from a broad prior distribution), which we suspect
%should yield faster statistical convergence. This relates, in spirit,
%to the log-likelihood gradient (as realized e.g. in Boltzmann
%machines): increase the propensity of the generator to
%produce samples like those in the training set while decreasing its propensity
%to produce samples like those it currently produces. When these two forces
%reach an equilibrium, it means that the generated samples are indistinguishable
%from the training examples, according to the model.
%

Finally, some techniques do not involve defining a probability distribution explicitly,
but rather train a generative machine to draw samples from the desired distribution.
This approach has the advantage that such machines can be designed to be trained by
back-propagation. Prominent recent work in this area includes the generative stochastic network
(GSN) framework~\citep{Bengio-et-al-ICML2014}, which extends generalized denoising
auto-encoders~\citep{Bengio-et-al-NIPS2013}: both can be seen as defining a
parameterized Markov chain, i.e., one learns the parameters of a machine that
performs one step of a generative Markov chain.
Compared to GSNs, the adversarial nets framework does not require a Markov chain for
sampling. Because adversarial nets do not require feedback loops during generation,
they are better able to leverage piecewise linear
units~\cite{Jarrett-ICCV2009,Glorot+al-AI-2011-small,Goodfellow_maxout_2013},
which improve the performance of backpropagation but have problems with unbounded activation when used ina feedback loop.
%In the case of GSNs, the generative
%network is a recurrent network with noise injected in the input and hidden
%units, which outputs sampled values at each step of the recurrence (which
%corresponds to a step of a Markov chain).
%The idea of parameterizing
%continuous latent variables as deterministic functions to allow the application
%of backpropagation learning
%%%%into them and integrate over the noise variables rather than over the latent variables
%has been independently proposed by several
%authors~\citep{bengio2013estimating,Bengio+Laufer-arxiv-2013,Kingma-arxiv2013,Kingma+Welling-arxiv2014}.
%The idea of the change of variable to enable the computation of derivatives
%through statistical models actually dates back decades in the statistical
%literature~\citet{Price-1958,Bonnet-1964}.
More recent examples of training a generative machine by back-propagating into it
include recent work on auto-encoding variational Bayes~\citep{Kingma+Welling-ICLR2014}
and stochastic backpropagation~\citep{Rezende-et-al-arxiv2014}.
%In both
%cases one maximizes a variational lower bound on the log-likelihood that is
%rewritten as two terms: one that is just reconstruction log-likelihood
%through a stochastic encoder (approximate inference) - decoder (generative model) pair, and
%one that regularizes the output of the approximate inference stochastic encoder so that
%its marginal distribution matches the generative prior on the latent variables (and the
%latter can also trained, to match the marginal of the encoder output).

%\vfill
\section{Adversarial nets}

The adversarial modeling framework is most straightforward to apply when the models are both
multilayer perceptrons. To learn the generator's distribution $p_g$ over data $\bm{x}$, we
define a prior on input noise variables $p_{\bm{z}}(\bm{z})$, then represent a
mapping to data space as $G(\bm{z}; \theta_g)$, where $G$ is a differentiable function
represented by a multilayer perceptron with parameters $\theta_g$. We also define a second
multilayer perceptron $D(\bm{x}; \theta_d)$ that outputs a single scalar. $D(\bm{x})$ represents
the probability that $\bm{x}$ came from the data rather than $p_g$. We train $D$ to maximize the
probability of assigning the correct label to both training examples and samples from $G$.
We simultaneously train $G$ to minimize $\log(1-D(G(\bm{z})))$:

In other words, $D$ and $G$ play the following two-player minimax game with value function $V(G, D)$:

\begin{equation}
\label{eq:minimaxgame-definition}
\min_G \max_D V(D, G) = \mathbb{E}_{\bm{x} \sim p_{\text{data}}(\bm{x})}[\log D(\bm{x})] + \mathbb{E}_{\bm{z} \sim p_{\bm{z}}(\bm{z})}[\log (1 - D(G(\bm{z})))].
\end{equation}

In the next section, we present a theoretical analysis of adversarial nets,
essentially showing that the training criterion allows one to recover the data
generating distribution as $G$ and $D$ are given enough capacity, i.e., in the
non-parametric limit. See Figure~\ref{fig:intuition} for a less formal, more pedagogical
explanation of the approach.
In practice, we must implement the game using an iterative, numerical approach. Optimizing $D$ to completion in the
inner loop of training is computationally prohibitive,
and on finite datasets would result in overfitting. Instead, we alternate between $k$ steps
of optimizing $D$ and one step of optimizing $G$. This results in $D$ being maintained
near its optimal solution, so long as $G$ changes slowly enough. This strategy is analogous
to the way that SML/PCD~\citep{Younes1999,Tieleman08} training maintains samples from a Markov chain from one
learning step to the next in order to avoid burning in a Markov chain as part of the inner loop
of learning. The procedure is formally presented
in Algorithm~\ref{alg:AGF}.

In practice, equation~\ref{eq:minimaxgame-definition} may not provide sufficient gradient for $G$ to learn
well. Early in learning, when $G$ is poor, $D$ can reject samples with high confidence because they are
clearly different from the training data. In this case, $\log ( 1- D(G(\bm{z})))$ saturates. Rather than
training $G$ to minimize $\log (1 - D(G(\bm{z})))$ we can train $G$ to maximize $\log D(G(\bm{z}))$.
This objective function results in the same fixed point of the dynamics of $G$ and $D$ but provides much
stronger gradients early in learning.

%explains the intuition
%behind these asymptotic consistency results. When $D$ tracks its optimum,
%it classifies $x$'s according to Bayes rule, i.e.,
%$D^*(x) = \frac{P_X}{P_X(x) + P_G(x)}$, and the gradient of $D(G(z))$ on $G(z)$ pushes
%probability mass in the direction of increasing value of $D$, i.e., towards regions
%where $P_X(x)>P_G(x)$. This necessarily pulls probability mass away from
%regions where $P_X(x)<P_G(x)$. This happens because on the border of regions
%where $P_X(x)>P_G(x)$ the derivative of $D^*$ must point inside, and vice-versa.
%Hence the gradient pushes $G$ towards allocating more mass where it did not put enough,
%and vice-versa. A more formal proof of convergence is presented in Section~\ref{},
%also showing that the criterion is consistent, so long as $D$ is allowed to track
%its optimum, i.e., $G$ is making small changes between optimizations of $D$.

\begin{figure}[h]
\begin{tabular}{m{3cm}m{3cm}m{3cm}m{0.1cm}m{3cm}}
    \includegraphics[width=3cm, height=4cm]{fig1.pdf}
    &
    \includegraphics[width=3cm, height=4cm]{fig2.pdf}
    &
    \includegraphics[width=3cm, height=4cm]{fig3.pdf}
    &
    \dots
    &
    \includegraphics[width=3cm, height=4cm]{fig4.pdf}
    \\
    \centering (a)
    &
    \centering (b)
    &
    \centering (c)
    &
    &
    \centering (d)
\end{tabular}

\caption{\small
Generative adversarial nets are trained by simultaneously updating the \textbf{d}iscriminative
distribution ($D$, blue, dashed line) so that it discriminates between samples from
the data generating distribution (black, dotted line)
$p_{\bm{x}}$
from those of the \textbf{g}enerative distribution $p_g$ (G) (green, solid line).
The lower horizontal line is the domain from which $\bm{z}$ is sampled, in this case uniformly.
The horizontal line above is part of the domain of $\bm{x}$. The upward arrows show
how the mapping $\bm{x}=G(\bm{z})$ imposes the non-uniform distribution $p_g$ on transformed samples.
$G$ contracts in regions of high density and expands in regions of low density of $p_g$.
(a) Consider an adversarial pair near convergence: $p_g$ is similar to $p_\text{data}$ and
$D$ is a partially accurate classifier.
(b) In the inner loop of the algorithm $D$ is trained to discriminate samples from data,
converging to
$D^*(\bm{x}) =
\frac{
    p_\text{data}(\bm{x})
    }{
        p_\text{data}(\bm{x}) + p_g(\bm{x})}
$.
(c) After an update to $G$, gradient of $D$ has guided $G(\bm{z})$ to flow to regions that are more likely
to be classified as data.
(d) After several steps of training, if $G$ and $D$ have enough capacity, they will reach a point at which
both cannot improve because $p_g = p_\text{data}$.
The discriminator is unable to differentiate between the two
distributions, i.e. $D(\bm{x}) = \frac{1}{2}$.
}
\label{fig:intuition}
\end{figure}

\begin{algorithm}[ht]
\caption{\small Minibatch stochastic gradient descent training of generative adversarial nets.
The number of steps to apply to the discriminator, $k$, is a hyperparameter. We used $k=1$, the
least expensive option, in our experiments.
}
\begin{algorithmic}
\label{alg:AGF}
\FOR{number of training iterations}
  \FOR{$k$ steps}
    \STATE{$\bullet$ Sample minibatch of $m$ noise samples $\{ \bm{z}^{(1)}, \dots, \bm{z}^{(m)} \}$ from noise prior $p_g(\bm{z})$.}
    \STATE{$\bullet$ Sample minibatch of $m$ examples $\{ \bm{x}^{(1)}, \dots, \bm{x}^{(m)} \}$ from data generating distribution $p_\text{data}(\bm{x})$.}
    \STATE{$\bullet$ Update the discriminator by ascending its stochastic gradient:
        \[
            \nabla_{\theta_d} \frac{1}{m} \sum_{i=1}^m \left[
            \log D\left(\bm{x}^{(i)}\right)
            + \log \left(1-D\left(G\left(\bm{z}^{(i)}\right)\right)\right)
            \right].
        \]}
    %parameters $\theta_d$ of discriminator $D$
   %in the direction of the stochastic gradient of the binomial cross-entropy
   %for $D$ predicting whether its argument comes from $p_\text{data}(\bm{x})$ (target = 1, input = $\bm{x}$) or
   %$P_g$ (target = 0, input = $G(\bm{z})$), i.e., towards minimizing
   % \mbox{$-\log D(\bm{x}) - \log(1 - D(G(\bm{z})))$}.}
   \ENDFOR
  \STATE{$\bullet$ Sample minibatch of $m$ noise samples $\{ \bm{z}^{(1)}, \dots, \bm{z}^{(m)} \}$ from noise prior $p_g(\bm{z})$.}
    \STATE{$\bullet$ Update the generator by descending its stochastic gradient:
        \[
            \nabla_{\theta_g} \frac{1}{m} \sum_{i=1}^m
            \log \left(1-D\left(G\left(\bm{z}^{(i)}\right)\right)\right)
            .
        \]}
  \ENDFOR
  \\The gradient-based updates can use any standard gradient-based learning rule. We used momentum in our experiments.
\end{algorithmic}
\end{algorithm}

\section{Theoretical Results}
\label{sec:theory}

The generator $G$ implicitly defines a probability distribution $p_g$ as
the distribution of the samples $G(\bm{z})$ obtained when $\bm{z} \sim
p_{\bm{z}}$. Therefore, we would like Algorithm~\ref{alg:AGF} to converge to a
good estimator of $p_\text{data}$, if given enough capacity and training time. The
results of this section are done in a non-parametric setting, e.g. we represent a
model with infinite capacity by studying convergence in the space of probability
density functions.

% Note: IG moved the minimax game definition above

We will show in section~\ref{sec:global-optimality} that this minimax game
has a global optimum for $p_g = p_\text{data}$. We will then show in
section~\ref{sec:convergence-of-algorithm} that Algorithm~\ref{alg:AGF}
optimizes Eq~\ref{eq:minimaxgame-definition}, thus obtaining the desired
result.

\subsection{Global Optimality of $p_g=p_\text{data}$}
\label{sec:global-optimality}

We first consider the optimal discriminator $D$ for any given generator $G$.

\begin{proposition}
For $G$ fixed, the optimal discriminator $D$ is
\begin{equation}
\label{eq:optimal-D}
   D^*_G(\bm{x}) = \frac{p_\text{data}(\bm{x})}{p_\text{data}(\bm{x}) + p_g(\bm{x})}
\end{equation}
\end{proposition}

\begin{proof}
The training criterion for the discriminator D, given any generator $G$, is to maximize the quantity $V(G, D)$
\begin{align}
V(G, D) =& \int_{\bm{x}} p_\text{data}(\bm{x}) \log(D(\bm{x})) dx + \int_z p_{\bm{z}}(\bm{z}) \log(1 - D(g(\bm{z}))) dz \nonumber \\
\label{eq:cost-for-D}
		=& \int_{\bm{x}} p_\text{data}(\bm{x}) \log(D(\bm{x})) + p_g(\bm{x}) \log(1 - D(\bm{x})) dx
\end{align}

For any $(a,b) \in \mathbb{R}^2 \setminus \{0, 0\} $, the function $y \rightarrow a \log (y) + b \log (1-y)$ achieves its maximum in $[0,1]$ at $\frac{a}{a+b}$. The discriminator does not need to be defined outside of $Supp(p_\text{data}) \cup Supp(p_g)$, concluding the proof.
\end{proof}

Note that the training objective for $D$ can be interpreted as maximizing the log-likelihood for estimating the conditional probability $P(Y=y|\bm{x})$, where $Y$ indicates whether $\bm{x}$ comes from $p_\text{data}$ (with $y=1$) or from $p_g$ (with $y=0$). The minimax game in Eq.~\ref{eq:minimaxgame-definition} can now be reformulated as:

\begin{align}
\label{eq:G-criterion}
 C(G) =& \max_D V(G,D) \nonumber \\
      =& \mathbb{E}_{\bm{x} \sim p_\text{data}}[\log D^*_G(\bm{x})] + \mathbb{E}_{\bm{z} \sim p_{\bm{z}}}[\log (1 - D^*_G(G(\bm{z})))] \\
      =& \mathbb{E}_{\bm{x} \sim p_\text{data}}[\log D^*_G(\bm{x})] + \mathbb{E}_{\bm{x} \sim p_g}[\log (1 - D^*_G(\bm{x}))] \nonumber \\
      =& \mathbb{E}_{\bm{x} \sim p_\text{data}}\left[\log \frac{p_\text{data}(\bm{x})}{P_\text{data}(\bm{x}) + p_g(\bm{x})}\right] +
         \mathbb{E}_{\bm{x} \sim p_g}\left[\log \frac{p_g(\bm{x})}{p_\text{data}(\bm{x}) + p_g(\bm{x})}\right] \nonumber
\end{align}

\begin{theorem}
\label{thm:global-optimality}
The global minimum of the virtual training criterion $C(G)$ is achieved if and only if $p_g=p_\text{data}$.
At that point, $C(G)$ achieves the value $-\log 4$.
\end{theorem}

\begin{proof}
For $p_g=p_\text{data}$, $D^*_G(\bm{x})=\frac{1}{2}$, (consider Eq.~\ref{eq:optimal-D}). Hence, by inspecting Eq.~\ref{eq:G-criterion} at $D^*_G(\bm{x})=\frac{1}{2}$, we find $C(G)=\log\frac{1}{2} + \log\frac{1}{2}= - \log 4$. To see that this is the best possible value of $C(G)$, reached only for $p_g = p_\text{data}$, observe that
\[
 \mathbb{E}_{\bm{x} \sim p_\text{data}} \left[ - \log 2 \right] + \mathbb{E}_{\bm{x} \sim p_g} \left[ - \log 2 \right] = -\log 4
\]
%\begin{equation}
% - \log (4) = \mathbb{E}_{\bm{x} \sim p_\text{data}} \left[ - \log 2 \right] + \mathbb{E}_{\bm{x} \sim p_g} \left[ - \log 2 \right]
%\end{equation}
and that by subtracting this expression from $C(G) = V(D_G^*,G)$, we obtain:

\begin{equation}
%\label{eq:sym-KL}
C(G) = -\log(4) + KL \left(p_\text{data} \left \| \frac{p_\text{data} + p_g}{2} \right. \right) + KL \left(p_g \left \| \frac{p_\text{data} + p_g}{2} \right. \right)
\end{equation}

where KL is the Kullback--Leibler divergence. We recognize in the previous expression the Jensen--Shannon divergence between the model's distribution and the data generating process:

\begin{equation}
%\label{eq:sym-KL}
C(G) = - \log(4) + 2 \cdot JSD \left(p_\text{data} \left \| p_g \right. \right)
\end{equation}

Since the Jensen--Shannon divergence between two distributions is always non-negative and zero only
when they are equal, we have shown that $ C^* = - \log (4)$ is the global minimum of $C(G)$ and
that the only solution is $p_g=p_\text{data}$, i.e., the generative model perfectly replicating the data generating process.
\end{proof}

\subsection{Convergence of Algorithm~\ref{alg:AGF}}
\label{sec:convergence-of-algorithm}

\begin{proposition}
If $G$ and $D$ have enough capacity, and at each step of Algorithm~\ref{alg:AGF}, the discriminator is allowed to reach its optimum given $G$, and $p_g$ is updated so as to improve the criterion $$\mathbb{E}_{\bm{x} \sim p_\text{data}}[\log D^*_G(\bm{x})] + \mathbb{E}_{\bm{x} \sim p_g}[\log (1 - D^*_G(\bm{x}))]$$ then $p_g$ converges to $p_\text{data}$
\end{proposition}

\begin{proof}
Consider $V(G,D)=U(p_g,D)$ as a function of $p_g$ as done in the above criterion. Note that $U(p_g,D)$ is convex in $p_g$. The subderivatives of a supremum of convex functions include the derivative of the function at the point where the maximum is attained. In other words, if $f(x) = \sup_{\alpha \in \cal{A}} f_\alpha(x)$ and $f_\alpha(x)$ is convex in $x$ for every $\alpha$, then $\partial f_\beta(x) \in \partial f$ if $\beta = \arg \sup_{\alpha \in \cal{A}} f_\alpha(x)$. This is equivalent to computing a gradient descent update for $p_g$ at the optimal $D$ given the corresponding $G$. $\sup_D U(p_g,D)$ is convex in $p_g$ with a unique global optima as proven in Thm~\ref{thm:global-optimality}, therefore with sufficiently small updates of $p_g$, $p_g$ converges to $p_x$, concluding the proof.
% It is a known result of convex
% optimization then that the gradient updates (performed in
% Algorithm~\ref{alg:AGF}) are in the subderivatives of $U(p_g,D)$ with
% respect to $p_g$. To decrease the maximum over the set of $D$'s, it is enough to
% make a small enough step of $G$ according to the subgradients, at the given $D$ which
% maximized $V(G,D)$, i.e., since decreasing $V(G,D)$ decreases $U(p_g,D)$.
% With sufficiently small steps of $G$, Algorithm~\ref{alg:AGF} thus reaches the
% global optimum $p_g = p_\text{data}$ of the minimax game.
\end{proof}

In practice, adversarial nets represent a limited family of $p_g$ distributions via the function $G(\bm{z}; \theta_g)$,
and we optimize $\theta_g$ rather than $p_g$ itself. Using a multilayer perceptron to define $G$ introduces multiple
critical points in parameter space.
However, the excellent performance of multilayer
perceptrons in practice suggests that they are a reasonable model to use despite their lack of theoretical guarantees.

\section{Experiments}

We trained adversarial nets an a range of datasets including MNIST\citep{LeCun+98}, the
Toronto Face Database (TFD)~\cite{Susskind2010}, and CIFAR-10~\citep{KrizhevskyHinton2009}.
The generator nets used a mixture of rectifier linear
activations~\cite{Jarrett-ICCV2009,Glorot+al-AI-2011-small} and sigmoid
activations, while the discriminator net used maxout~\cite{Goodfellow_maxout_2013} activations.
Dropout~\cite{Hinton-et-al-arxiv2012} was applied in training the
discriminator net. While our theoretical framework permits the use of dropout and other noise
at intermediate layers of the generator, we used noise as the input to only the bottommost layer
of the generator network.

We estimate probability of the test set data under $p_g$ by fitting a Gaussian Parzen window to the samples
generated with $G$ and reporting the log-likelihood under this distribution.
The $\sigma$ parameter of the Gaussians
was obtained by cross validation on the validation set. This procedure was introduced in  \citet{Breuleux+Bengio-2011}
and used for various generative models for which the exact likelihood is
not
tractable~\citep{Rifai-icml2012,Bengio-et-al-ICML2013,Bengio-et-al-ICML2014}. Results
are reported in Table \ref{table:parzen}. This method of estimating the likelihood has somewhat high variance
and does not perform well in high dimensional spaces but it is the best method available to our knowledge.
Advances in generative models that can sample but not estimate likelihood directly motivate further research
into how to evaluate such models.

\begin{table}
\centering
\begin{tabular}{c|c|c}
Model & MNIST & TFD \\
\hline
DBN~\citep{Bengio-et-al-ICML2013} & $138 \pm 2$ & $1909 \pm 66$ \\
Stacked CAE~\citep{Bengio-et-al-ICML2013} & $121 \pm 1.6$ & $\mathbf{2110 \pm 50}$ \\
Deep GSN~\citep{Bengio-et-al-ICML-2014} & $214 \pm 1.1$ & $1890 \pm 29$ \\
Adversarial nets & $\mathbf{225 \pm 2}$ & $\mathbf{2057 \pm 26}$
\end{tabular}
\caption{\small
Parzen window-based log-likelihood estimates. The reported numbers on MNIST are the mean log-likelihood of samples on test set,
with the standard error of the mean computed across examples.
On TFD, we computed the standard error across folds of the dataset, with a different $\sigma$ chosen using the validation set
of each fold.
On TFD, $\sigma$ was cross validated on each fold and mean log-likelihood on each fold were computed.
For MNIST we compare against other models of the real-valued (rather than binary) version of dataset.}
\label{table:parzen}
\end{table}

In Figures \ref{fig:visuals1} and \ref{fig:visuals3} we
show samples drawn from the generator net after training.
While we make no claim that these samples are better than
samples generated by existing methods, we believe that these samples are at
least competitive with the better generative models in the literature and
highlight the potential of the adversarial framework.

\begin{figure}[h]
\centering
\begin{tabular}{cc}
 \includegraphics[width=2.6in]{mnist_samples.png} &
 \includegraphics[width=2.6in]{tfd_samples.png} \\
a) & b) \\
 \includegraphics[width=2.6in]{cifar_full_samples.png} &
 \includegraphics[width=2.6in]{cifar_conv_samples.png} \\
 c) & d)
\end{tabular}
\caption{
\small Visualization of samples from the model. Rightmost column shows the
nearest training example of the neighboring sample, in order to demonstrate
that the model has not memorized the training set. Samples are fair random
draws, not cherry-picked. Unlike most other visualizations of deep generative
models, these images show actual samples from the model distributions, not
conditional means given samples of hidden units. Moreover, these samples are
uncorrelated because the sampling process does not depend on Markov chain mixing.
a) MNIST b) TFD c) CIFAR-10 (fully connected model)
d) CIFAR-10 (convolutional discriminator and ``deconvolutional'' generator)
}
\label{fig:visuals1}
\end{figure}

%\begin{figure}[h]
%\centering
%    \includegraphics[width=10cm]{trans.png}
%\end{figure}

\iffalse
\begin{figure}[h]
\centering
    \includegraphics[width=12cm]{2dmanifold.png}
    \caption{\small The manifold of MNIST digits learned by a small model
      with $\bm{z} \in \mathbf{R}^2$. }
\label{fig:visuals2}
\end{figure}
\fi

\begin{figure}[h]
\centering
    \includegraphics[width=6cm]{1dsubspace.png}
    \includegraphics[width=6cm]{1dsubspace2.png}
    \caption{\small Digits obtained by linearly interpolating between
      coordinates in $\bm{z}$ space of the full model.}
\label{fig:visuals3}
\end{figure}

\iffalse
\begin{figure}[h]
\centering
\begin{minipage}{.5\textwidth}
    \centering
    \includegraphics[width=7.5cm]{failure.pdf}
    \caption{\small Failure case of discriminator}
    \label{fig:failure}
\end{minipage}%
\begin{minipage}{.5\textwidth}
    \centering
    \includegraphics[width=6cm]{helvetica.png}
    \caption{\small TODO Training only G for a fixed D}
    \label{fig:helvetica}
\end{minipage}
\end{figure}
\fi

\newcolumntype{L}[1]{>{\raggedright}m{#1}}
\begin{table}[ht]
\small
\begin{tabular}{c|L{1in}|L{1in}|L{1in}|L{1in}}
& Deep directed graphical models & Deep undirected graphical models & Generative autoencoders & Adversarial models \tabularnewline
\hline
Training & Inference needed during training.
         & Inference needed during training. MCMC needed to approximate partition function gradient.
         & Enforced tradeoff between mixing and power of reconstruction generation
         & Synchronizing the discriminator with the generator. Helvetica.\tabularnewline
\hline
Inference &  Learned approximate inference &  Variational inference &  MCMC-based inference &  Learned approximate inference \tabularnewline
\hline
Sampling & No difficulties &  Requires Markov chain & Requires Markov chain & No difficulties \tabularnewline
\hline
Evaluating $p(x)$ & {  Intractable, may be approximated with AIS} &  Intractable, may be approximated with AIS  &
Not explicitly represented, may be approximated with Parzen density estimation &  Not explicitly represented, may be approximated with Parzen density estimation\tabularnewline
\hline
Model design &  Nearly all models incur extreme difficulty &  Careful design needed to ensure multiple properties
 &  Any differentiable function is theoretically permitted &  Any differentiable function is theoretically permitted
\end{tabular}
\caption{\small Challenges in generative modeling: a summary of the difficulties encountered by different approaches to deep generative modeling for each of
the major operations involving a model.}
\label{table:comparison}
\normalsize
\end{table}
\section{Advantages and disadvantages}

This new framework comes with advantages and disadvantages relative to previous
modeling frameworks. The disadvantages are primarily that there is no explicit
representation of $p_g(\bm{x})$, and that $D$ must be synchronized well with $G$
during training (in particular, $G$ must not be trained too much without updating
$D$, in order to avoid ``the Helvetica scenario'' in which $G$ collapses too many
values of $\mathbf{z}$ to the same value of $\mathbf{x}$ to have enough diversity
to model $p_\text{data}$),
much as the negative chains of a Boltzmann machine must be
kept up to date between learning steps. The advantages are that Markov chains
are never needed, only backprop is used to obtain gradients,
no inference is needed during learning, and a wide variety of
functions can be incorporated into the model.
Table~\ref{table:comparison} summarizes the comparison of generative adversarial nets with other
generative modeling approaches.

The aforementioned advantages are primarily computational. Adversarial models may
also gain some statistical advantage from the generator network not being updated
directly with data examples, but only with gradients flowing through the discriminator.
This means that components of the input are not copied directly into the generator's
parameters. Another advantage of adversarial networks is that they can represent
very sharp, even degenerate distributions, while methods based on Markov chains require
that the distribution be somewhat blurry in order for the chains to be able to mix
between modes.

%The advantages of the proposed adversarial framework
%are the following. (1) No inference is needed as part
%of training (although an inference network could be trained to predict the
%intermediate layers $h$, or the top-level factors $z$, given $x$. (2) Unlike
%NCE, score matching and energy-based approaches, the
%generative model is not required to have an analytical probability function
%or analytical energy function (i.e., up to an intractable normalization
%constant).  (3) Neither training nor sampling from the model require an MCMC,
%i.e., neither are sensitive to the potential difficulties of mixing between
%modes~\citep{Bengio-et-al-ICML2013}. (4) For continuous variables,
%gradients of the training criterion can be obtained by back-prop and
%training can be done by gradient-based optimization. (5) For training to
%proceed, the generated distribution $P_G$ does not actually have to cover the
%support of the data generating distribution $P_X$, i.e., it can be degenerate and
%only put mass on some lower-dimensional manifolds. (6)
%Whereas the NCE classifier will become confident (and saturate) as soon
%as it finds a few features that can distinguish the training data from
%the base distribution (i.e. NCE is well suited to capture distributions
%with a small intrinsic dimensionality), the discriminator net $D$
%will continue searching for more features until the generated data
%is indistinguishable from the training data. (7) Unlike in all other
%training frameworks, the generative model only sees the data indirectly,
%i.e., through the parameters of the discriminator $D$. Hence $G$ cannot
%simply overfit by ``copying'' the training examples, making it less prone
%to overfitting. $G$ can only overfit if $D$ overfits (but then it is
%easy to control overfitting of $D$, and $D$ will still only capture a smooth
%of the empirical training distribution).

%The disadvantages of the proposed framework are associated to its advantages: in general there will be no
%analytical formulation for the likelihood. Furthermore, the only kind of inference
%available is learned approximate inference (but that can be trained independently
%of the generator network).

\section{Conclusions and future work}

This framework
admits many straightforward extensions:
\begin{enumerate}[noitemsep,leftmargin=0.4cm]
\item A {\em conditional generative} model $p(\bm{x} \mid \bm{c})$ can be obtained by adding $\bm{c}$
as input to both $G$ and $D$.
\item {\em Learned approximate inference} can be performed by training an auxiliary network to predict
    $\bm{z}$ given $\bm{x}$. This is similar to the inference net trained by the wake-sleep algorithm ~\citep{Hinton95}
but with the advantage that the inference net may be trained for a fixed generator net after the generator
net has finished training.
\item One can approximately model all conditionals $p(\bm{x}_S \mid \bm{x}_{\not S})$ where $S$ is a subset of
the indices of $\bm{x}$
by training a family of conditional models that share parameters. Essentially, one can use adversarial nets to implement
 a stochastic extension of the deterministic MP-DBM \cite{Goodfellow-et-al-NIPS2013-small}.
\item {\em Semi-supervised learning}: features from the discriminator or inference net could improve performance
of classifiers when limited labeled data is available.
\item {\em Efficiency improvements:} training could be accelerated greatly by divising better methods for
coordinating $G$ and $D$ or determining better distributions to sample $\mathbf{z}$ from during training.
\end{enumerate}
This paper has demonstrated the viability of the adversarial modeling framework, suggesting that these research
directions could prove useful.

\subsubsection*{Acknowledgments}
We would like to acknowledge Patrice Marcotte, Olivier Delalleau, Kyunghyun Cho, Guillaume Alain and Jason Yosinski for helpful discussions.
Yann Dauphin shared his Parzen window evaluation code with us.
We would like to thank the developers of
Pylearn2~\citep{pylearn2_arxiv_2013}
and
Theano~\citep{bergstra+al:2010-scipy,Bastien-Theano-2012}, particularly
Fr\'ed\'eric Bastien who rushed a Theano feature specifically to benefit this project.
Arnaud Bergeron provided much-needed support with \LaTeX\ typesetting.
We would also like to thank CIFAR, and Canada Research Chairs for funding, and Compute Canada, and Calcul Qu\'ebec
for providing computational resources. Ian Goodfellow is supported by the 2013 Google Fellowship in Deep
Learning. Finally, we would like to thank Les Trois Brasseurs for stimulating our creativity.

{\small
\bibliography{strings,strings-shorter,ml,aigaion-shorter}
\bibliographystyle{natbib}}

\end{document}

max_stars_repo_name: nat-chan/HumanSensing

max_issues_repo_name: nat-chan/HumanSensing

max_forks_repo_name: nat-chan/HumanSensing


text:
\documentclass[letterpaper,9pt,twoside,printwatermark=false]{pinp}

%% Some pieces required from the pandoc template
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

% Use the lineno option to display guide line numbers if required.
% Note that the use of elements such as single-column equations
% may affect the guide line number alignment.

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{longtable}

% The geometry package layout settings need to be set here...
\geometry{layoutsize={0.95588\paperwidth,0.98864\paperheight},%
          layouthoffset=0.02206\paperwidth,%
		  layoutvoffset=0.00568\paperheight}

\definecolor{pinpblue}{HTML}{185FAF}  % imagecolorpicker on blue for new R logo
\definecolor{pnasbluetext}{RGB}{101,0,0} %

\title{Assignment 2 - Histograms, Medians, Means, Boxplots and Standard
Deviation. Due September 21, 11:59pm 2018}

\author[a]{EPIB607 - Inferential Statistics}

  \affil[a]{Fall 2018, McGill University}

\setcounter{secnumdepth}{5}

% Please give the surname of the lead author for the running footer
\leadauthor{Bhatnagar and Hanley}

% Keywords are not mandatory, but authors are strongly encouraged to provide them. If provided, please include two to five keywords, separated by the pipe symbol, e.g:
 \keywords{  Histograms |  Means |  Medians |  Boxplots |  Standard Deviation |  Summary statistics |  mosaic package  }

\begin{abstract}
The first step in understanding data is to hear what the data say, to
``let the data speak for themselves''. Numbers speak clearly only when
we help them speak by organizing, displaying, and summarizing. In this
assignment you will explore how to visualize your data and summarize it
using summary statistics. All graphs and calculations are to be
completed in an R Markdown document using the provided template. You are
free to choose any function from any package to complete the assignment.
Concise answers will be rewarded. Be brief and to the point. Please
submit both the compiled HTML report and the source file (.Rmd) to
myCourses by September 21, 2018, 11:59pm. Both HTML and .Rmd files
should be saved as `IDnumber\_LastName\_FirstName\_EPIB607\_A2'.
\end{abstract}

\dates{This version was compiled on \today}
\doi{\url{https://sahirbhatnagar.com/EPIB607/}}

\pinpfootercontents{Assignment 2 due Sepetember 21, 2018 by 11:59pm}

\begin{document}

% Optional adjustment to line up main text (after abstract) of first page with line numbers, when using both lineno and twocolumn options.
% You should only change this length when you've finalised the article contents.
\verticaladjustment{-2pt}

\maketitle
\thispagestyle{firststyle}
\ifthenelse{\boolean{shortarticle}}{\ifthenelse{\boolean{singlecolumn}}{\abscontentformatted}{\abscontent}}{}

% If your first paragraph (i.e. with the \dropcap) contains a list environment (quote, quotation, theorem, definition, enumerate, itemize...), the line after the list may have some extra indentation. If this is the case, add \parshape=0 to the end of the list environment.

\section*{Template}\label{template}
\addcontentsline{toc}{section}{Template}

The \texttt{.Rmd} template for Assignment 2 is available
\href{https://github.com/sahirbhatnagar/EPIB607/raw/master/assignments/a2/a2_template.Rmd}{here}

\section*{\texorpdfstring{The \texttt{mosaic} package
(optional)}{The mosaic package (optional)}}\label{the-mosaic-package-optional}
\addcontentsline{toc}{section}{The \texttt{mosaic} package (optional)}

The \texttt{mosaic} package provides a consistent and user-friendly
interface for descriptive statistics, plots and inference. You may find
it useful to complete an interactive tutorial on its plotting functions.
(note: this is optional and will not be counted for any marks). First
install the following packages:

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{install.packages}\NormalTok{(}\KeywordTok{c}\NormalTok{(}\StringTok{"learnr"}\NormalTok{,}\StringTok{"mosaic"}\NormalTok{), }\DataTypeTok{dependencies =} \OtherTok{TRUE}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

Then, from RStudio, run the following command which will open a new page
in your web broswer:

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{learnr}\OperatorTok{::}\KeywordTok{run_tutorial}\NormalTok{(}\StringTok{"introduction"}\NormalTok{, }\DataTypeTok{package =} \StringTok{"ggformula"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

An advanced tutorial on customizing plots is available also:

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{learnr}\OperatorTok{::}\KeywordTok{run_tutorial}\NormalTok{(}\StringTok{"refining"}\NormalTok{, }\DataTypeTok{package =} \StringTok{"ggformula"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\section{Age-structures of Populations, then and
now}\label{age-structures-of-populations-then-and-now}

The 1911 census of Ireland was taken on April 2nd 1911 and was released
to the public in 1961. Follow
\href{http://www.census.nationalarchives.ie/help/about19011911census.html}{this
link} for further details on the census. James Hanley (JH) has scrapped
the data for Dublin, collected the age-frequency distribtion by gender
and provided you with a
\href{https://github.com/sahirbhatnagar/EPIB607/raw/master/data/age_sex_frequencies_ireland.csv}{three
column .csv file} which looks like this:

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{cens <-}\StringTok{ }\KeywordTok{read.csv}\NormalTok{(}\StringTok{"https://github.com/sahirbhatnagar/EPIB607/raw/master/data/age_sex_frequencies_ireland.csv"}\NormalTok{)}
\KeywordTok{head}\NormalTok{(cens)}
\end{Highlighting}
\end{Shaded}

\begin{ShadedResult}
\begin{verbatim}
#    Gender Age Freq
#  1   Male   0 5332
#  2   Male   1 4570
#  3   Male   2 4979
#  4   Male   3 4789
#  5   Male   4 4884
#  6   Male   5 4787
\end{verbatim}
\end{ShadedResult}

The \texttt{Age} column represents the age in 1911. The \texttt{Freq}
column gives the frequency of the number of people for a given age and
\texttt{Gender}.

\begin{enumerate}
\def\labelenumi{\alph{enumi})}
\tightlist
\item
  What was the ealiest year of birth for (i) males and (ii) females ?
\item
  Create a suitable visulaization of this data and then comment on any
  patterns you see and give reasons for these patterns. Your choice
  should leverage all the information provided in the data and be
  influeced by the message that you are trying to convey. Be sure to
  include an informative title and figure caption.
\item
  Calculate the mean age, the standard deviation (SD), and the
  quartiles: \(Q_{25}, Q_{50} (median), Q_{75}\) separately for males
  and females.
\item
  The orignial census cards have been scanned are available online.
  \href{http://www.census.nationalarchives.ie/reels/nai000230598/}{This
  one in particular} is quite famous. Why?
\end{enumerate}

\section{Number of Authors}\label{number-of-authors}

Fletcher et al. (1979, NEJM 301:180-183) studied the characteristics of
612 randomly selected articles published in the NEJM, JAMA, and the
Lancet since 1946. Two characteristics examined were the number of
authors per article and the number of students studied in each article:

\begin{longtable}[]{@{}llll@{}}
\toprule
Year & No. articles studied & No. Authors Mean (SD) & No. subjects
Median\tabularnewline
\midrule
\endhead
1946 & 151 & 2.0 (1.4) & 25\tabularnewline
1956 & 149 & 2.3 (1.6) & 36\tabularnewline
1966 & 157 & 2.8 (1.2) & 16\tabularnewline
1976 & 155 & 4.9 (7.3) & 30\tabularnewline
\bottomrule
\end{longtable}

\begin{enumerate}
\def\labelenumi{\alph{enumi})}
\tightlist
\item
  Why report median number of subjects (instead of average)?
\item
  In 1976, can the standard deviation of 7.3 really be larger than the
  mean of 4.9? Explain.
\item
  In light of (a) and (b), how would you present the data in this table?
\end{enumerate}

\section{Cancer Deaths in the US}\label{cancer-deaths-in-the-us}

The American Cancer Society (ACS) recently published age-adjusted cancer
death rates by cancer site and gender at this
\href{https://www.cancer.org/research/cancer-facts-statistics/all-cancer-facts-figures/cancer-facts-figures-2017.html}{link}.

\begin{enumerate}
\def\labelenumi{\alph{enumi})}
\tightlist
\item
  In the figure
  \href{https://www.cancer.org/content/dam/cancer-org/research/cancer-facts-and-statistics/annual-cancer-facts-and-figures/2017/trends-in-age-adjusted-cancer-death-rates-by-site-males-us-1930-2014.pdf}{Trends
  in Age-adjusted Cancer Death Rates by Site, Males, US, 1930-2014
  (PDF)} list the scales being used and the variable that has been
  mapped onto them.
\item
  Briefly comment on what you like about the figure, and what could have
  been improved (e.g.~aesthetics, labels, use of color)
\item
  The data used to make the figures has also been provided on the ACS
  website in Excel spreasheets:
  \href{https://www.cancer.org/content/dam/cancer-org/research/cancer-facts-and-statistics/annual-cancer-facts-and-figures/2017/age-adjusted-cancer-death-rates-males-1930-2014.xlsx}{{[}males{]}},
  \href{https://www.cancer.org/content/dam/cancer-org/research/cancer-facts-and-statistics/annual-cancer-facts-and-figures/2017/age-adjusted-cancer-death-rates-females-1930-2014.xlsx}{{[}females{]}}.
  Once you have downloaded the spreadsheets, the following code can be
  used to combine both datasets:
\end{enumerate}

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{library}\NormalTok{(dplyr)}
\NormalTok{males <-}\StringTok{ }\NormalTok{readxl}\OperatorTok{::}\KeywordTok{read_xlsx}\NormalTok{(}\StringTok{"~/Downloads/age-adjusted-cancer-death-rates-males-1930-2014.xlsx"}\NormalTok{, }
                           \DataTypeTok{skip =} \DecValTok{1}\NormalTok{, }\DataTypeTok{n_max =} \DecValTok{85}\NormalTok{) }\OperatorTok{%>%}\StringTok{ }\KeywordTok{mutate}\NormalTok{(}\DataTypeTok{Gender =} \StringTok{"Male"}\NormalTok{)  }
\NormalTok{females <-}\StringTok{ }\NormalTok{readxl}\OperatorTok{::}\KeywordTok{read_xlsx}\NormalTok{(}\StringTok{"~/Downloads/age-adjusted-cancer-death-rates-females-1930-2014.xlsx"}\NormalTok{, }
                             \DataTypeTok{skip =} \DecValTok{1}\NormalTok{, }\DataTypeTok{n_max =} \DecValTok{85}\NormalTok{) }\OperatorTok{%>%}\StringTok{ }\KeywordTok{mutate}\NormalTok{(}\DataTypeTok{Gender =} \StringTok{"Female"}\NormalTok{)}
\NormalTok{cancer_rates <-}\StringTok{ }\NormalTok{dplyr}\OperatorTok{::}\KeywordTok{bind_rows}\NormalTok{(}\KeywordTok{list}\NormalTok{(females,males))}
\KeywordTok{head}\NormalTok{(cancer_rates)}
\end{Highlighting}
\end{Shaded}

\begin{ShadedResult}
\begin{verbatim}
#  # A tibble: 6 x 13
#     Year Stomach `Colon and Rect~ `Pancreas‡` `Lung and Bronc~ Breast
#    <dbl>   <dbl>            <dbl>       <dbl>            <dbl>  <dbl>
#  1  1930    35.2             27.1        3.82             2.58   30.1
#  2  1931    33.8             27.7        4.12             2.63   30.6
#  3  1932    33.7             28.5        4.50             2.84   30.9
#  4  1933    32.5             28.7        4.27             2.96   30.8
#  5  1934    31.6             29.7        4.36             3.08   31.6
#  6  1935    31.4             30.2        4.67             3.54   31.3
#  # ... with 7 more variables: `Uterus†` <dbl>, `Liver‡` <dbl>,
#  #   Gender <chr>, `Liver†` <dbl>, `Pancreas†` <dbl>, Prostate <dbl>,
#  #   Leukemia <dbl>
\end{verbatim}
\end{ShadedResult}

In order to make the data ready for plotting, we need to \emph{melt} it
first:

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{library}\NormalTok{(tidyr)}
\NormalTok{cancer_rates_melt <-}\StringTok{ }\NormalTok{tidyr}\OperatorTok{::}\KeywordTok{gather}\NormalTok{(cancer_rates, }\DataTypeTok{key =} \StringTok{"Site"}\NormalTok{, }\DataTypeTok{value =} \StringTok{"Rate"}\NormalTok{, }\OperatorTok{-}\NormalTok{Year, }\OperatorTok{-}\NormalTok{Gender)}
\KeywordTok{head}\NormalTok{(cancer_rates_melt, }\DataTypeTok{n =} \DecValTok{10}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{ShadedResult}
\begin{verbatim}
#  # A tibble: 10 x 4
#      Year Gender Site     Rate
#     <dbl> <chr>  <chr>   <dbl>
#   1  1930 Female Stomach  35.2
#   2  1931 Female Stomach  33.8
#   3  1932 Female Stomach  33.7
#   4  1933 Female Stomach  32.5
#   5  1934 Female Stomach  31.6
#   6  1935 Female Stomach  31.4
#   7  1936 Female Stomach  30.9
#   8  1937 Female Stomach  29.2
#   9  1938 Female Stomach  28.9
#  10  1939 Female Stomach  26.9
\end{verbatim}
\end{ShadedResult}

Plot the data using a graph of your choice with the goal of comparing
males vs.~females. (you might consider using the function
\texttt{gf\_line} from the \texttt{ggformula} package). Briefly comment
on your comparison. Be sure to include an informative title and figure
caption.

\section{Does breast-feeding weaken
bones?}\label{does-breast-feeding-weaken-bones}

Breast-feeding mothers secrete calcium into their milk. Some of the
calcium may come from their bones, so mothers may lose bone mineral
content. Researchers compared 47 breast-feeding women with 22 women of
similar age who were neither pregnant nor lactating. They measured the
percent change in the mineral content of the women's spines over three
months. The data can be read into R:

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{boneloss <-}\StringTok{ }\KeywordTok{read.csv}\NormalTok{(}\StringTok{"https://github.com/sahirbhatnagar/EPIB607/raw/master/data/boneloss.csv"}\NormalTok{)}
\KeywordTok{head}\NormalTok{(boneloss)}
\end{Highlighting}
\end{Shaded}

\begin{ShadedResult}
\begin{verbatim}
#     type mineral_loss
#  1 Other          2.4
#  2 Other          0.0
#  3 Other          0.9
#  4 Other         -0.2
#  5 Other          1.0
#  6 Other          1.7
\end{verbatim}
\end{ShadedResult}

A negative value of \texttt{mineral\_loss} indicates a loss in mineral
content. Do the data show distinctly greater bone mineral loss among the
breast-feeding women? Use descriptive statistics, plots and/or tables to
justify your conclusion.

\section{Food in America}\label{food-in-america}

Vox published a list of
\href{http://www.vox.com/a/explain-food-america}{Charts that explain
food in America}. There are 40 maps, charts, and graphs that show where
our food and drink comes from and how we eat it.

Pick your best and least favorite graphic, and briefly explain why using
the taxonomy we learned in
\href{https://docs.google.com/presentation/d/1wXgcTzcRKl_leGRfNZjWWPkjwJSTlZSXBCl-fFuLEaE/edit?usp=sharing}{class}
and provide a link to the figure. For example, this link:
\href{https://www.vox.com/a/explain-food-america\#list-21}{Figure 18}
was created using the following code:
\texttt{{[}Figure\ 18{]}(https://www.vox.com/a/explain-food-america\#list-21)}

%\showmatmethods

\bibliography{pinp}
\bibliographystyle{jss}

\end{document}


text:
    \filetitle{iriscleanup}{Remove IRIS from Matlab and clean up}{config/iriscleanup}

	\paragraph{Syntax}\label{syntax}

\begin{verbatim}
iriscleanup
\end{verbatim}

\paragraph{Description}\label{description}

This script removes IRIS folders, including the root folder, from both
the Matlab search path, and clears persistent variables in some of the
backend functions. A short message is displayed with the list of folders
removed from the path.

max_stars_repo_name: OGResearch/IRIS-Toolbox-For-Octave

max_issues_repo_name: OGResearch/IRIS-Toolbox-For-Octave

max_forks_repo_name: OGResearch/IRIS-Toolbox-For-Octave