The Overlooked Potential of Generalized Linear Models in Astronomy-II: Gamma regression and photometric redshifts
\noindent Machine learning techniques offer a precious tool box for use within astronomy to solve problems involving so-called big data. They provide a means to make accurate predictions about a particular system without prior knowledge of the underlying physical processes of the data. In this article, and the companion papers of this series, we present the set of Generalized Linear Models (GLMs) as a fast alternative method for tackling general astronomical problems, including the ones related to the machine learning paradigm. To demonstrate the applicability of GLMs to inherently positive and continuous physical observables, we explore their use in estimating the photometric redshifts of galaxies from their multi-wavelength photometry. Using the gamma family with a log link function we predict redshifts from the PHoto-z Accuracy Testing simulated catalogue and a subset of the Sloan Digital Sky Survey from Data Release 10. We obtain fits that result in catastrophic outlier rates as low as $\sim1\%$ for simulated and $\sim 2\%$ for real data. Moreover, we can easily obtain such levels of precision within a matter of seconds on a normal desktop computer and with training sets that contain merely thousands of galaxies. Our software is made publicly available as a user-friendly package developed in Python, R and via an interactive web application. This software allows users to apply a set of GLMs to their own photometric catalogues and generates publication quality plots with minimum effort. By facilitating their ease of use to the astronomical community, this paper series aims to make GLMs widely known and to encourage their implementation in future large-scale projects, such as the Large Synoptic Survey Telescope.
glm_photoz.tex
\documentclass[authoryear,12pt,5p,times]{elsarticle}

% / --------------------
% PACKAGES
\usepackage{aas_macros}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{enumerate}
\usepackage{url}
\usepackage[breaklinks=true]{hyperref}
\usepackage{breakcites}
\usepackage{microtype}
\usepackage{bm}
\usepackage{tikz}
\usepackage{color}
\usepackage{txfonts}
\usepackage{booktabs}
\usepackage{verbatim}
\usepackage{todonotes}
\usepackage{listings}
\usepackage{longtable}
% -------------------- /



% / --------------------
% USER DEFINITIONS
\newcommand{\photz}{photo-\emph{z}}
\newcommand{\photzs}{photo-\emph{z}s}
% -------------------- /



\begin{document}

% / --------------------
% FRONTMATTER

\begin{frontmatter}

\title{The Overlooked Potential of Generalized Linear Models in Astronomy-II: Gamma regression and photometric redshifts}

\author[MPE]{J. Elliott}
\ead{jonnyelliott@mpe.mpg.de}

\author[MTA]{R. S. de Souza}
\ead{rafael.2706@gmail.com}

\author[UL]{A. Krone-Martins}
\ead{algol@sim.ul.pt}

\author[OXZ]{E. Cameron}
\ead{dr.ewan.cameron@gmail.com}

\author[MPA]{E. E. O. Ishida}
\ead{emille@mpa-garching.mpg.de}

\author[AZ,JET]{J. Hilbe}
\ead{j.m.hilbe@gmail.com}

\author[]{for the COIN collaboration}

\address[MPE]{Max-Planck-Institut f{\"u}r extraterrestrische Physik, Giessenbachstra\ss e 1, 85748, Garching, Germany}
\address[MTA]{MTA E\"otv\"os University, EIRSA ``Lendulet'' Astrophysics Research Group, Budapest 1117, Hungary}
\address[UL]{SIM, Faculdade de Ci\^encias, Universidade de Lisboa, Ed. C8, Campo Grande, 1749-016, Lisboa, Portugal}
\address[OXZ]{Department of Zoology, University of Oxford, Tinbergen Building, South Parks Road, Oxford, OX1 3PS, United Kingdom}
\address[MPA]{Max-Planck-Institut f\"ur Astrophysik, Karl-Schwarzschild-Str. 1, 85748 Garching, Germany}
\address[AZ]{Arizona State University, 873701,Tempe, AZ 85287-3701, USA}
\address[JET]{Jet Propulsion Laboratory, 4800 Oak Grove Dr., Pasadena, CA 91109, USA}

\begin{abstract}

\noindent Machine learning techniques offer a precious tool box for use within astronomy to solve problems involving so-called \emph{big data}. They provide a means to make accurate predictions about a particular system without prior knowledge of the underlying physical processes of the data. In this article, and the companion papers of this series, we present  the set of Generalized Linear Models (GLMs) as a fast alternative method for tackling general astronomical problems, including the ones related to the machine learning paradigm. To demonstrate the applicability of GLMs to inherently positive and continuous physical observables,  we explore their use in estimating the photometric redshifts of galaxies from their multi-wavelength photometry. Using the gamma family with a log link function we predict redshifts from the \textit{PHoto-z Accuracy Testing} simulated catalogue and a subset of the \textit{Sloan Digital Sky Survey} from Data Release 10. We obtain fits that result in catastrophic outlier rates as low as $\sim1\%$ for simulated and $\sim 2\%$ for real data. Moreover, we can easily obtain such levels of precision within a matter of seconds on a normal desktop computer and with training sets that contain merely thousands of galaxies. Our software is made publicly available as a user-friendly package developed in \texttt{Python}, \texttt{R} and via an interactive web  application. This software allows users to apply a set of GLMs to their own photometric catalogues and generates publication quality plots with minimum effort. By facilitating their ease of use to the astronomical community, this paper series aims to make GLMs widely known and to encourage their implementation in future large-scale projects, such as the Large Synoptic Survey Telescope.
\end{abstract}


\begin{keyword}
techniques: photometric  --
methods: statistical --
methods: analytical --
galaxies: distances and redshifts
\end{keyword}
\end{frontmatter}
% -------------------- /



% / --------------------
\topmargin -1.3cm
% NOTE THAT THIS WILL PLACE THE LAYOUT CORRECTLY ON ASTRO-PH
% PLEASE LEAVE IN
% -------------------- /



% /--------------------
% INTRODUCTION

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

Generalized Linear Models (GLMs), as introduced by \citet{nel72}, offer a well established statistical framework for robust modelling and prediction making. It allows the application of regression analysis when the observed quantity originates from an \textit{exponential family} distribution rather than a Gaussian~\citep[or Normal; e.g.,][]{Hil12, hil14}. As a result, GLMs offer a readily interpretable and physically-motivated approach (via family distributions) to machine learning (ML) that can be applied to a variety of astronomical data sets. Despite being widely used across a range of scientific disciplines,  such as biology \citep{bro93,Ahrestani2013}, medicine \citep{lindsey1999}, and economics \citep{pin98,Jong2008}, and its availability  within the overwhelming majority of contemporary statistical software packages (e.g.,\ \texttt{R}, \citealt{R}; \texttt{SAS}, \citealt{SAS}; and \texttt{STATA}, \citealt{Stata}), GLMs remain almost \textit{terra incognita}
within the astronomical community \citep{deSouza2014c}. 

One particular problem which presents itself as a candidate for the implementation of GLMs is the photometric redshift (\photz{}) estimation of galaxies. Although precise redshifts can in principle be directly determined through identification of known absorption or emission lines in the optical and/or near-infrared spectrum of each target galaxy, the  observational cost of this procedure can quickly become prohibitive for large scale surveys. The only feasible alternative in such cases is to use available multi-wavelength photometry to infer approximate \photz{}s instead, but this is not always a simple task.

There exist a plethora of different spectra emitted from galaxies throughout the Universe. Their characteristic features carry signatures from the galaxy's morphology, age, metallicity, star formation history, merging history, and a host of other confounding factors in addition to its redshift. Thus, making \photz{} estimation a far from trivial task. There exist several techniques which are commonly used to estimate redshifts from photometry and can be  divided in to: (i) template fitting techniques~\citep[e.g.,][]{benitez2000,bolzonella2000,ilbert2006}, and (ii) ML (or empirical) techniques \citep[e.g.][]{connolly1995, collister2004, wadadekar2005, miles2007, omill2011, reis2012, Krone-Martins14a}.
 In template fitting techniques, a set of synthetic spectra are determined from synthesised stellar population models for a given set of metallicities, star formation histories and initial mass functions, among other properties. The \photz{} is calculated by determining the synthetic photometry (and thus spectral template and redshift) which best fits the photometric observations. ML techniques, on the other hand, usually require a data set with spectroscopically measured redshifts to train the chosen method.

Many studies have examined the individual advantages of each \photz{} code~\citep[for a glimpse on the diversity of existent methods, see][and references therein]{hildebrandt2010, abdalla2008, zheng2012, Sanchez14a}. \citealt{abdalla2008} investigated the differences between five commonly used template fitting codes and a neural network. The neural network proved to be more reliable in redshift ranges with a higher density of training data, while the template fitting methods depended heavily on the underlying templates. Despite these caveats, the overall performance of all codes were, to first order, consistent and displayed catastrophic errors ranging from $5-9\%$, which is considered good in terms of \photz{} estimates~\citep{abdalla2008}. More recently, methods which combine several \photz{} techniques in a Bayesian approach, coined ensemble learning, have begun to be implemented with the hope that they can complement each other{\bf '}s drawbacks~\citep{Carrasco14a}.

One of the largest practical difficulties for the current \photz{} methods is the time necessary to either fit the templates or train the underlying ML method; on top of that, the required size of the training set is often highly influential for empirical methods~\citep[][]{Firth03a}. \emph{Big data} catalogues expected from large sky surveys, like the \textit{Large Synoptic Survey Telescope}\footnote{\url{http://www.lsst.org/lsst}} \citep{lsst},  \textit{EUCLID}\footnote{\url{http://sci.esa.int/euclid}} \citep{euclid} or the \textit{Wide-Field Survey Infrared Telescope}\footnote{\url{http://wfirst.gsfc.nasa.gov}} \citep{wfirst}, warrant the need for fast and reliable \photz{} methods that are capable of processing such large volumes of data in minutes to days rather than years,  thereby facilitating higher level analyses and model refinements for downstream data products.

In this work, we introduce a new technique based on robust principal component analysis (PCA) and GLMs to estimate \photz{}s. The method runs in a matter of seconds on a single core computer, even for millions of objects. In addition, we achieved very low levels of  catastrophic errors when using training sets of a few thousands objects. The combination of short computational run time, moderate training set size, and small catastrophic errors makes GLMs a robust and implementable technique for future large scale surveys. 

The outline of this article is as follows. In \S \ref{sec:method}, we give a broad overview of GLMs, in \S \ref{sec:data} we provide a description of the data set utilised. The methodology implemented is outlined in \S \ref{sec:imp}. We then present our results and compare with the recent literature in \S \ref{sec:res} and summarise our conclusions in \S \ref{sec:conclusion}.

% -------------------- /



% /--------------------
% Overview

\section{Overview of Regression Methods}
\label{sec:method}

Before we delve into the details of GLMs and the gamma family, we make a brief overview of linear regression, a common tool used  within astrophysics. Afterwards, we explicitly outline the details of GLMs with the gamma family and explain how it can be applied to determine \photz{}s for a particular  data set. 

\subsection{Overview of Linear Regression}

Consider a given data set containing $N$ (distinct objects; e.g., galaxies), \[\mathcal{D}=\{(x_1, y_1), (x_2,y_2),...,(x_N,y_N)\},\] where the $x_i$ are observations of the independent variable, $X$, and the $y_i$  are observed values of a dependent random variable (RV), $Y$, which is a function of $X$, $Y=f(X)$. Traditionally, $X$ is called the \textit{explanatory variable} and $Y$  the \textit{response variable}. The expected value and variance of $Y$ are denoted by E($Y$) and var($Y$), respectively. In this context, a linear model describes the response variable \textbf{($Y$)} as a linear function of the explanatory variable \textbf{($X$)}:
\begin{equation}
Y = \beta_0 + \beta_1 X + \epsilon = \eta + \epsilon,
\label{eq:linmod}
\end{equation}
where $\{\beta_0,\beta_1\}$ are scalars called \textit{slope coefficients} or \textit{covariates}, $\eta=\beta_0+\beta_1 X$ is the linear component (or \textit{predictor}) of this simple model. Finally, $\epsilon$ is an error term considered to be independent and identically distributed, $\epsilon \sim N(0,\sigma^2)$.

When a standard linear regression approach is applied, the linear predictor in equation \ref{eq:linmod} is assumed to fully describe the response variable. The measured values are used to determine the covariates of the linear predictor that uniquely identify a straight line through the chosen data set minimising the error term. Having the scalar coefficients determined, the model provides a direct relation between $X$ and $Y$, allowing one to predict the mean value of $Y$ for a given measurement of $X$.

In order to clarify the procedure described in the next subsections, we invite the reader to approach this simple linear regression problem from an alternative  perspective. Consider now each measurement, $\{x_i, y_i\}$, as a realisation of different variables $\{X_i, Y_i\}$ from a common family of probability density functions (PDFs), but with distinct parameters $\mu_i$ for each index $i$. The underlying PDF driving the behaviour of the response variable ($Y_i$) will be denoted by $f(y_i;\kappa_i)$,  where $\kappa_i$ is the parameter vector of the PDF underlying the $i$-th measurement. If $Y_i$ follows a Normal PDF with mean $\mu_i$ and variance $\sigma_i^2$, then
\begin{equation}
f(y_i;\kappa_i)=\frac{1}{\sqrt{2\pi\sigma_i^2}}\exp\left[-\frac{1}{2}\frac{\left(y_i-\mu_i\right)^2}{\sigma_i^2}\right],
\label{eq:PDF}
\end{equation}
where $\kappa_i=\{\mu_i, \sigma_i\}$. This is summarised as $Y_i\sim N(\mu_i, \sigma_i)$. For reasons which will be clarified later, we consider $\sigma_i$ a fixed value and, thus, determining $\mu_i$ is enough to completely characterise $f(y_i;\kappa_i)$. In this context, we can relate the measured $x_i$ to the expected value of the corresponding response variable, $y_i$=E($Y_i$), though the slope coefficients\footnote{If our model is correct, for each measurement the expected value should correspond on average to the measured one.}
:
\begin{equation}
y_i=\textrm{E}(Y_i)=\mu_i=\textbf{x}_i^T\bm{\beta},
\end{equation}
with $\textbf{x}_i=\{1, x_i\}$ and $\bm{\beta}=\{\beta_0, \beta_1\}$. We can now use the chosen PDF family (e.g., equation \ref{eq:PDF}) and the observed data $\mathcal{D}$ in order to find values of $\bm{\beta}$  which better describes the data. In this case, the model is composed of two main ingredients:
\begin{enumerate}[1.]
\item a PDF underlying the behaviour of each response variable, $f(y_i;\mu_i)$ and
\item a relation connecting E$(Y_i)$ with measured values of the explanatory variable, also called the \textit{link function}, $g(\textrm{E}(Y_i))=\mu_i$. 
\end{enumerate}
Once the values of parameter $\bm{\beta}$ are determined, we can use the inverse link, $g^{-1}$, to calculate the expected value for the response variable given a measured  input $x$. 

Note, that in this simple example, although the mathematical expressions in both approaches are the same, their interpretations are different. In the standard analysis, the best-fitted parameters define completely the connection between $X$ and $Y$. In the second approach, they characterize a linear relationship between measurements of $X_i$ and a parameter  which uniquely identifies a PDF underlying each response variable $Y_i$, $\kappa_i$. This approach allows us to extend the same reasoning to situations where a linear relation is not a good description of the process driving the data.
 
This example can be generalised for the case with more than one explanatory variable, forming a multiple linear model. The \textit{general linear model}\footnote{Not to be confused with General\textit{ized} Linear Models (GLMs).}  goes  one step further, including situations where there are more than one response variable. In such models the errors are considered to be uncorrelated and follow a multivariate normal distribution. Although a very useful tool, general linear models are not suited for situations where there are restrictions on $Y$ (e.g., binary, count or strictly positive data) or when the variance depends on the mean. The GLMs are a generalisation of this framework, capable of handling both scenarios. 



\subsection{Generalized Linear Models}
\label{subsec:GLMs}

This subsection presents an overview of a vast subject. For a detailed theoretical review see \citet{dobson2002} and \citet{Hil12}.
 
The example from the previous section clearly shows that the PDF is a key ingredient in the construction of a GLM framework. Moreover, the procedure relies on one main feature of the PDF:  within the chosen family, a distribution should be uniquely identified through one single parameter $\mu$ (called \textit{location} or \textit{mean}). Determining this parameter is the ultimate goal of the GLM methodology. 

In order to fulfil this requirement, GLMs are constructed for any distribution that belongs to the \textit{exponential family} of distributions (Gaussian/normal, gamma, inverse Gaussian, Bernoulli, binomial, Poisson, and negative binomial). The PDF for any member of this family can be written as

\begin{equation}
f(y;\theta) = s(y)t(\theta)e^{a(y)b(\theta)},
\end{equation}
where $s$, $t$, $a$ and $b$ are known functions and $\theta$ is the \textit{canonical parameter}. The reader may also find them as,
\begin{equation}
  f(y;\theta)  = \exp\left[a(y)b(\theta)+c(\theta)+d(y)\right],
 \label{eq:canPDForig}
 \end{equation}
with $c(\theta)=\ln[t(\theta)]$ and $d(y)=\ln[s(y)]$. 
  When $a(y)=y$, the distribution is said to be in the \textit{canonical form}.  \textit{Natural exponential distributions} are exponential ones in the canonical form with  $b(\theta)=\theta$. If there is an extra parameter $\phi$ it is considered known\footnote{In the Gaussian example described previously, $\phi=\sigma^{2}=\textrm{var}(Y)$.}. Natural exponential distributions can always take the form

 \begin{equation}
   f(y; \theta, \phi) = \exp\left\{ \frac{y\theta-A(\theta)}{B(\phi)}+C(y;\phi) \right\} 
   \label{eq:canPDF}
 \end{equation} 
 \noindent \citep[see ][section 2.3]{Hil12}. The above expression  contains $A(\theta)$, which is called the \textit{cumulant}, $B(\phi)$ the \textit{scale parameter}, $\phi$ the \textit{dispersion parameter}, and $C(\cdot; \cdot)$, the normalisation term that scales the integral to unity. For these distributions, %it is always possible to express 
  \begin{eqnarray}
    \textrm{E}(Y)   & = & A'(\theta),  \nonumber \\
    \textrm{var}(Y) & = & A''(\theta)B(\phi).
    \label{eq:canVAR}
  \end{eqnarray}
  
\noindent In the specific normal distribution example described previously, it is simple to show that $\textrm{E}(y)=\mu$ and $\textrm{var}(Y)=\sigma^{2}$. 

Two other important ingredients in the structure of a GLM model are the linear component $\eta$ and the link function $g(\cdot)$. In the simple linear regression case, $\eta$ was equivalent to our assumption of a linear relation between the explanatory and response variables and $g$ was merely the identity function ($g(\mu)=\mu$). However, when  $Y_i$ relates to $X_i$  through a non-linear expression, $\eta$ will play the important role of linearising the connection between $X_i$ and E($Y_i$).  In other words, even if we are dealing with non-linear data, we can still define the link function as
\begin{equation}
g(\mu)=\eta=\textbf{X}^T\bm{\beta},
\label{eq:linketa}
\end{equation}
given that the PDF belongs to the one parameter exponential family.
After the determination of $\bm{\beta}$, the inverse link function is used to determine $\mu$ and from this we know that $g$ must be invertible. For PDFs in the canonical form the \textit{canonical link function} is given by $b(\theta)$ (equation \ref{eq:canPDForig}).

In summary, all GLMs share a similar structure and are characterized by:

\begin{itemize}

 \item A random response component whose mean $\mu$ is to be estimated.  The response variable, $Y$, is assumed to be theoretically derived as a random sample of an underlying single parameter PDF belonging to the GLM family of distributions. The goal of modelling $Y$ is to find an unbiased estimate of the mean parameter which better describes the data. 

 \item A systematic (or linear) component, $\eta$, built from the explanatory variables, $\mathbf{X}$ (sometimes called \textit{covariates}), and their associated slope coefficients, $\bm{\beta}$. Their multiplication produces a linear predictor for each observation (equation \ref{eq:linketa}).

 \item A link function, $g(\cdot)$, which defines how the mean is associated with the explanatory variable. The link function linearises the relationship between the mean response and predictors ($X_i$). Once the slope coefficients are determined, we are able to use the inverse link and the observed $X_i$ to estimate the mean, i.e.,  

\begin{equation}
  \mu = g^{-1}(\eta).
\end{equation}

\item Conversion of the PDF to a log-likelihood function for the observed data, which is used as the basis for the determination of the slope coefficients.

\end{itemize}

\subsection{Gamma Family and Regression}

The gamma distribution is characterised by the response variable, $Y$, taking only positive real values. It is optimal when fitting positive-only values with a shape determined by its estimated parameter. As a single parameter model the GLM gamma model is limited to a specific set of values. If a second scale parameter is employed, the range of shapes allowed by the model are greatly enlarged. This is not a GLM model though. On the other hand, if the GLM gamma model does fit a given data situation, the model is more efficient and easier to interpret.

In this study we predict the \photz{} of a galaxy from multi-wavelength photometry and compare it to the measured spectroscopic redshift, $z_{\rm spec}$. As redshift is always positive and continuous, we can apply a gamma family distribution, which in its exponential family form can be expressed as \citep{Hardin01a}:
\begin{eqnarray}
  f(y;\mu, \phi) & = & \frac{1}{y\Gamma(1/\phi)}\left(\frac{y}{\mu\phi}\right)^{1/\phi}\exp\left(-\frac{y}{\mu\phi}\right)\nonumber\\
                 & = & \exp\left\{\frac{y/\mu - (-\ln\mu)}{-\phi}+C(y;\phi)\right\}, \nonumber \\
% \\
\label{eqn:gamma_model}
\end{eqnarray}
\noindent where
\begin{equation}                 
  C(y, \phi)=\frac{1-\phi}{\phi}\ln y-\frac{\ln\phi}{\phi}-\ln\Gamma\left(\frac{1}{\phi}\right).
  \label{eqn:gamma_model2}
\end{equation}

From equations \ref{eq:canPDF} and \ref{eqn:gamma_model}, we recognise the canonical parameter as  $\theta=1/\mu$, the cumulant $A(\theta)=-\ln\mu$ and the scale parameter $B(\phi)=-\phi$. Consequently, from equation~\ref{eq:canVAR}, $\mathrm{E}(y)=\mu$, and $\mathrm{var}(y)=\sigma^2=\mu^{2}\phi$. It is important to note that the GLM gamma model describes a response variable as a distribution with constant coefficient of variation, $\sigma/\mu$ (standard deviation / mean). Thus, determining $\mu$ is enough to univocally identify a distribution.

A useful feature of GLMs is that a link function can be assigned to the estimation algorithm, and it does not only have to be a natural or canonical link. For example, the log link, $g(\mu)=\ln(\eta)$, is commonly associated with the gamma model. When this is employed in place of the natural link function, the associated inverse link, $\mu=\exp(\eta)$, ensures a positive mean for any $\eta$. Unless the mean and data are inversely related statisticians typically use the log link for this continuous response model.

This is also the approach chosen for this work. In what follows, we use the log-link function $\mu^T=\log\left(\bm{\beta}^T\mathbf{X}\right)$, where $\mathbf{X}$ is a $m\times n$ matrix containing  $m$ magnitudes for each of the $n$ galaxies and $\bm{\beta}$ is the covariate  column vector. The covariates are estimated by maximising the log-likelihood of the regression model (Eqn.~\ref{eqn:gamma_model}) utilising iteratively re-weighted least-squares~\citep[see][and references therein]{Hardin01a}. 

In addition, to avoid numerical instabilities and identifiability issues it is preferable for the predictor variables, $\mathbf{X}$, not to exhibit strong correlations (i.e., \textit{multicollinearity}).
This is not necessarily the case for the magnitudes of galaxies that can be strongly correlated across different broadband filters. As a precaution against multicollinearity we carry out \textit{Principal Component Analysis} and adopt the principal components (PCs) of the observed magnitude set as our explanatory variables\footnote{For a general review on PCA, see \citet{jollife2002}. For examples of PCA use in astronomy, see also e.g. \citet{conselice2006,ishida2011,ishida2011b,ishida2013,jeeson2011, Krone-Martins14b}.}. Beyond ensuring non-correlated features, using the PCs also optimises the use of computational resource{\bf s}, as the calculation time required increases non-linearly with the number of explanatory variables. As a dimensionality reduction technique, PCA allows a robust way to increase the execution speed of the redshift estimation.

As a final remark, we emphasise that the key to understanding a statistical model is to determine how well the predicted values fit the observed ones. Each type of model, being based on a specific probability distribution, or mixture of distributions, is limited to a specific range of predicted values. That is, the distributional assumptions of a gamma distribution determine the range and shape of predicted values it can have. If the observed response values differ greatly from the possible predicted values, the model cannot fit the data well. In such a case it is important to find another model more suited to fitting the observed values. In the next sections we quantify the ability of the gamma family GLM in predicting \photz{}s of galaxies by comparison with simulations and measured spectroscopic redshifts.

% --------------------/

% /--------------------
% DATA

\section{Data}
\label{sec:data}

To compare GLMs with other methods and to better put our results in to context, we adopted a publicly available data set that was previously submitted to different \photz{} codes. The \textit{PHoto-z Accuracy Testing} (PHAT) was an international initiative to identify the most promising \photz{} methods and guide future improvements. Two observational photometric catalogues were provided: PHAT0 with simulations, and PHAT1 with real observations. A total of 17 \photz{} codes where submitted. As a direct comparison using PHAT1 is not possible, since the answers of the challenge are not openly available, we applied GLMs to PHAT0 and compare its results to those reported by \citet{hildebrandt2010}. PHAT0 has $169,520$ simulated galaxies with redshifts ranging from $z=0.02-2.24$, and magnitudes in 11 filters ($u$, $g$, $r$, $i$, $z$, $Y$, $J$, $H$, $K$, $IRAC1$, and $IRAC2$).

In addition, we apply the same technique to a real data set obtained from the {\it Sloan Digital Sky Survey} \citep[SDSS;][]{York00a}. We obtain a galaxy sample using the same selection criteria and SQL query (\ref{app:sql}) outlined in \citealt{Krone-Martins14a} from the most recent Data Release 10 \citep{Ahn14a}. This results in a sample of $1,347,640$ galaxies with a redshift range of $z=0-1.0$, with magnitudes in 5 filters ($u'$, $g'$, $r'$, $i'$, and $z'$). To compare the same data set, but with dereddened magnitudes, we also use the SQL query outlined in \citealt{Carrasco14a}.

% -------------------- /

% /--------------------
% METHODOLOGY

\section{Methodology}
\label{sec:imp}

On the basis of making GLM modelling easily accessible to the community, we have developed a set of \photz{} packages which can be used on any multi-wavelength data set~\citep{desouza14b}. The codes are written in both \texttt{R}\footnote{\url{www.r-project.org/}} (\ref{app:R}), a programming language commonly used in the statistical sciences, and \texttt{Python}\footnote{\url{www.python.org/}} (\ref{app:python}) which  is becomingly widely adopted in the astronomical community. In addition, we have implemented a web application using the \texttt{Shiny}\footnote{\url{shiny.rstudio.com/}} (\ref{app:shiny}) platform whereby users can upload their data set and have the \photzs{} and diagnostic plots delivered. We adopted the following step-by-step methodology to determine the \photzs{} of a sample of galaxies using their multi-wavelength photometry.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}
   \includegraphics[width=9cm]{phat0_kde_2d.pdf}
   \includegraphics[width=9cm]{sdss_kde_2d.pdf}
   \caption{The 2D probability density of the predicted redshift from the GLM fit vs. the spectroscopic redshift (central plots). The upper and right subplots in each panel depict the redshift distribution along \photz{} and $z_{\rm spec}$, respectively. We note that this is a randomised subsample amounting to 10,000 galaxies. {\bf Top}: Results for the PHAT0 sample (green). {\bf Bottom}: Results from the SDSS sample (purple).
   }
  \label{fig:kde_plot_2d}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{enumerate}[1.]

  \item The data was randomly split into training and test sets with the training sample holding at least $10\%$ of the number of galaxies (see section \ref{subsec:caveats} for a detailed analysis on the influence of this choice in our final results.). 
  
  \item Robust principal component analysis (e.g., \citealt{Candes11a,desouza2014}) was carried out on the complete data set, training and test, to ensure the PCs are not dominated by one of the two samples. We note that this corresponds to a semi-supervised technique since, that data without any measured redshifts can help determine the PCs \citep[see, e.g.,][]{shah2008svm}. The threshold on cumulative percentage of total variance was set to $\sim 99.5\%$ in order to determine the number of PCs to be used with the GLM. 
 
  \item We utilised a gamma family distribution to reflect the fact that measured redshifts are positive and continuous. The relationship between the redshift and the explanatory variables (our linear predictor; equation~\ref{eq:linketa}) took the \texttt{R} formula form of 
  \begin{equation}
    z_{\rm phot} \sim PC_{1}^2 + PC_{1}*PC_{2}*....*PC_{n} + \rm C, 
    \label{eqn:formula}
  \end{equation}
  \noindent where $n$ is the number of principal components and $C$ is a constant. \texttt{R} formula of this kind are called \textit{simple factorial model formulae}, where the $*$ is a \textit{crossing} operator, which allows the inclusion of interaction terms. For example, $A*B=A+B+A\cdot B$~\citep[for a full description see,][]{nel65}. This formula was fit using iteratively re-weighted least squares. We note that tests using a simple formulation without interaction terms are inadequate in capturing the complexity of the data.
  
  \item The predicted \photz{} for the test data was calculated using the principal component projections of the test data set and the best-fit GLM using the training sample.
  
  \item To measure how well the \photzs{} were estimated, we employed a metric commonly used in the literature, specifically, the catastrophic error (or outlier rate/fraction). We applied two definitions of this metric: one used for the PHAT0 sample by \citealt{hildebrandt2010}, and the second used more commonly in the literature and the PHAT1 sample by \citealt{hildebrandt2010}. We define them respectively as:
  {
  \begin{enumerate}
          \item {\begin{equation}
                 O^{(a)} = \Delta z^{(a)} > 0.10,
                 \end{equation}
         \noindent where $\Delta z^{(a)} = |z_{\rm phot}-z_{\rm spec}|$, and
         }
         
         \item {\begin{equation}
                 O^{(b)} = \Delta z^{(b)} > 0.10,
                 \end{equation}
         \noindent where $\Delta z^{(b)} = \frac{|z_{\rm phot}-z_{\rm spec}|}{1+z_{\rm spec}}$.
         }
   \end{enumerate}
  }
  
\end{enumerate}

% -------------------- /


\begin{figure*}
   \includegraphics[width=9cm]{phat0_violin.pdf}
   \includegraphics[width=9cm]{sdss_violin.pdf}
   \caption{Violin plots that depict the probability density of \photz{} errors per redshift bin, $\Delta z_{\rm spec}=0.1$, determined from the entire galaxy sample. In each violin the central dashed line is the median and the dotted lines are the 25\% and 75\% quartiles. {\bf Left}: Results from PHAT0 sample (green). {\bf Right}: Outcomes from SDSS sample (purple).}
  \label{fig:violin_plot}
\end{figure*}

% /--------------------



% /--------------------
% RESULTS

\section{Results}
\label{sec:res}

\subsection{Simulation}
\label{subsec:simulation}

The PHAT0 data set was fit using the gamma family with a log link. We split the data into training and testing with a ratio of 1:9, respectively. This criterion resulted in a training size of 33,904 galaxies and a testing set of 135,616 galaxies. Decomposition by PCA showed that at least 6 components needed to be used to ensure that $99.5\%$ of the variance was retained. The best-fit GLM is shown in Fig. \ref{fig:kde_plot_2d} (top panel) which presents a catastrophic error rate of $O^{(a)}=4.4\%$. The time taken to fit amounted to $170$ seconds on an AMD Athlon X2 Dual-Core QL-64 processor with $1.7\, \rm GB$ RAM on the Ubuntu  10.04 operating system, which represents an old laptop at today's standards. We note that changing either the training set size or the number of PCs does not dramatically alter the solution. For example, using 8 PCs ($99.95\%$ variance) results in $O^{(a)}=2.5\%$ catastrophic errors determined in $1200$ seconds or 10 PCs results in $O^{(a)}=1.4\%$ in $4948$ seconds. 

The central plot in Fig.~\ref{fig:kde_plot_2d} (top panel) shows $z_{\rm spec}$ compared with the \photz{} calculated from our GLM gamma model, while the top and right plots represent their individual distributions for the entire redshift range. Numerical diagnostics for such results are displayed in Table \ref{tab:diag}. Fig.~\ref{fig:violin_plot} (left panel) details the redshift distribution of \photz{} calculated for PHAT0 in bins of $\Delta z_{\rm spec}=0.1$. There is a tendency for a larger bias to be present in higher redshifts ranges, reflecting the characteristics of the training set. In these regions, not only does the data quality decrease significantly, but there is also an observational effect that favours brighter galaxies. Thus, the presence of such biases are not completely unexpected. However, investigating if there is a preference for under/over estimation of \photz{} within the GLM framework would require a $k$-fold cross-validation analysis which is out of the scope of this work. We do highlight though, that such a study is crucial for a potential user that aims to optimise their \photz{} results.

We note that our results give a slightly larger catastrophic error than compared with the literature. However, we highlight that the simulated data set was created from template techniques and, as such, a lower catastrophic error would suggest that the technique has results that reflect those to template fitting rather than the absolute performance of the technique~\citep{hildebrandt2010}. Finally, after demonstrating that the GLM gamma model has competitive capabilities in comparison with other techniques, we investigated its absolute ability with observed data sets.

\begin{table*}
\vspace{-2cm}
\caption{Diagnostic comparison of samples}
\begin{tabular}{p{9cm} l l l l}
\hline
Code & Type$^{a}$ & $\mathrm{bias}_{z}^{b}$ & $rms(\Delta z)^{c}$ & Outlier rate \\
\hline
& & & & $\%$ \\
\hline

PHAT0 & & & & \\
{\bf This work} & Empirical & 0.033 & 0.025  & 1.367 (10 PCs) \\
                & &      &        & 2.511 (8 PCs) \\ 
                & &      &        & 4.438 (6 PCs) \\
Le PHARE$^{d}$ & Template & 0.000 & 0.010 & 0.044 \\
Bayesian Photo-{\it z}'s$^{d}$ & Template & -0.005 & 0.011 & 0.026 \\
Easy and Accurate $Z_{\rm phot}$ from Yale$^{d}$ & Template & -0.001 & 0.012 & 0.000 \\
GALaxy EVolution and GAZELLE$^{d}$ & Template & 0.000 & 0.014 & 0.053 \\
GOODZ$^{d}$ & Template & 0.000 & 0.012 & 0.018 \\
HyperZ$^{d}$ & Template & -0.002 & 0.013 & 0.185 \\
Low-Resolution Spectral Templates$^{d}$ & Template & 0.000 & 0.011 & 0.026 \\
Purger (template repair)$^{d}$ & Template & -0.005 & 0.011 & 0.053 \\
Zurich Extragalactic Bayesian Redshift Analyzer $^{d}$ & Template & 0.000 & 0.011 & 0.062 \\
Zurich Extragalactic Bayesian Redshift Analyzer (modified)$^{d}$ & Template & -0.005 & 0.011 & 0.044 \\
Artificial Neural Network \photz{}$^{d}$ & Empirical & 0.000 & 0.011 & 0.018 \\
Boosted Decision Trees$^{d}$ & Empirical & -0.004 & 0.019 & 0.389 \\
Purger (nearest-neighbour Fit)$^{d}$ & Empirical & 0.000 & 0.017 & 0.053 \\
Polynomial fitting$^{d}$ & Empirical & 0.001 & 0.019 & 1.669 \\
Regression Trees$^{d}$ & Empirical & 0.000 & 0.013 & 0.010 \\
Singal Neural Networks$^{d}$ & Empirical & -0.005 & 0.049 & 18.202 \\

\hline\hline

SDSS & & & & \\

{\bf This work} & Empirical & 0.038 & 0.029 & 6.44 (5 PCs) \\
                &  &     &       & 8.09  (4 PCs) \\
Eureqa (Symbolic Regression)$^{e}$ & Empirical & 0.009 & 0.045 & $1-10$ \\
Eureqa (Symbolic Regression)$^{f}$ & Empirical & 0.009 & 0.045 & $10-100$ \\
\hline
{\bf This work$^{\dagger}$} & Empirical & 0.030 & 0.034 & 2.25 (5 PCs) \\
                            & &      &       & 2.90 (4 PCs) \\
Trees for Photo-$z$$^{g,\dagger}$ & Empirical & 0.019 & 0.014 & 0.78 \\
Self-Organizing Maps Photo-$z$ $^{g,\dagger}$ & Empirical & 0.020 & 0.015 & 0.70 \\
Bayesian Photo-{\it z}'s$^{g,\dagger}$ & Template & 0.023 & 0.016 & 1.34 \\
Weighted Average$^{g,\dagger}$ & Hybrid & 0.020 & 0.014 & 0.82 \\
Weighted Average, oracle weighting scheme$^{g,\dagger}$ & Hybrid & 0.019 & 0.014 & 0.67 \\
Weighted Average, shape weighting scheme$^{g,\dagger}$ & Hybrid & 0.019 & 0.014 & 0.81 \\
Weighted Average, fit weighting scheme$^{g,\dagger}$ & Hybrid & 0.020 & 0.014 & 0.90 \\
Bayesian Model Averaging$^{g,\dagger}$ & Hybrid & 0.018 & 0.013 & 0.60 \\
Bayesian Model Combination$^{g,\dagger}$ & Hybrid & 0.018 & 0.013 & 0.59 \\
Hierarchical Bayes$^{g,\dagger}$ & Hybrid & 0.020 & 0.014 & 0.84 \\
\hline
\label{tab:diag}

\end{tabular}
\noindent {\bf Notes.} All codes use the $O^{(a)}$ outlier fraction, unless a dagger ($\dagger$) is placed next to them, for which the $O^{(b)}$ definition is used. $^{a}$ Methods classification: \textit{Empirical}: uses a machine learning technique that usually require supervised or unsupervised learning from a training data set, \textit{Template}: uses synthetic galaxy spectra created from stellar population models, and \textit{Hybrid}: uses  a combination of Template and Empirical methods, applying different weighting schemes to aggregate their results. $^{b}$ Average of $\Delta z$ without the outliers. $^{c}$ Root mean square of $\Delta z$ without the outliers. $^{d}$ Diagnostics presented in \citet{hildebrandt2010}. $^{e}$ \citet{Krone-Martins14a} for $z<0.7$. $^{f}$ \citet{Krone-Martins14a} for $z \geq 0.7$. $^{g}$ Fit diagnostics obtained from \citet{Carrasco14a}.
\end{table*}

\subsection{Real Data}
\label{subsec:realdata}

The SDSS data set was randomly split into training and test sets. The size of the training set was selected such that the catastrophic error plateaued in value.  Initial tests show that the catastrophic errors become stable for training sets that contain more than 500 galaxies and plateaus at around $4,000$ galaxies. We adopt $10,000$ galaxies for the training data set. The PCA decomposition requires only 4 PCAs to retain $99.5\%$ of the variance. This combination of training sample and number of principal components results in a catastrophic error of $O^{(a)}=8.087\%$ within $10$ seconds. Including all 5 components and increasing to a training set size of $50,000$ results in an improvement to $O^{(a)}=6.439\%$. We outline a selection of other diagnostics in Table \ref{tab:diag}.


\subsection{Caveats \& Improvements}
\label{subsec:caveats}

The use of a GLM to predict \photzs{} can achieve competitive estimates with catastrophic errors of the order of $1-5\%$, comparable with current techniques. It is important to note that there is a wide range of choices that the user can make for their own data set to meet the needs of its use. The most dominant parameters are the size of the training set and the number of principal components used. As one would expect, the time taken increases when both of these parameters are increased and there will be some variation in the resulting catastrophic errors. Figures \ref{fig:caveat_trainsize} and \ref{fig:caveat_pcasize} depict the catastrophic error rate as a function of training set size and number of PCAs used, respectively.


\begin{figure}
   \includegraphics[width=9cm]{phat0_kde_1d.pdf}
   \includegraphics[width=9cm]{sdss_kde_1d.pdf}
   \caption{The probability density of the number of outliers. {\bf Top}: Results from  PHAT0 sample (green). {\bf Bottom}: Results from the SDSS sample (purple).}
  \label{fig:kde_plot_1d}
\end{figure}


In addition, as with all ML techniques, one must choose the type of formula used so as to ensure the training data is not over fitted. Increasing the order of the polynomial in equation~\ref{eqn:formula} or including more cross terms will decrease the overall catastrophic error, but will also increase the running time. Such caveats are best left for the user, the catalogue in question, and the needs and requirements of the output photometry. 

Another viable use of GLMs is to make extrapolated predictions of \photz{}s of high-redshift galaxies by learning on low-redshift galaxies. Like other machine learning techniques, GLMs can over-fit the data and make incorrect predictions.
However, GLMs have the advantage that they are not (and should not) be treated as black boxes, like many other empirical and template techniques, e.g. neural networks~\citep{Werner07a}. Instead, the underlying assumptions can be modified, for example: the formula adopted (equation \ref{eqn:formula}), and the underlying effect of the covariates (PCs). As already noted, the relevance of each covariate can be investigated to determine their importance in the model and reveal a physical interpretation. Even though in our analysis we have used PCA to uncorrelate the magnitudes, the resulting influence of each magnitude in the model (the physical interpretation) can still be obtained indirectly from the PCs using techniques such as \textit{projection to latent structures}~\citep{Sasdelli14a}. In combination with a cross-validation process, this would allow the user to optimise the GLM for their needs (e.g. extrapolating predictions) and would highlight the relevance of the covariates in the determination of their wanted values. Furthermore, the extrapolated prediction will still have two inherent gamma features: (i) non-negative values and (ii) heteroscedasticity, consistent with what we expect from the galaxy photometric redshift distributions.

\begin{figure}
   \includegraphics[width=9cm]{caveat_train_size.pdf}
   \includegraphics[width=9cm]{caveat_time_taken_train.pdf}
   \caption{{\bf Top}: Catastrophic error of \photz{} vs. the size of the training set, for the PHAT0 data. {\bf Bottom}: Time taken to complete the GLM fitting as a function of number of elements in the  training set.}
  \label{fig:caveat_trainsize}
\end{figure}

\begin{figure}
   \includegraphics[width=9cm]{caveat_pca_size.pdf}
   \includegraphics[width=9cm]{caveat_time_taken_pca.pdf}
   \caption{{\bf Top}: Catastrophic error of the fitted \photz{} vs. the number of principal components for the PHAT0 data, considering a fixed training set with 8000 galaxies. {\bf Bottom}: Time taken to complete the GLM fitting as a function of the number of PCs used.}
  \label{fig:caveat_pcasize}
\end{figure}

In this study, we have shown that gamma GLMs can speedily and efficiently compute photometric redshifts of galaxies. However, this initial case study could be built upon and improved. This is not within the scope of this paper, but we outline some techniques that could be used to make our methodology better. We emphasis that, although there are a variety of different techniques available to approach the \photz{} problem, GLMs provide a straightforward and statistically coherent way of including the modelling (prior) within the regression process. This is done through the choice of the family distribution. Traditional regression methods can sometimes yield negative, non-physical values, which we have avoided from the start by using the gamma family distributions. Thus, the enhancements cited bellow are all within this framework.

To determine how to further develop this methodology, we utilise a standard diagnostic, in statistics, called the Q-Q (quantile-quantile) plot. We compare the residuals of the best-fit gamma model of the PHAT0 data set to a gamma distribution, as seen in Fig. \ref{fig:qqplot}. When the two distributions are similar it is expected that a straight line will go through the data set, as is seen in our case (red line). As the best-fit line is shallower than a normal $y=x$ line, this implies that the theoretical gamma distribution is more dispersed than the sample PHAT0 distribution. There is a deviation at the lower quartiles ($<1$) that suggests the residuals are deviating from a gamma. This skewing towards lower quantiles is alleviated when selecting galaxies that lie in the redshift range $0.25<z<1.0$. One way to address this problem would be to consider more complex models such as generalized additive models for location, scale and shape~\citep[GAMLSS;][]{Stasinopoulos07a}. GAMLSS are more lenient and do not  require an exponentiated family distribution to be used, but instead a general distribution family that can be highly skewed, kurtotic, and/or continuous and discrete. Investigation of such models is not within the scope of this paper, but are expected to be addressed  in future versions of the code.

\begin{figure}
  \includegraphics[width=9cm]{qqplot_gamma.pdf}
  \caption{A Q-Q plot of the residuals of the best fit gamma model compared to a gamma distribution. For visual reasons we have clipped one outlier at $y=6.5$. See the text for an interpretation of the plot.}
  \label{fig:qqplot}
\end{figure}


% -------------------- /



% /--------------------
% CONCLUSIONS

\section{Conclusions}
\label{sec:conclusion}

Generalized linear models are widely used through a multitude of academic disciplines, but have been relatively untouched throughout the astronomical community. Their straight forward implementation and possibility of allowing physically relevant  predictions make GLMs a great candidate for competing with conventional methods of modelling that are more often turning to techniques involving ML, and more specifically neural networks. For the case of photometric redshifts, an adoption of a gamma family reflects two important characteristics of the data: (i) a non-negative and continuous measurement, and (ii) heteroscedasticity, i.e., the variance of the photo-$z$ measurements changes according to the redshift. The gamma GLM intrinsically assumes that higher values of photo-$z$ have a larger intrinsic scatter.

Upcoming wide field sky surveys, such as the LSST, will take the challenge of determining \photz{}s to an unprecedented scale. To this end, we have outlined the use of GLMs to tackle the problem of estimating \photz{}s for large samples of galaxies from their multi-band photometry in a semi-supervised learning manner. We demonstrate that GLMs can be trained on $50,000$ galaxies with $5$ principle components in $3$ seconds and $10$ principle components in $10$ minutes, using a standard laptop (AMD Athlon X2 Dual-Core QL-64 processor with $1.7\, \rm GB$ RAM on the Ubuntu 10.04 OS),  and can reach catastrophic errors of $1-5\%$, comparable with current techniques involving template fitting or ML.

In summary, GLMs offer a simple and efficient way of tackling many problems within astronomy that are usually computationally heavy or require large training samples. To promote their use within the astronomical community we have developed a suite of libraries and a web application to allow GLMs to be used to determine \photzs{} from a user's own galaxy sample with a simple click of a button. 

% -------------------- /



% /--------------------
% ACKNOWLEDGEMENTS

\section*{Acknowledgments}
We thank V. Busti, E. D. Feigelson, M. Killedar, J. Buchner,  and A. Trindade for interesting suggestions and comments. 
JE, RSS and EEOI thank the SIM Laboratory of the \emph{Universidade de Lisboa} for hospitality during the development of this work. 
Cosmostatistics Initiative (COIN)\footnote{\url{https://asaip.psu.edu/organizations/iaa/iaa-working-group-of-cosmostatistics}} is a non-profit organisation whose aim is to nourish the synergy between astrophysics, cosmology, statistics and machine learning communities.
This work was partially supported by the ESA VA4D project (AO 1-6740/11/F/MOS). AKM thanks the Portuguese agency \emph{Funda\c c\~ao para Ci\^encia e Tecnologia} -- \emph{FCT}, for financial support (SFRH/BPD/74697/2010). EEOI is partially supported by the Brazilian agency CAPES (grant number 9229-13-2). Work on this paper has substantially benefited from using the collaborative website AWOB\footnote{\url{http://awob.mpg.de}} developed and maintained by the Max-Planck Institute for Astrophysics and the Max-Planck Digital Library. This work was written on the collaborative \texttt{WriteLatex} platform\footnote{\url{www.writelatex.com}}, and made use of the GitHub\footnote{\url{www.github.com}} a web-based hosting service and \texttt{git} version control software. This work made use of the cloud based hosting platform \texttt{ShinyApps.io}\footnote{\url{http://www.shinyapps.io}}. This work used the following public scientific Python packages \texttt{scikit-learn} \texttt{v0.15}\footnote{\url{github.com/scikit-learn}}~\citep{Pedregosa11a}, \texttt{seaborn v0.3.1}\footnote{\url{github.com/mwaskom/seaborn}}, and \texttt{statsmodels v0.6.0}\footnote{\url{github.com/statsmodels}}. Funding for SDSS-III\footnote{\url{http://www.sdss.org}} has been provided by the Alfred P. Sloan Foundation, the Participating Institutions, the National Science Foundation, and the U.S. Department of Energy Office of Science.

% -------------------- /



% /--------------------
% REFERENCES

\bibliography{glm_photoz}
\bibliographystyle{model2-names}

% -------------------- /


% /--------------------
% APPENDIX

\appendix
\label{sec:appendix}

\section{R package}
\label{app:R}

The R package is publicly available.
%
It can be obtained either through CRAN (Comprehensive R Archive Network) using the package name \texttt{CosmoPhotoz}, or through the COIN GitHub repository\footnote{\url{https://github.com/COINtoolbox/COSMOPhotoz/}}. The stable CRAN release can be easily installed from within R using the standard function \texttt{install.packages()}, while the GitHub version can be installed via the function \texttt{install\_github()} from the package \texttt{devtools}.

There are two ways to perform the photometric redshift estimation using the R package. The simplest, but less flexible, way is to perform a direct call to the \texttt{CosmoPhotoZestimator()} function using two data frames: one containing the data adopted for training, and another containing the photometric data for photometric redshift estimation. The code bellow shows how to perform the redshift estimate using the PHAT0 data included in the package.

\lstset{
	language=R,
	keywordstyle=\bfseries\ttfamily\color[rgb]{0,0,1},
	identifierstyle=\ttfamily,
	commentstyle=\color[rgb]{0.133,0.545,0.133},
	stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},
	showstringspaces=false,
	basicstyle=\footnotesize,
	numberstyle=\tiny,
	numbers=left,
	stepnumber=1,
	numbersep=8pt,
	tabsize=2,
	breaklines=true,
	prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
	breakatwhitespace=false,
	aboveskip={1.5\baselineskip},
  columns=fixed,
  upquote=true,
  extendedchars=true,
 backgroundcolor=\color{gray!5},
}
\begin{lstlisting}
  library(CosmoPhotoz)
  data(PHAT0train)#Data for training
  data(PHAT0test)#Data for estimation
  # Run the analysis 
  photoZest <- CosmoPhotoZestimator(PHAT0train,
  PHAT0test, numberOfPcs=6)
  # Not using robust PCA is considerably faster, 
  # but the results are worse
  photoZestN <- CosmoPhotoZestimator(PHAT0train, 
  PHAT0test,  numberOfPcs=6, 
  robust=FALSE) 
  # Create a boxplot showing the results
  plotDiagPhotoZ(photoz = photoZest, 
  specz = PHAT0test$redshift, 
  type = "box")
\end{lstlisting} 

The most flexible way to use the package, however, is to perform a step by step analysis using the individual functions provided. The following code exemplifies how it is possible to perform the redshift estimate using some of such functions.

\begin{lstlisting}
  library(CosmoPhotoz)
  data(PHAT0train)# Data for training
  data(PHAT0test)# Data for estimation
  
  # Combine the training and test data and 
  # calculate the principal components
  PC_comb <- computeCombPCA(
  subset(trainData,select=c(-redshift)),
  subset(testData, select=c(-redshift)),
  robust=TRUE)
  Trainpc <- cbind(PC_comb$x, 
  redshift=trainData$redshift)
  Testpc <- PC_comb$y
  
  # Formula based on the PCs
  formM <- redshift~poly(Comp.1,2)*
  poly(Comp.2,2)*Comp.3*Comp.4*
  Comp.5*Comp.6
          
  # GLM fitting
  Fit <- glmTrainPhotoZ(Trainpc, formula=formM, 
  method="Bayesian", family="gamma")
          
  # Photo-z estimation
  photoZtest <- glmPredictPhotoZ(Fit$glmfit, newdata=Testpc, 
  type="response")
  
  # Print Photo-z estimation
   print(photoZtest$photoz)
  
  # Estimate confidence intervals errors  
  photoz_temp <- predict(Fit$glmfit, newdata=Testpc, type="link", se.fit = TRUE)
  photoz <- photoz_temp$fit
  
  critval <- 1.96 ## approx 95% Confidence Interval
  upr <- photoz_temp$fit + (critval * photoz_temp$se.fit)
  lwr <- photoz_temp$fit - (critval * photoz_temp$se.fit)
  fit <-  photoz_temp$fit
  
  fit2 <- Fit$glmfit$family$linkinv(fit)
  upr2 <- Fit$glmfit$family$linkinv(upr)#upper limit
  lwr2 <- Fit$glmfit$family$linkinv(lwr)#lower limit
  
  
  print(upr2)# upper limit
  print(lwr2)# lower limit
    
  # Create a boxplot showing the results
  plotDiagPhotoZ(photoz = photoZtest$photoz, 
  specz = PHAT0test$redshift, 
  type = "box")
\end{lstlisting}           

The functions provided by the package and that are visible to the user are: 

\begin{enumerate}[1.]
  \item \texttt{computeCombPCA()}
  Computes PCA projections of the combined data sets.
  
  \item \texttt{computeDiagPhotoZ()}
   Computes a list of summary statistics of the redshift estimation (mean, sd, median, mad, outliers).

  \item \texttt{CosmoPhotoZestimator()}
   Computes redshift estimates from photometric data and a training data set with photometry and spectroscopy. The estimation is based on GLMs.
  
  \item \texttt{glmPredictPhotoZ()}
Predicts photometric redshifts   for  a given a GLM fit object.
  
  \item \texttt{glmTrainPhotoZ()}
  Fits a GLM for photometric redshift estimation. A Bayesian fit or a normal fit may be adopted, using the link functions gamma and inverse Gaussian. 
  
  \item \texttt{plotDiagPhotoZ()}
  Plots diagnostics for redshift estimations. The following types of plot are available: 1D kernel density estimation of the errors (\texttt{errordist}), observed versus predicted 2D density plot (\texttt{predobs}), a violin and a box plot with errors at redshift bins (\texttt{errorviolins} or \texttt{box}).
   
\end{enumerate}

The packages additionally includes two dataframes, \texttt{PHAT0train} and \texttt{PHAT0test}, containing 161042 and 8478 objects, and comprising 12 variables (11 bands plus the redshift).

A detailed reference manual of the package can be found at the documentation in CRAN webpage or inside the package. 

\subsection{Shiny Package}
\label{app:shiny}

The R package is also accompanied by a shiny\footnote{\url{http://shiny.rstudio.com/}} application that can be hosted locally or deployed by the user at a webserver. This application allows the user to run the photometric redshift estimation, to configure many parameters of the code visually and experiment with the results. It also allows the user to either use the PHAT0 data, or to upload data files (the expected format can be found at the application’s help tab). A screenshot of this application can be seen in Fig. \ref{fig:shinyAppScreenshot}.

To run the interface, after installing the package it is necessary to use the following command: 
  
 \begin{lstlisting} 
 runApp(paste(find.package("CosmoPhotoz"),"/CosmoPhotoz_shiny",sep=""))
\end{lstlisting}

\begin{figure*}
\centering
   \includegraphics[width=0.925\textwidth]{CosmoPhotoz-Shiny.pdf}
   \caption{A screenshot of the Shiny web application running on the \texttt{shinyapps.io} cloud. In this screenshot the application was estimating redshifts for a subset of the PHAT0 data set. This application is publicly available at \url{https://cosmostatisticsinitiative.shinyapps.io/CosmoPhotoz}.}
  \label{fig:shinyAppScreenshot}
\end{figure*}

Finally, this application can also be used via the web. This option requires no local installation, but the actual processing may be slower. This web interface is hosted by the shinyapps.io platform\footnote{\url{http://www.shinyapps.io}}, and can be accessed directly at \url{https://cosmostatisticsinitiative.shinyapps.io/CosmoPhotoz}.

\section{Python Package}
\label{app:python}

The Python package is publicly available. The source code can be accessed directly at the COIN GitHub repository. The package can also be easily installed via the Python Package Index\footnote{\url{https://pypi.python.org/pypi/CosmoPhotoz/0.1}} using \texttt{easy\_install} or \texttt{pip}. Complete documentation is fully accessible from the \textit{Read-the-docs}\footnote{\url{http://cosmophotoz.readthedocs.org}} platform. The package can be used in two ways. The first is a binary file that can be run on the command line with little interaction required:

\lstset{
	language=Bash,
	keywordstyle=\bfseries\ttfamily\color[rgb]{0,0,1},
	identifierstyle=\ttfamily,
	commentstyle=\color[rgb]{0.133,0.545,0.133},
	stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},
	showstringspaces=false,
    basicstyle=\footnotesize,
	numberstyle=\tiny,
	numbers=left,
	stepnumber=1,
	numbersep=8pt,
	tabsize=2,
	breaklines=true,
	prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
	breakatwhitespace=false,
	aboveskip={1.5\baselineskip},
  columns=fixed,
  upquote=true,
  extendedchars=true,
 backgroundcolor=\color{gray!5},
}

  \begin{lstlisting}[language=bash] 
    run_glm.py --dataset sample.csv
    
    run_glm.py --dataset train.csv test.csv
    
    run_glm.py --dataset sample.csv
               --num_components 3
               --training_size 10000
               --family Gamma
               --link log
\end{lstlisting}

The library can also be imported in the standard way by the user. There is a \texttt{PhotoSample} class that can be fully manipulated. We give a few examples of how the class can be utilised for personal use with photometric catalogues. Firstly, just executing the analysis like the binary.

\lstset{
	language=Python,
	keywordstyle=\bfseries\ttfamily\color[rgb]{0,0,1},
	identifierstyle=\ttfamily,
	commentstyle=\color[rgb]{0.133,0.545,0.133},
	stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},
	showstringspaces=false,
	basicstyle=\footnotesize,
	numberstyle=\tiny,
	numbers=left,
	stepnumber=1,
	numbersep=8pt,
	tabsize=2,
	breaklines=true,
	prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
	breakatwhitespace=false,
	aboveskip={1.5\baselineskip},
  columns=fixed,
  upquote=true,
  extendedchars=true,
 backgroundcolor=\color{gray!5},
}

\begin{lstlisting}
 from CosmoPhotoz.photoz import PhotoSample
 # Use PHAT0 catalogue supplied
 # with the software
 UserCatalogue = PhotoSample(filename="PHAT0",\
 family="Gamma", \link="log")
 UserCatalogue.run_full()
\end{lstlisting}

Secondly, selecting a log link and only making the violin plot.

\begin{lstlisting}
 # Import the PhotoSample class
 from CosmoPhotoz.photoz import PhotoSample
 # Instantiate an object of PhotoSample class
  UserCatalogue = PhotoSample(filename="PHAT0",\
  family="Gamma", \
  link="log")

 # Select the link
  UserCatalogue.link = "log"
    
 # Carry out PCA
  UserCatalogue.do_PCA()
    
 # Split into training and test data
  UserCatalogue.split_sample(random=True)    
    
 # GLM fitting and photo-z estimation
  UserCatalogue.do_GLM()
    
 # Create a violin plot showing the results
  UserCatalogue.make_violin()
\end{lstlisting}

Finally, to determine the number galaxies required to achieve at least a catastrophic error of $5.937\%$.

\begin{lstlisting}
 # Import the PhotoSample class
 from CosmoPhotoz.photoz import PhotoSample
 import numpy as np

 #Instantiate the class
 UserCatalogue = PhotoSample(filename="PHAT0",\
 family="Gamma", \link="log")

 # Make a training size array to loop through
 train_size_arr = np.arange(500,10000,500)
 catastrophic_error = []

 # Select your number of components
 UserCatalogue.num_components = 4

 for i in range(len(train_size_arr)):
 UserCatalogue.do_PCA()
 UserCatalogue.test_size = train_size_arr[i]
 UserCatalogue.split_sample(random=True)
 UserCatalogue.do_GLM()
 catastrophic_error.append(\
 UserCatalogue.catastrophic_error)

 min_indx = np.array(catastrophic_error) < 5.937
 optimum_train_size = train_size_arr[min_indx]
    
 # Print the output to the user
 print(optimum_train_size)
\end{lstlisting}

The main methods of the \texttt{PhotoSample} class are the following:
\begin{enumerate}[1.]
  \item \texttt{\_\_init\_\_()}
  Constructor of the class. This is used to define the public attributes of the class, e.g., number of PCA components, size of the training sample, file name, etc.
  
  \item \texttt{do\_PCA()}
  Carries out PCA on the data set. Using the variance per principal component, it determines the optimal number of principal components ensuring that 99.95\% of the variance is retained.
  
  \item \texttt{split\_sample()}
  Randomly splits the sample if the user gives a single file, for which they wish to use a random sample to train and test the GLM. The method also reconstructs a final {\bf\texttt{Pandas DataFrame}} object to be used in the GLM fitting.
  
  \item \texttt{do\_GLM()}
  Instantiates the GLM class and selects the family and link type to be used. If the user does not interfere, the gamma family and inverse power link will be used, which may not be fully optimal in all situations. 
  
  \item \texttt{make\_kde\_1d()}
  Creates a plot that shows the probability density function of the outlier fraction.
  
  \item \texttt{make\_kde\_2d()}
  Creates a plot that shows the probability density function of the photometric and spectroscopic redshifts on the upper and right most axis. In the centre a 2D probability density plot is shown.

  \item \texttt{make\_violin()}
  Creates a violin plot. A violin plot shows the probability density of the outlier fraction for a given redshift interval.
  
  \item \texttt{write\_to\_file()}
  Writes the GLM \photz{} predictions to a file named \emph{glmPhotoZresults.csv} when the user supplies a \emph{filename\_test} and \emph{filename\_train}{\bf.}
  
\end{enumerate}

We note that there are slightly differences to how the \texttt{R} and \texttt{Python} codes solve the SVD matrices in the PCA step and also how they minimise the GLM. We find that the predicted redshifts from both packages have a Pearson-R value of 1, and have a spread that is of the order and smaller than the intrinsic spread of the predicted vs. measured redshifts, and are thus negligible.

\section{SDSS SQL Photometry Query}
\label{app:sql}
The following SQL code can be run on the SDSS CasJobs service \footnote{\url{http://skyserver.sdss3.org/CasJobs/}} to obtain the photometry of the galaxy sample investigated within this article.

\begin{lstlisting}[language=sql]

  SELECT s.specObjID, g.dered_u, g.dered_g, g.dered_r, g.dered_i, g.dered_z, s.z AS redshift INTO mydb.specObjAllz_cleanphoto
  FROM SpecObj As s JOIN Galaxy as g ON s.specobjid = g.specobjid, PhotoObj
  WHERE class = "GALAXY" 
      AND zWarning = 0
      AND g.objID = PhotoObj.ObjID
      AND PhotoObj.CLEAN=1
      AND s.z > 0
      AND g.dered_u > 0
      AND g.dered_g > 0
      AND g.dered_r > 0
      AND g.dered_i > 0
      AND g.dered_z > 0
\end{lstlisting}

% -------------------- /








\end{document}

glm_photoz.bbl
\begin{thebibliography}{51}
\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi
\providecommand{\url}[1]{\texttt{#1}}
\providecommand{\href}[2]{#2}
\providecommand{\path}[1]{#1}
\providecommand{\DOIprefix}{doi:}
\providecommand{\ArXivprefix}{arXiv:}
\providecommand{\URLprefix}{URL: }
\providecommand{\Pubmedprefix}{pmid:}
\providecommand{\doi}[1]{\href{http://dx.doi.org/#1}{\path{#1}}}
\providecommand{\Pubmed}[1]{\href{pmid:#1}{\path{#1}}}
\providecommand{\bibinfo}[2]{#2}
\ifx\xfnm\relax \def\xfnm[#1]{\unskip,\space#1}\fi
%Type = Article
\bibitem[{{Abdalla} et~al.(2011){Abdalla}, {Banerji}, {Lahav} and
  {Rashkov}}]{abdalla2008}
\bibinfo{author}{{Abdalla}, F.B.}, \bibinfo{author}{{Banerji}, M.},
  \bibinfo{author}{{Lahav}, O.}, \bibinfo{author}{{Rashkov}, V.},
  \bibinfo{year}{2011}.
\newblock \bibinfo{title}{{A comparison of six photometric redshift methods
  applied to 1.5 million luminous red galaxies}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{417},
  \bibinfo{pages}{1891--1903}.
\newblock \DOIprefix\doi{10.1111/j.1365-2966.2011.19375.x},
  \href{http://arxiv.org/abs/0812.3831}{\tt arXiv:0812.3831}.
%Type = Article
\bibitem[{{Ahn} et~al.(2014){Ahn}, {Alexandroff}, {Allende Prieto}, {Anders},
  {Anderson}, {Anderton}, {Andrews}, {Aubourg}, {Bailey}, {Bastien} and
  et~al.}]{Ahn14a}
\bibinfo{author}{{Ahn}, C.P.}, \bibinfo{author}{{Alexandroff}, R.},
  \bibinfo{author}{{Allende Prieto}, C.}, \bibinfo{author}{{Anders}, F.},
  \bibinfo{author}{{Anderson}, S.F.}, \bibinfo{author}{{Anderton}, T.},
  \bibinfo{author}{{Andrews}, B.H.}, \bibinfo{author}{{Aubourg}, {\'E}.},
  \bibinfo{author}{{Bailey}, S.}, \bibinfo{author}{{Bastien}, F.A.},
  \bibinfo{author}{et~al.}, \bibinfo{year}{2014}.
\newblock \bibinfo{title}{{The Tenth Data Release of the Sloan Digital Sky
  Survey: First Spectroscopic Data from the SDSS-III Apache Point Observatory
  Galactic Evolution Experiment}}.
\newblock \bibinfo{journal}{\apjs} \bibinfo{volume}{211}, \bibinfo{pages}{17}.
\newblock \DOIprefix\doi{10.1088/0067-0049/211/2/17},
  \href{http://arxiv.org/abs/1307.7735}{\tt arXiv:1307.7735}.
%Type = Article
\bibitem[{Ahrestani et~al.(2013)Ahrestani, Hebblewhite and
  Post}]{Ahrestani2013}
\bibinfo{author}{Ahrestani, F.S.}, \bibinfo{author}{Hebblewhite, M.},
  \bibinfo{author}{Post, E.}, \bibinfo{year}{2013}.
\newblock \bibinfo{title}{The importance of observation versus process error in
  analyses of global ungulate populations.}
\newblock \bibinfo{journal}{Sci Rep} \bibinfo{volume}{3},
  \bibinfo{pages}{3125}.
\newblock \URLprefix
  \url{http://www.biomedsearch.com/nih/importance-observation-versus-process-e%
rror/24201239.html}.
%Type = Article
\bibitem[{{Ben{\'{\i}}tez}(2000)}]{benitez2000}
\bibinfo{author}{{Ben{\'{\i}}tez}, N.}, \bibinfo{year}{2000}.
\newblock \bibinfo{title}{{Bayesian Photometric Redshift Estimation}}.
\newblock \bibinfo{journal}{\apj} \bibinfo{volume}{536},
  \bibinfo{pages}{571--583}.
\newblock \DOIprefix\doi{10.1086/308947},
  \href{http://arxiv.org/abs/arXiv:astro-ph/9811189}{\tt
  arXiv:arXiv:astro-ph/9811189}.
%Type = Article
\bibitem[{{Bolzonella} et~al.(2000){Bolzonella}, {Miralles} and
  {Pell{\'o}}}]{bolzonella2000}
\bibinfo{author}{{Bolzonella}, M.}, \bibinfo{author}{{Miralles}, J.M.},
  \bibinfo{author}{{Pell{\'o}}, R.}, \bibinfo{year}{2000}.
\newblock \bibinfo{title}{{Photometric redshifts based on standard SED fitting
  procedures}}.
\newblock \bibinfo{journal}{\aap} \bibinfo{volume}{363},
  \bibinfo{pages}{476--492}.
\newblock \href{http://arxiv.org/abs/arXiv:astro-ph/0003380}{\tt
  arXiv:arXiv:astro-ph/0003380}.
%Type = Book
\bibitem[{Brown et~al.(1993)Brown, Rothery et~al.}]{bro93}
\bibinfo{author}{Brown, D.}, \bibinfo{author}{Rothery, P.}, et~al.,
  \bibinfo{year}{1993}.
\newblock \bibinfo{title}{Models in biology: mathematics, statistics and
  computing.}
\newblock \bibinfo{publisher}{John Wiley \& Sons Ltd.}
%Type = Article
\bibitem[{Cand\`{e}s et~al.(2011)Cand\`{e}s, Li, Ma and Wright}]{Candes11a}
\bibinfo{author}{Cand\`{e}s, E.J.}, \bibinfo{author}{Li, X.},
  \bibinfo{author}{Ma, Y.}, \bibinfo{author}{Wright, J.}, \bibinfo{year}{2011}.
\newblock \bibinfo{title}{Robust principal component analysis?}
\newblock \bibinfo{journal}{J. ACM} \bibinfo{volume}{58},
  \bibinfo{pages}{11:1--11:37}.
\newblock \URLprefix \url{http://doi.acm.org/10.1145/1970392.1970395},
  \DOIprefix\doi{10.1145/1970392.1970395}.
%Type = Article
\bibitem[{{Carrasco Kind} and {Brunner}(2014)}]{Carrasco14a}
\bibinfo{author}{{Carrasco Kind}, M.}, \bibinfo{author}{{Brunner}, R.J.},
  \bibinfo{year}{2014}.
\newblock \bibinfo{title}{{Exhausting the information: novel Bayesian
  combination of photometric redshift PDFs}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{442},
  \bibinfo{pages}{3380--3399}.
\newblock \DOIprefix\doi{10.1093/mnras/stu1098},
  \href{http://arxiv.org/abs/1403.0044}{\tt arXiv:1403.0044}.
%Type = Article
\bibitem[{{Collister} and {Lahav}(2004)}]{collister2004}
\bibinfo{author}{{Collister}, A.A.}, \bibinfo{author}{{Lahav}, O.},
  \bibinfo{year}{2004}.
\newblock \bibinfo{title}{{ANNz: Estimating Photometric Redshifts Using
  Artificial Neural Networks}}.
\newblock \bibinfo{journal}{\pasp} \bibinfo{volume}{116},
  \bibinfo{pages}{345--351}.
\newblock \DOIprefix\doi{10.1086/383254},
  \href{http://arxiv.org/abs/arXiv:astro-ph/0311058}{\tt
  arXiv:arXiv:astro-ph/0311058}.
%Type = Article
\bibitem[{{Connolly} et~al.(1995){Connolly}, {Csabai}, {Szalay}, {Koo}, {Kron}
  and {Munn}}]{connolly1995}
\bibinfo{author}{{Connolly}, A.J.}, \bibinfo{author}{{Csabai}, I.},
  \bibinfo{author}{{Szalay}, A.S.}, \bibinfo{author}{{Koo}, D.C.},
  \bibinfo{author}{{Kron}, R.G.}, \bibinfo{author}{{Munn}, J.A.},
  \bibinfo{year}{1995}.
\newblock \bibinfo{title}{{Slicing Through Multicolor Space: Galaxy Redshifts
  from Broadband Photometry}}.
\newblock \bibinfo{journal}{\aj} \bibinfo{volume}{110}, \bibinfo{pages}{2655}.
\newblock \DOIprefix\doi{10.1086/117720},
  \href{http://arxiv.org/abs/arXiv:astro-ph/9508100}{\tt
  arXiv:arXiv:astro-ph/9508100}.
%Type = Article
\bibitem[{{Conselice}(2006)}]{conselice2006}
\bibinfo{author}{{Conselice}, C.J.}, \bibinfo{year}{2006}.
\newblock \bibinfo{title}{{The fundamental properties of galaxies and a new
  galaxy classification system}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{373},
  \bibinfo{pages}{1389--1408}.
\newblock \DOIprefix\doi{10.1111/j.1365-2966.2006.11114.x},
  \href{http://arxiv.org/abs/astro-ph/0610016}{\tt arXiv:astro-ph/0610016}.
%Type = Article
\bibitem[{{de Souza} et~al.(2014a){de Souza}, {Cameron}, {Killedar}, {Hilbe},
  {Vilalta}, {Maio}, {Biffi}, {Ciardi} and {Riggs}}]{deSouza2014c}
\bibinfo{author}{{de Souza}, R.S.}, \bibinfo{author}{{Cameron}, E.},
  \bibinfo{author}{{Killedar}, M.}, \bibinfo{author}{{Hilbe}, J.},
  \bibinfo{author}{{Vilalta}, R.}, \bibinfo{author}{{Maio}, U.},
  \bibinfo{author}{{Biffi}, V.}, \bibinfo{author}{{Ciardi}, B.},
  \bibinfo{author}{{Riggs}, J.D.}, \bibinfo{year}{2014}a.
\newblock \bibinfo{title}{{The Overlooked Potential of Generalized Linear
  Models in Astronomy - I: Binomial Regression and Numerical Simulations}}.
\newblock \bibinfo{journal}{arxiv:1409.7696}
  \href{http://arxiv.org/abs/1409.7696}{\tt arXiv:1409.7696}.
%Type = Article
\bibitem[{{de Souza} et~al.(2014b){de Souza}, {Elliott}, A., {Ishida}, {Hilbe}
  and {Cameron}}]{desouza14b}
\bibinfo{author}{{de Souza}, R.S.}, \bibinfo{author}{{Elliott}, J.},
  \bibinfo{author}{A., K.}, \bibinfo{author}{{Ishida}, E.E.O.},
  \bibinfo{author}{{Hilbe}, J.}, \bibinfo{author}{{Cameron}, E.},
  \bibinfo{year}{2014}b.
\newblock \bibinfo{title}{{CosmoPhotoz: Photometric redshift estimation using
  generalized linear models }}.
\newblock \bibinfo{journal}{Astrophysics Source Code Library}
  \href{http://arxiv.org/abs/1408.018}{\tt arXiv:1408.018}.
%Type = Article
\bibitem[{{de Souza} et~al.(2014c){de Souza}, {Maio}, {Biffi} and
  {Ciardi}}]{desouza2014}
\bibinfo{author}{{de Souza}, R.S.}, \bibinfo{author}{{Maio}, U.},
  \bibinfo{author}{{Biffi}, V.}, \bibinfo{author}{{Ciardi}, B.},
  \bibinfo{year}{2014}c.
\newblock \bibinfo{title}{{Robust PCA and MIC statistics of baryons in early
  minihaloes}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{440},
  \bibinfo{pages}{240--248}.
\newblock \DOIprefix\doi{10.1093/mnras/stu274},
  \href{http://arxiv.org/abs/1308.6009}{\tt arXiv:1308.6009}.
%Type = Book
\bibitem[{Dobson(2002)}]{dobson2002}
\bibinfo{author}{Dobson, A.J.}, \bibinfo{year}{2002}.
\newblock \bibinfo{title}{{An Introduction to Generalized Linear Models}}.
\newblock \bibinfo{edition}{Second} ed., \bibinfo{publisher}{Chapman and
  Hall/CRC}.
\newblock \URLprefix \url{http://www.worldcat.org/isbn/1584881658}.
%Type = Article
\bibitem[{{Firth} et~al.(2003){Firth}, {Lahav} and {Somerville}}]{Firth03a}
\bibinfo{author}{{Firth}, A.E.}, \bibinfo{author}{{Lahav}, O.},
  \bibinfo{author}{{Somerville}, R.S.}, \bibinfo{year}{2003}.
\newblock \bibinfo{title}{{Estimating photometric redshifts with artificial
  neural networks}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{339},
  \bibinfo{pages}{1195--1202}.
\newblock \DOIprefix\doi{10.1046/j.1365-8711.2003.06271.x},
  \href{http://arxiv.org/abs/astro-ph/0203250}{\tt arXiv:astro-ph/0203250}.
%Type = Article
\bibitem[{{Green} et~al.(2012){Green}, {Schechter}, {Baltay}, {Bean},
  {Bennett}, {Brown}, {Conselice}, {Donahue} and {et al.}}]{wfirst}
\bibinfo{author}{{Green}, J.}, \bibinfo{author}{{Schechter}, P.},
  \bibinfo{author}{{Baltay}, C.}, \bibinfo{author}{{Bean}, R.},
  \bibinfo{author}{{Bennett}, D.}, \bibinfo{author}{{Brown}, R.},
  \bibinfo{author}{{Conselice}, C.}, \bibinfo{author}{{Donahue}, M.},
  \bibinfo{author}{{et al.}}, \bibinfo{year}{2012}.
\newblock \bibinfo{title}{{Wide-Field InfraRed Survey Telescope (WFIRST) Final
  Report}}.
\newblock \bibinfo{journal}{arxiv:1208.4012}
  \href{http://arxiv.org/abs/1208.4012}{\tt arXiv:1208.4012}.
%Type = Book
\bibitem[{Hardin and Hilbe(2001)}]{Hardin01a}
\bibinfo{author}{Hardin, J.W.}, \bibinfo{author}{Hilbe, J.},
  \bibinfo{year}{2001}.
\newblock \bibinfo{title}{Generalized Linear Models and Extensions}.
\newblock \bibinfo{publisher}{College Station, Texas: Stata Press}.
%Type = Book
\bibitem[{Hardin and Hilbe(2012)}]{Hil12}
\bibinfo{author}{Hardin, J.W.}, \bibinfo{author}{Hilbe, J.M.},
  \bibinfo{year}{2012}.
\newblock \bibinfo{title}{Generalized Linear Models and Extensions, 3rd
  Edition}.
\newblock \bibinfo{edition}{3rd} ed., \bibinfo{publisher}{StataCorp LP}.
%Type = Book
\bibitem[{Hilbe(2014)}]{hil14}
\bibinfo{author}{Hilbe, J.}, \bibinfo{year}{2014}.
\newblock \bibinfo{title}{Modeling Count Data}.
\newblock \bibinfo{publisher}{Cambridge University Press}.
%Type = Article
\bibitem[{{Hildebrandt} et~al.(2010){Hildebrandt}, {Arnouts}, {Capak},
  {Moustakas}, {Wolf}, {Abdalla}, {Assef}, {Banerji} and {et.
  al}}]{hildebrandt2010}
\bibinfo{author}{{Hildebrandt}, H.}, \bibinfo{author}{{Arnouts}, S.},
  \bibinfo{author}{{Capak}, P.}, \bibinfo{author}{{Moustakas}, L.A.},
  \bibinfo{author}{{Wolf}, C.}, \bibinfo{author}{{Abdalla}, F.B.},
  \bibinfo{author}{{Assef}, R.J.}, \bibinfo{author}{{Banerji}, M.},
  \bibinfo{author}{{et. al}}, \bibinfo{year}{2010}.
\newblock \bibinfo{title}{{PHAT: PHoto-z Accuracy Testing}}.
\newblock \bibinfo{journal}{\aap} \bibinfo{volume}{523}, \bibinfo{pages}{A31}.
\newblock \DOIprefix\doi{10.1051/0004-6361/201014885},
  \href{http://arxiv.org/abs/1008.0658}{\tt arXiv:1008.0658}.
%Type = Article
\bibitem[{{Ilbert} et~al.(2006){Ilbert}, {Arnouts}, {McCracken}, {Bolzonella},
  {Bertin}, {Le F{\`e}vre}, {Mellier}, {Zamorani} and {et al.}}]{ilbert2006}
\bibinfo{author}{{Ilbert}, O.}, \bibinfo{author}{{Arnouts}, S.},
  \bibinfo{author}{{McCracken}, H.J.}, \bibinfo{author}{{Bolzonella}, M.},
  \bibinfo{author}{{Bertin}, E.}, \bibinfo{author}{{Le F{\`e}vre}, O.},
  \bibinfo{author}{{Mellier}, Y.}, \bibinfo{author}{{Zamorani}, G.},
  \bibinfo{author}{{et al.}}, \bibinfo{year}{2006}.
\newblock \bibinfo{title}{{Accurate photometric redshifts for the CFHT legacy
  survey calibrated using the VIMOS VLT deep survey}}.
\newblock \bibinfo{journal}{\aap} \bibinfo{volume}{457},
  \bibinfo{pages}{841--856}.
\newblock \DOIprefix\doi{10.1051/0004-6361:20065138},
  \href{http://arxiv.org/abs/arXiv:astro-ph/0603217}{\tt
  arXiv:arXiv:astro-ph/0603217}.
%Type = Manual
\bibitem[{Inc.(2003)}]{SAS}
\bibinfo{author}{Inc., S.I.}, \bibinfo{year}{2003}.
\newblock \bibinfo{title}{SAS/STAT Software, Version~9.1}.
\newblock \bibinfo{address}{Cary, NC}.
\newblock \URLprefix \url{http://www.sas.com/}.
%Type = Article
\bibitem[{{Ishida} and {de Souza}(2011)}]{ishida2011b}
\bibinfo{author}{{Ishida}, E.E.O.}, \bibinfo{author}{{de Souza}, R.S.},
  \bibinfo{year}{2011}.
\newblock \bibinfo{title}{{Hubble parameter reconstruction from a principal
  component analysis: minimizing the bias}}.
\newblock \bibinfo{journal}{\aap} \bibinfo{volume}{527}, \bibinfo{pages}{A49}.
\newblock \DOIprefix\doi{10.1051/0004-6361/201015281},
  \href{http://arxiv.org/abs/1012.5335}{\tt arXiv:1012.5335}.
%Type = Article
\bibitem[{{Ishida} and {de Souza}(2013)}]{ishida2013}
\bibinfo{author}{{Ishida}, E.E.O.}, \bibinfo{author}{{de Souza}, R.S.},
  \bibinfo{year}{2013}.
\newblock \bibinfo{title}{{Kernel PCA for Type Ia supernovae photometric
  classification}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{430},
  \bibinfo{pages}{509--532}.
\newblock \DOIprefix\doi{10.1093/mnras/sts650},
  \href{http://arxiv.org/abs/1201.6676}{\tt arXiv:1201.6676}.
%Type = Article
\bibitem[{{Ishida} et~al.(2011){Ishida}, {de Souza} and {Ferrara}}]{ishida2011}
\bibinfo{author}{{Ishida}, E.E.O.}, \bibinfo{author}{{de Souza}, R.S.},
  \bibinfo{author}{{Ferrara}, A.}, \bibinfo{year}{2011}.
\newblock \bibinfo{title}{{Probing cosmic star formation up to z= 9.4 with
  gamma-ray bursts}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{418},
  \bibinfo{pages}{500--504}.
\newblock \DOIprefix\doi{10.1111/j.1365-2966.2011.19501.x},
  \href{http://arxiv.org/abs/1106.1745}{\tt arXiv:1106.1745}.
%Type = Article
\bibitem[{{Jeeson-Daniel} et~al.(2011){Jeeson-Daniel}, {Dalla Vecchia}, {Haas}
  and {Schaye}}]{jeeson2011}
\bibinfo{author}{{Jeeson-Daniel}, A.}, \bibinfo{author}{{Dalla Vecchia}, C.},
  \bibinfo{author}{{Haas}, M.R.}, \bibinfo{author}{{Schaye}, J.},
  \bibinfo{year}{2011}.
\newblock \bibinfo{title}{{The correlation structure of dark matter halo
  properties}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{415},
  \bibinfo{pages}{L69--L73}.
\newblock \DOIprefix\doi{10.1111/j.1745-3933.2011.01081.x},
  \href{http://arxiv.org/abs/1103.5467}{\tt arXiv:1103.5467}.
%Type = Book
\bibitem[{Jollife(2002)}]{jollife2002}
\bibinfo{author}{Jollife, I.T.}, \bibinfo{year}{2002}.
\newblock \bibinfo{title}{{Principal Component Analysis}}.
\newblock \bibinfo{publisher}{Springer-Verlag}.
\newblock \URLprefix
  \url{http://www.amazon.com/Principal-Component-Analysis-I-T-Jolliffe/dp/0387%
954422}.
%Type = Book
\bibitem[{de~Jong and Heller(2008)}]{Jong2008}
\bibinfo{author}{de~Jong, P.}, \bibinfo{author}{Heller, G.Z.},
  \bibinfo{year}{2008}.
\newblock \bibinfo{title}{Generalized Linear Models for Insurance Data}.
\newblock \bibinfo{publisher}{Cambridge University Press}.
\newblock \URLprefix \url{http://dx.doi.org/10.1017/CBO9780511755408}.
  \bibinfo{note}{cambridge Books Online}.
%Type = Article
\bibitem[{{Krone-Martins} et~al.(2014){Krone-Martins}, {Ishida} and {de
  Souza}}]{Krone-Martins14a}
\bibinfo{author}{{Krone-Martins}, A.}, \bibinfo{author}{{Ishida}, E.E.O.},
  \bibinfo{author}{{de Souza}, R.S.}, \bibinfo{year}{2014}.
\newblock \bibinfo{title}{{The first analytical expression to estimate
  photometric redshifts suggested by a machine}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{443},
  \bibinfo{pages}{L34--L38}.
\newblock \DOIprefix\doi{10.1093/mnrasl/slu067},
  \href{http://arxiv.org/abs/1308.4145}{\tt arXiv:1308.4145}.
%Type = Article
\bibitem[{{Krone-Martins} and {Moitinho}(2014)}]{Krone-Martins14b}
\bibinfo{author}{{Krone-Martins}, A.}, \bibinfo{author}{{Moitinho}, A.},
  \bibinfo{year}{2014}.
\newblock \bibinfo{title}{{UPMASK: unsupervised photometric membership
  assignment in stellar clusters}}.
\newblock \bibinfo{journal}{\aap} \bibinfo{volume}{561}, \bibinfo{pages}{A57}.
\newblock \DOIprefix\doi{10.1051/0004-6361/201321143},
  \href{http://arxiv.org/abs/1309.4471}{\tt arXiv:1309.4471}.
%Type = Article
\bibitem[{Lindsey(1999)}]{lindsey1999}
\bibinfo{author}{Lindsey, J.K.}, \bibinfo{year}{1999}.
\newblock \bibinfo{title}{A review of some extensions to generalized linear
  models.}
\newblock \bibinfo{journal}{Statistics in medicine} \bibinfo{volume}{18},
  \bibinfo{pages}{2223--2236}.
\newblock \URLprefix \url{http://view.ncbi.nlm.nih.gov/pubmed/10474135}.
%Type = Article
\bibitem[{{LSST Science Collaboration} et~al.(2009){LSST Science
  Collaboration}, {Abell}, {Allison}, {Anderson}, {Andrew}, {Angel}, {Armus},
  {Arnett}, {Asztalos}, {Axelrod} and et~al.}]{lsst}
\bibinfo{author}{{LSST Science Collaboration}}, \bibinfo{author}{{Abell},
  P.A.}, \bibinfo{author}{{Allison}, J.}, \bibinfo{author}{{Anderson}, S.F.},
  \bibinfo{author}{{Andrew}, J.R.}, \bibinfo{author}{{Angel}, J.R.P.},
  \bibinfo{author}{{Armus}, L.}, \bibinfo{author}{{Arnett}, D.},
  \bibinfo{author}{{Asztalos}, S.J.}, \bibinfo{author}{{Axelrod}, T.S.},
  \bibinfo{author}{et~al.}, \bibinfo{year}{2009}.
\newblock \bibinfo{title}{{LSST Science Book, Version 2.0}}.
\newblock \bibinfo{journal}{arxiv:0912.0201}
  \href{http://arxiv.org/abs/0912.0201}{\tt arXiv:0912.0201}.
%Type = Incollection
\bibitem[{{Miles} et~al.(2007){Miles}, {Freitas} and {Serjeant}}]{miles2007}
\bibinfo{author}{{Miles}, N.}, \bibinfo{author}{{Freitas}, A.},
  \bibinfo{author}{{Serjeant}, S.}, \bibinfo{year}{2007}.
\newblock \bibinfo{title}{{Estimating Photometric Redshifts Using Genetic
  Algorithms}}, in: \bibinfo{editor}{Ellis, R.}, \bibinfo{editor}{Allen, T.},
  \bibinfo{editor}{Tuson, A.} (Eds.), \bibinfo{booktitle}{{Applications and
  Innovations in Intelligent Systems XIV}}. \bibinfo{publisher}{Springer
  London}, pp. \bibinfo{pages}{75--87}.
\newblock \URLprefix \url{http://dx.doi.org/10.1007/978-1-84628-666-76},
  \DOIprefix\doi{10.1007/978-1-84628-666-76}.
%Type = Article
\bibitem[{Nelder({1965})}]{nel65}
\bibinfo{author}{Nelder, J.A.}, \bibinfo{year}{{1965}}.
\newblock \bibinfo{title}{{Analysis of randomized experiments with orthogonal
  block structure .I. Block structure and null analysis of variance}}.
\newblock \bibinfo{journal}{{Proceedings of the Royal Society of London Series
  A-Mathematical and Physical Sciences}} \bibinfo{volume}{{283}},
  \bibinfo{pages}{{147}}.
\newblock \DOIprefix\doi{{10.1098/rspa.1965.0012}}.
%Type = Article
\bibitem[{Nelder and Wedderburn(1972)}]{nel72}
\bibinfo{author}{Nelder, J.A.}, \bibinfo{author}{Wedderburn, R.W.M.},
  \bibinfo{year}{1972}.
\newblock \bibinfo{title}{Generalized linear models}.
\newblock \bibinfo{journal}{Journal of the Royal Statistical Society, Series A,
  General} \bibinfo{volume}{135}, \bibinfo{pages}{370--384}.
%Type = Article
\bibitem[{{O'Mill} et~al.(2011){O'Mill}, {Duplancic}, {Garc{\'{\i}}a Lambas}
  and {Sodr{\'e}}}]{omill2011}
\bibinfo{author}{{O'Mill}, A.L.}, \bibinfo{author}{{Duplancic}, F.},
  \bibinfo{author}{{Garc{\'{\i}}a Lambas}, D.}, \bibinfo{author}{{Sodr{\'e}},
  Jr., L.}, \bibinfo{year}{2011}.
\newblock \bibinfo{title}{{Photometric redshifts and k-corrections for the
  Sloan Digital Sky Survey Data Release 7}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{413},
  \bibinfo{pages}{1395--1408}.
\newblock \DOIprefix\doi{10.1111/j.1365-2966.2011.18222.x},
  \href{http://arxiv.org/abs/1012.3752}{\tt arXiv:1012.3752}.
%Type = Article
\bibitem[{Pedregosa et~al.(2011)Pedregosa, Varoquaux, Gramfort, Michel,
  Thirion, Grisel, Blondel, Prettenhofer, Weiss, Dubourg, Vanderplas, Passos,
  Cournapeau, Brucher, Perrot and Duchesnay}]{Pedregosa11a}
\bibinfo{author}{Pedregosa, F.}, \bibinfo{author}{Varoquaux, G.},
  \bibinfo{author}{Gramfort, A.}, \bibinfo{author}{Michel, V.},
  \bibinfo{author}{Thirion, B.}, \bibinfo{author}{Grisel, O.},
  \bibinfo{author}{Blondel, M.}, \bibinfo{author}{Prettenhofer, P.},
  \bibinfo{author}{Weiss, R.}, \bibinfo{author}{Dubourg, V.},
  \bibinfo{author}{Vanderplas, J.}, \bibinfo{author}{Passos, A.},
  \bibinfo{author}{Cournapeau, D.}, \bibinfo{author}{Brucher, M.},
  \bibinfo{author}{Perrot, M.}, \bibinfo{author}{Duchesnay, E.},
  \bibinfo{year}{2011}.
\newblock \bibinfo{title}{Scikit-learn: Machine learning in {P}ython}.
\newblock \bibinfo{journal}{Journal of Machine Learning Research}
  \bibinfo{volume}{12}, \bibinfo{pages}{2825--2830}.
%Type = Book
\bibitem[{Pindyck and Rubinfeld(1998)}]{pin98}
\bibinfo{author}{Pindyck, R.S.}, \bibinfo{author}{Rubinfeld, D.L.},
  \bibinfo{year}{1998}.
\newblock \bibinfo{title}{Econometric models and economic forecasts}.
  volume~\bibinfo{volume}{4}.
\newblock \bibinfo{publisher}{Irwin/McGraw-Hill Boston}.
%Type = Manual
\bibitem[{{R Core Team}(2014)}]{R}
\bibinfo{author}{{R Core Team}}, \bibinfo{year}{2014}.
\newblock \bibinfo{title}{R: A Language and Environment for Statistical
  Computing}.
\newblock \bibinfo{organization}{R Foundation for Statistical Computing}.
  \bibinfo{address}{Vienna, Austria}.
\newblock \URLprefix \url{http://www.R-project.org/}.
%Type = Article
\bibitem[{{Refregier} et~al.(2010){Refregier}, {Amara}, {Kitching}, {Rassat},
  {Scaramella}, {Weller} and {Euclid Imaging Consortium}}]{euclid}
\bibinfo{author}{{Refregier}, A.}, \bibinfo{author}{{Amara}, A.},
  \bibinfo{author}{{Kitching}, T.D.}, \bibinfo{author}{{Rassat}, A.},
  \bibinfo{author}{{Scaramella}, R.}, \bibinfo{author}{{Weller}, J.},
  \bibinfo{author}{{Euclid Imaging Consortium}, f.t.}, \bibinfo{year}{2010}.
\newblock \bibinfo{title}{{Euclid Imaging Consortium Science Book}}.
\newblock \bibinfo{journal}{arxiv:1001.0061}
  \href{http://arxiv.org/abs/1001.0061}{\tt arXiv:1001.0061}.
%Type = Article
\bibitem[{{Reis} et~al.(2012){Reis}, {Soares-Santos}, {Annis}, {Dodelson},
  {Hao}, {Johnston}, {Kubo}, {Lin}, {Seo} and {Simet}}]{reis2012}
\bibinfo{author}{{Reis}, R.R.R.}, \bibinfo{author}{{Soares-Santos}, M.},
  \bibinfo{author}{{Annis}, J.}, \bibinfo{author}{{Dodelson}, S.},
  \bibinfo{author}{{Hao}, J.}, \bibinfo{author}{{Johnston}, D.},
  \bibinfo{author}{{Kubo}, J.}, \bibinfo{author}{{Lin}, H.},
  \bibinfo{author}{{Seo}, H.J.}, \bibinfo{author}{{Simet}, M.},
  \bibinfo{year}{2012}.
\newblock \bibinfo{title}{{The Sloan Digital Sky Survey Co-add: A Galaxy
  Photometric Redshift Catalog}}.
\newblock \bibinfo{journal}{\apj} \bibinfo{volume}{747}, \bibinfo{pages}{59}.
\newblock \DOIprefix\doi{10.1088/0004-637X/747/1/59},
  \href{http://arxiv.org/abs/1111.6620}{\tt arXiv:1111.6620}.
%Type = Article
\bibitem[{{S{\'a}nchez} et~al.(2014){S{\'a}nchez}, {Carrasco Kind}, {Lin},
  {Miquel}, {Abdalla}, {Amara}, {Banerji}, {Bonnett}, {Brunner}, {Capozzi},
  {Carnero}, {Castander}, {da Costa}, {Cunha}, {Fausti}, {Gerdes}, {Greisel},
  {Gschwend}, {Hartley}, {Jouvel}, {Lahav}, {Lima}, {Maia}, {Mart{\'{\i}}},
  {Ogando}, {Ostrovski}, {Pellegrini}, {Rau}, {Sadeh}, {Seitz},
  {Sevilla-Noarbe}, {Sypniewski}, {de Vicente}, {Abbot}, {Allam}, {Atlee},
  {Bernstein}, {Bernstein}, {Buckley-Geer}, {Burke}, {Childress}, {Davis},
  {DePoy}, {Dey}, {Desai}, {Diehl}, {Doel}, {Estrada}, {Evrard},
  {Fern{\'a}ndez}, {Finley}, {Flaugher}, {Frieman}, {Gaztanaga}, {Glazebrook},
  {Honscheid}, {Kim}, {Kuehn}, {Kuropatkin}, {Lidman}, {Makler}, {Marshall},
  {Nichol}, {Roodman}, {S{\'a}nchez}, {Santiago}, {Sako}, {Scalzo}, {Smith},
  {Swanson}, {Tarle}, {Thomas}, {Tucker}, {Uddin}, {Vald{\'e}s}, {Walker},
  {Yuan} and {Zuntz}}]{Sanchez14a}
\bibinfo{author}{{S{\'a}nchez}, C.}, \bibinfo{author}{{Carrasco Kind}, M.},
  \bibinfo{author}{{Lin}, H.}, \bibinfo{author}{{Miquel}, R.},
  \bibinfo{author}{{Abdalla}, F.B.}, \bibinfo{author}{{Amara}, A.},
  \bibinfo{author}{{Banerji}, M.}, \bibinfo{author}{{Bonnett}, C.},
  \bibinfo{author}{{Brunner}, R.}, \bibinfo{author}{{Capozzi}, D.},
  \bibinfo{author}{{Carnero}, A.}, \bibinfo{author}{{Castander}, F.J.},
  \bibinfo{author}{{da Costa}, L.A.N.}, \bibinfo{author}{{Cunha}, C.},
  \bibinfo{author}{{Fausti}, A.}, \bibinfo{author}{{Gerdes}, D.},
  \bibinfo{author}{{Greisel}, N.}, \bibinfo{author}{{Gschwend}, J.},
  \bibinfo{author}{{Hartley}, W.}, \bibinfo{author}{{Jouvel}, S.},
  \bibinfo{author}{{Lahav}, O.}, \bibinfo{author}{{Lima}, M.},
  \bibinfo{author}{{Maia}, M.A.G.}, \bibinfo{author}{{Mart{\'{\i}}}, P.},
  \bibinfo{author}{{Ogando}, R.L.C.}, \bibinfo{author}{{Ostrovski}, F.},
  \bibinfo{author}{{Pellegrini}, P.}, \bibinfo{author}{{Rau}, M.M.},
  \bibinfo{author}{{Sadeh}, I.}, \bibinfo{author}{{Seitz}, S.},
  \bibinfo{author}{{Sevilla-Noarbe}, I.}, \bibinfo{author}{{Sypniewski}, A.},
  \bibinfo{author}{{de Vicente}, J.}, \bibinfo{author}{{Abbot}, T.},
  \bibinfo{author}{{Allam}, S.S.}, \bibinfo{author}{{Atlee}, D.},
  \bibinfo{author}{{Bernstein}, G.}, \bibinfo{author}{{Bernstein}, J.P.},
  \bibinfo{author}{{Buckley-Geer}, E.}, \bibinfo{author}{{Burke}, D.},
  \bibinfo{author}{{Childress}, M.J.}, \bibinfo{author}{{Davis}, T.},
  \bibinfo{author}{{DePoy}, D.L.}, \bibinfo{author}{{Dey}, A.},
  \bibinfo{author}{{Desai}, S.}, \bibinfo{author}{{Diehl}, H.T.},
  \bibinfo{author}{{Doel}, P.}, \bibinfo{author}{{Estrada}, J.},
  \bibinfo{author}{{Evrard}, A.}, \bibinfo{author}{{Fern{\'a}ndez}, E.},
  \bibinfo{author}{{Finley}, D.}, \bibinfo{author}{{Flaugher}, B.},
  \bibinfo{author}{{Frieman}, J.}, \bibinfo{author}{{Gaztanaga}, E.},
  \bibinfo{author}{{Glazebrook}, K.}, \bibinfo{author}{{Honscheid}, K.},
  \bibinfo{author}{{Kim}, A.}, \bibinfo{author}{{Kuehn}, K.},
  \bibinfo{author}{{Kuropatkin}, N.}, \bibinfo{author}{{Lidman}, C.},
  \bibinfo{author}{{Makler}, M.}, \bibinfo{author}{{Marshall}, J.L.},
  \bibinfo{author}{{Nichol}, R.C.}, \bibinfo{author}{{Roodman}, A.},
  \bibinfo{author}{{S{\'a}nchez}, E.}, \bibinfo{author}{{Santiago}, B.X.},
  \bibinfo{author}{{Sako}, M.}, \bibinfo{author}{{Scalzo}, R.},
  \bibinfo{author}{{Smith}, R.C.}, \bibinfo{author}{{Swanson}, M.E.C.},
  \bibinfo{author}{{Tarle}, G.}, \bibinfo{author}{{Thomas}, D.},
  \bibinfo{author}{{Tucker}, D.L.}, \bibinfo{author}{{Uddin}, S.A.},
  \bibinfo{author}{{Vald{\'e}s}, F.}, \bibinfo{author}{{Walker}, A.},
  \bibinfo{author}{{Yuan}, F.}, \bibinfo{author}{{Zuntz}, J.},
  \bibinfo{year}{2014}.
\newblock \bibinfo{title}{{Photometric redshift analysis in the Dark Energy
  Survey Science Verification data}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{445},
  \bibinfo{pages}{1482--1506}.
\newblock \DOIprefix\doi{10.1093/mnras/stu1836},
  \href{http://arxiv.org/abs/1406.4407}{\tt arXiv:1406.4407}.
%Type = Article
\bibitem[{{Sasdelli} et~al.(2015){Sasdelli}, {Hillebrandt}, {Aldering},
  {Antilogus}, {Aragon}, {Bailey}, {Baltay}, {Benitez-Herrera}, {Bongard},
  {Buton}, {Canto}, {Cellier-Holzem}, {Chen}, {Childress}, {Chotard}, {Copin},
  {Fakhouri}, {Feindt}, {Fink}, {Fleury}, {Fouchez}, {Gangler}, {Guy},
  {Ishida}, {Kim}, {Kowalski}, {Kromer}, {Lombardo}, {Mazzali}, {Nordin},
  {Pain}, {P{\'e}contal}, {Pereira}, {Perlmutter}, {Rabinowitz}, {Rigault},
  {Runge}, {Saunders}, {Scalzo}, {Smadja}, {Suzuki}, {Tao}, {Taubenberger},
  {Thomas}, {Tilquin} and {Weaver}}]{Sasdelli14a}
\bibinfo{author}{{Sasdelli}, M.}, \bibinfo{author}{{Hillebrandt}, W.},
  \bibinfo{author}{{Aldering}, G.}, \bibinfo{author}{{Antilogus}, P.},
  \bibinfo{author}{{Aragon}, C.}, \bibinfo{author}{{Bailey}, S.},
  \bibinfo{author}{{Baltay}, C.}, \bibinfo{author}{{Benitez-Herrera}, S.},
  \bibinfo{author}{{Bongard}, S.}, \bibinfo{author}{{Buton}, C.},
  \bibinfo{author}{{Canto}, A.}, \bibinfo{author}{{Cellier-Holzem}, F.},
  \bibinfo{author}{{Chen}, J.}, \bibinfo{author}{{Childress}, M.},
  \bibinfo{author}{{Chotard}, N.}, \bibinfo{author}{{Copin}, Y.},
  \bibinfo{author}{{Fakhouri}, H.K.}, \bibinfo{author}{{Feindt}, U.},
  \bibinfo{author}{{Fink}, M.}, \bibinfo{author}{{Fleury}, M.},
  \bibinfo{author}{{Fouchez}, D.}, \bibinfo{author}{{Gangler}, E.},
  \bibinfo{author}{{Guy}, J.}, \bibinfo{author}{{Ishida}, E.E.O.},
  \bibinfo{author}{{Kim}, A.G.}, \bibinfo{author}{{Kowalski}, M.},
  \bibinfo{author}{{Kromer}, M.}, \bibinfo{author}{{Lombardo}, S.},
  \bibinfo{author}{{Mazzali}, P.A.}, \bibinfo{author}{{Nordin}, J.},
  \bibinfo{author}{{Pain}, R.}, \bibinfo{author}{{P{\'e}contal}, E.},
  \bibinfo{author}{{Pereira}, R.}, \bibinfo{author}{{Perlmutter}, S.},
  \bibinfo{author}{{Rabinowitz}, D.}, \bibinfo{author}{{Rigault}, M.},
  \bibinfo{author}{{Runge}, K.}, \bibinfo{author}{{Saunders}, C.},
  \bibinfo{author}{{Scalzo}, R.}, \bibinfo{author}{{Smadja}, G.},
  \bibinfo{author}{{Suzuki}, N.}, \bibinfo{author}{{Tao}, C.},
  \bibinfo{author}{{Taubenberger}, S.}, \bibinfo{author}{{Thomas}, R.C.},
  \bibinfo{author}{{Tilquin}, A.}, \bibinfo{author}{{Weaver}, B.A.},
  \bibinfo{year}{2015}.
\newblock \bibinfo{title}{{A metric space for Type Ia supernova spectra}}.
\newblock \bibinfo{journal}{\mnras} \bibinfo{volume}{447},
  \bibinfo{pages}{1247--1266}.
\newblock \DOIprefix\doi{10.1093/mnras/stu2416},
  \href{http://arxiv.org/abs/1411.4424}{\tt arXiv:1411.4424}.
%Type = Article
\bibitem[{Shah et~al.(2008)Shah, Oehmen and Webb-Robertson}]{shah2008svm}
\bibinfo{author}{Shah, A.R.}, \bibinfo{author}{Oehmen, C.S.},
  \bibinfo{author}{Webb-Robertson, B.J.}, \bibinfo{year}{2008}.
\newblock \bibinfo{title}{Svm-hustle—an iterative semi-supervised machine
  learning approach for pairwise protein remote homology detection}.
\newblock \bibinfo{journal}{Bioinformatics} \bibinfo{volume}{24},
  \bibinfo{pages}{783--790}.
%Type = Article
\bibitem[{Stasinopoulos and Rigby({2007})}]{Stasinopoulos07a}
\bibinfo{author}{Stasinopoulos, D.M.}, \bibinfo{author}{Rigby, R.A.},
  \bibinfo{year}{{2007}}.
\newblock \bibinfo{title}{{Generalized additive models for location scale and
  shape (GAMLSS) in R}}.
\newblock \bibinfo{journal}{{Journal of Statistical Software}}
  \bibinfo{volume}{{23}}.
%Type = Manual
\bibitem[{StataCorp(2009)}]{Stata}
\bibinfo{author}{StataCorp}, \bibinfo{year}{2009}.
\newblock \bibinfo{title}{{Stata Statistical Software: Release 11}}.
\newblock \bibinfo{organization}{StataCorp LP}. \bibinfo{address}{College
  Station, TX}.
\newblock \URLprefix \url{http://www.stata.com}.
%Type = Article
\bibitem[{{Wadadekar}(2005)}]{wadadekar2005}
\bibinfo{author}{{Wadadekar}, Y.}, \bibinfo{year}{2005}.
\newblock \bibinfo{title}{{Estimating Photometric Redshifts Using Support
  Vector Machines}}.
\newblock \bibinfo{journal}{\pasp} \bibinfo{volume}{117},
  \bibinfo{pages}{79--85}.
\newblock \DOIprefix\doi{10.1086/427710},
  \href{http://arxiv.org/abs/arXiv:astro-ph/0412005}{\tt
  arXiv:arXiv:astro-ph/0412005}.
%Type = Inproceedings
\bibitem[{{Werner} and {Guven}(2007)}]{Werner07a}
\bibinfo{author}{{Werner}, G.}, \bibinfo{author}{{Guven}, S.},
  \bibinfo{year}{2007}.
\newblock \bibinfo{title}{Glm basic modeling: Avoiding common pitfalls}, in:
  \bibinfo{booktitle}{Casualty Actuarial Society Forum}, pp.
  \bibinfo{pages}{257--272}.
%Type = Article
\bibitem[{{York} et~al.(2000){York}, {Adelman}, {Anderson}, {Anderson},
  {Annis}, {Bahcall}, {Bakken}, {Barkhouser}, {et al.} and {SDSS
  Collaboration}}]{York00a}
\bibinfo{author}{{York}, D.G.}, \bibinfo{author}{{Adelman}, J.},
  \bibinfo{author}{{Anderson}, Jr., J.E.}, \bibinfo{author}{{Anderson}, S.F.},
  \bibinfo{author}{{Annis}, J.}, \bibinfo{author}{{Bahcall}, N.A.},
  \bibinfo{author}{{Bakken}, J.A.}, \bibinfo{author}{{Barkhouser}, R.},
  \bibinfo{author}{{et al.}}, \bibinfo{author}{{SDSS Collaboration}},
  \bibinfo{year}{2000}.
\newblock \bibinfo{title}{{The Sloan Digital Sky Survey: Technical Summary}}.
\newblock \bibinfo{journal}{\aj} \bibinfo{volume}{120},
  \bibinfo{pages}{1579--1587}.
\newblock \DOIprefix\doi{10.1086/301513},
  \href{http://arxiv.org/abs/astro-ph/0006396}{\tt arXiv:astro-ph/0006396}.
%Type = Inproceedings
\bibitem[{{Zheng} and {Zhang}(2012)}]{zheng2012}
\bibinfo{author}{{Zheng}, H.}, \bibinfo{author}{{Zhang}, Y.},
  \bibinfo{year}{2012}.
\newblock \bibinfo{title}{{Review of techniques for photometric redshift
  estimation}}, in: \bibinfo{booktitle}{Society of Photo-Optical
  Instrumentation Engineers (SPIE) Conference Series}, p.~\bibinfo{pages}{10}.
\newblock \DOIprefix\doi{10.1117/12.925314}.

\end{thebibliography}
