\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}
%\usepackage{natbib}
\usepackage{url}
\bibliographystyle{vancouver}

\usepackage{fancyhdr}
\fancypagestyle{plain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\makeatletter
%\let\ps@plain\ps@fancy
\makeatother
\rfoot{\thepage}
}

\author{N. F. Reeve, T. R. Fanshawe, K. Lamden, P. J. Diggle, J. Cheesbrough, T. J. Keegan}
\title{Epidemiology and Infection\\Giardiasis in North West England: Faecal Specimen Requesting Rates by GP Practice\\ Supplementary Material}
\date{}

\linespread{1.6}

\begin{document}
\maketitle
\pagestyle{plain}
\section{Model Formulation}
\label{app.mod}
\subsection{Model 1}

We first fitted a binomial model (Model 1i) to the total number of specimens $n_{i}$ for the $i$th GP practice, with the practice population $N_i$ as an offset. Then we fitted a binomial model (Model 1ii) of the number of 2011 positive specimens $n_{i}$, with the total number of specimens $N_i$ as an offset. Finally, we fitted a binomial model (Model 1iii) to the number of positive specimens in 2011 $n_{i}$, with the practice population $N_i$ as an offset.

The model adjusts for the effect of IMD $d_i$ and includes a random effect $b_i$ for GP practice. The random effects $b_i$ are assumed independent and identically distributed, with a Normal distribution with mean 0 and variance $\sigma^2$.
\[ n_{i} \sim \mbox{Binomial} (N_i, \mu_i)\]
\[logit(\mu_i) = \alpha+\beta d_i+b_i\]
\[b_i \sim \mbox{Normal}(0,\sigma^2)\]

\subsection{Model 2}
\label{app.mod2}
We then fitted a poisson model to the number of positive specimens $Y_{iwt}$ for the $i$th GP practice, $w$th week ($w: 1,\ldots , 52$) and $t$th year ($t: 2003,\ldots,2011$), with the practice population $N_i$ as an offset. As with Model 1, we adjust for IMD and include a random effect for GP practice. The model also includes a trend for year and allows for seasonality. 
\[Y_{iwt} \sim \mbox{Poisson} (\mu_{iwt})\]
\[log(\mu_{iwt}) = log(N_i)+\alpha+\beta d_i+\gamma_t+\delta_1sin\left(\frac{2\pi}{52}w\right) +\delta_2cos\left(\frac{2\pi}{52} w\right)+b_i\]
\[b_i \sim \mbox{Normal}(0,\sigma^2)\]


\section{Variogram}
\label{app.var}
If $x$ is a point in the region and $Y(x)$ is the value of the random effects at that point, for pairs of points distance $h$ apart, the variogram is defined by
\[V(h)=\frac{1}{2}\mbox{Var}[Y(x+h)-Y(x)]\]

An assessment of the spatial correlation of the values can be made using the formal test described in \cite{diblasi2001use}. Let $l_{ij}=|Y(x_i)-Y(x_j)|^{1/2}$ and denote by $\bar{l}$ the average of the $l_{ij}$. Then 
\[T =\frac{ \sum_{i<j}(l_{ij}-\bar{l})^2 - \sum_{i<j}(l_{ij}-\hat{\gamma^*}(h_{ij}))^2}{\sum_{i<j}(l_{ij}-\gamma^*(h_{ij}))^2}\]
where $\hat{\gamma^*}(h_{ij})$ is the variogram estimator recommended by Hawkins and Cressie \cite{hawkins1984robust}
\[\hat{\gamma^*}(h_{ij})=\frac{1}{2|N(h)|}\sum_{N(h)}|Y(x_i)-Y(x_j)|^{1/2}\]
and $N(h)$ denotes the collection of pairs of observations whose spatial locations are separated by the distance $h$. A reference band is formed by plotting $2(\mbox{var}[\hat{\gamma^*}(h)-\bar{l}])^{1/2}$ above and below the average $\bar{l}$.

\bibliography{refs}

\end{document}