% \VignetteIndexEntry{Encephalitis - Loglinear Poisson Model and Normal Distribution Model}

\documentclass[a4paper]{article}

\title{Encephalitis - Loglinear Poisson Model and Normal Distribution Model}

\begin{document}

\maketitle
First of all, the encephalitis data are loaded:
<<results=hide,eval=FALSE>>=
library(catdata)
data(encephalitis)
attach(encephalitis)
@


Some variables are renamed and recoded before fitting the model.
<<eval=FALSE>>=
BAV <- country
BAV[BAV==2] <-0
TIME <- year
@
%
The number of infections (count) is modeled in dependence on country and TIME.
A Loglinear Poisson Model is fitted.
<<eval=FALSE>>=
enc1 <- glm(count ~ TIME+I(TIME^2)+BAV+TIME*BAV, family = poisson)
summary(enc1)
@
%
For comparison the linear Normal Model with the identity link is fitted.
<<eval=FALSE>>=
enc2 <- glm(count ~ TIME+I(TIME^2)+BAV+TIME*BAV, family = gaussian("identity"))
summary(enc2)
@
%
Fit of loglinear Normal Model. That means a normal model with log-link.
<<eval=FALSE>>=
enc3 <- glm(count ~ TIME+I(TIME^2)+BAV+TIME*BAV, family = gaussian("log"), 
            start=enc1$coef)
summary(enc3)
@

\end{document}


