
% $Header: /cvsroot/latex-beamer/latex-beamer/solutions/generic-talks/generic-ornate-15min-45min.en.tex,v 1.4 2004/10/07 20:53:08 tantau Exp $
\documentclass{beamer}
%\usepackage[latin1]{inputenc}
%\usepackage{pstricks,pst-node,pst-text,pst-3d}
%\usepackage{amsmath}
%\usepackage{verbatim}
%\usepackage{psfig}
\usepackage{epsfig}
\usepackage[T1]{fontenc}
%\usepackage{babel,textcomp}
\usepackage{amsmath,amsfonts}
\usepackage{graphics}
\usepackage{graphicx}
%\usepackage[applemac]{inputenc}
\renewcommand{\baselinestretch}{1.5}
%\newtheorem{lemma}{Lemma}
\newtheorem{cond}{Condition}
\newtheorem{ass}{Assumption}
\newtheorem{thm}{Theorem}
\newtheorem{alg}{Algorithm}
\newtheorem{prop}{Proposition}
% This file is a solution template for:
% - Giving a talk on some subject.
% - The talk is between 15min and 45min long.
% - Style is ornate.
% Copyright 2004 by Till Tantau <tantau@users.sourceforge.net>.
%
% In principle, this file can be redistributed and/or modified under
% the terms of the GNU Public License, version 2.
%
% However, this file is supposed to be a template to be modified
% for your own needs. For this reason, if you use this file as a
% template and not specifically distribute it as part of a another
% package/program, I grant the extra permission to freely copy and
% modify this file as you see fit and even to delete this copyright
% notice.
\mode<presentation>
{
  \usetheme{Warsaw}
  % or ...
  \setbeamercovered{transparent}
  % or whatever (possibly just delete it)
}
\usepackage[english]{babel}
% or whatever
\usepackage[latin1]{inputenc}
%\usepackage{verbatim}
% or whatever
\usepackage{times}
\usepackage[T1]{fontenc}
% Or whatever. Note that the encoding and the font should match. If T1
% does not look nice, try deleting the line with the fontenc.
\title{Introduction on to Generalized Linear Models (GLM) \vspace{1cm}}
\subtitle{STK3100/STK4100 -  August 22th 2016}
\author{Sven Ove Samuelsen/Anders Rygh Swensen}
\institute[UiO] % (optional, but mostly needed)
{Department of Mathematics, University of Oslo}

\date{2015}

%\date[Short Occasion] % (optional)
%{V{\aa}r 2007}

\logo{UiO}

\subject{R-introxx}
% This is only inserted into the PDF information catalog. Can be left
% out.



% If you have a file called "university-logo-filename.xxx", where xxx
% is a graphic format that can be processed by latex or pdflatex,
% resp., then you can add a logo as follows:

% \pgfdeclareimage[height=0.5cm]{university-logo}{university-logo-filename}
% \logo{\pgfuseimage{university-logo}}

% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command:
%\beamerdefaultoverlayspecification{<+->}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

%\section{1. Program}
\begin{frame}
\frametitle{Program}
{\bf Plan for first lecture:} \\
1. Introduction, Literature, Program \\
2. Examples \\
3. Informal definition of GLM \\
4. Some extensions of GLM\\
5. Plan for for the course\\
%1. Background
%2. Exact version
%3. Inexact version
%4. Discussion
  % You might wish to add the option [pausesections]
\end{frame}
% Since this a solution template for a generic talk, very little can
% be said about how it should be structured. However, the talk length
% of between 15min and 45min and the theme suggest that you stick to
% the following rules:
% - Exactly two or three sections (other than the summary).
% - At *most* three subsections per section.
% - Talk about 30s to 2min per frame. So there should be between about
%   15 and 30 frames, all told.

\section{ Introduction, Literature, Program }

%---------------------------------------------------------------------- SLIDE -
\begin{frame}{\small Introduction}
\small
\begin{itemize}
\item The topic of generalized  linear models (with extensions ) is central classes
of  more complicated , but standard models  beyond  multiple  regression / anova.
\item In particular  we will see  how binary data, data on counts , categorical  (multinomial) data
and longetudinal/panel data can be analyzed in a regression (like) setting.
\item The purpose of the course is twofold: first to see how these models can be in real applications
but also to understand the mathematical background for the models.
\end{itemize}
\end{frame}



\begin{frame}{\small Textbook (literature)}
\small
Textbook for GLM : "Generalized Linear Models for Insurance Data" by Piet de Jong og Gillian Z. Heller.

Can be purchased in  Akademika.

\vspace{0.3cm}
Web page : {\tiny {\tt http://www.actuary.mq.edu.au/research/books/GLMsforInsuranceData}}

Many data sets we will use can be found here.

\vspace{0.3cm}
As earlier we will use data set from many settings: medicine  / biology,  social science/ economics/
engineering . But a large part will come from insurance.

\end{frame}

\begin{frame}{\small Textbook (literature), cont.}

\vspace{0.3cm}
Textbook for for the Generalized Linear Mixed Models ,GLMM:
Zuur et al: Mixed Effects Models and Extensions in Ecology with R, 2009. Springer.
Available as electronic book.
\end{frame}

\begin{frame}{\small Textbook (literature), cont.}
Additional,  optional, literature: Julian J. Faraway:
Extending the linear model with R. Generalized linear, mixed effect and nonparametric regression models.
Chapman \& Hall/CRC 2006"

The book is available in the science library.

\end{frame}

\begin{frame}{\small Statistical software}
\small
In the course the {\tt R} package downloadable from {\tt http://mirrors.sunsite.dk/cran/}
will be used. It runs under the most common operative systems.

Most of the time procedures and functions available in {\tt R} will be used.
Not much own programming will be necessary.

For a short introduction  to  {\tt R} , see the web page
of STK1110 last year,  STK1110-h15.
%{\tiny {\tt http://www.math.uio.no/avdc/kurs/STK1120/R.html}} and
%{\tiny {\tt http://www.math.uio.no/avdc/kurs/STK1120/V08/introR.pdf}}
%\vspace{0.3cm}

A fine overview of {\tt R }  is the book written by Peter Dahlgaard:
Introductory Statistics with R,2nd ed., 2008, Springer

\end{frame}

\section{ Examples}
\begin{frame}{\small Example  1: Birth weight and length of pregnancy}
\small
{\tiny
\renewcommand{\arraystretch}{0.8}
\begin{tabular}{@{}lccccc@{}}\hline
\\ [-1ex]
& \multicolumn{2}{c}{Boys} & &
\multicolumn{2}{c}{Girls}
              \smallskip \\ \cline{2-3}\cline{5-6}
\\ [-1.5ex]
& Length (weeks) & Birth weight (gram) & & Length (weeks) & Birth weight (gram)  \\
 \hline
\\ [-1ex]
& 40\hspace{0.9em} & 2968\hspace{0.9em} & \hspace{1.5em} & 40\hspace{0.9em} &
                                                              3317\hspace{1.2em} \\
& 38\hspace{0.9em} & 2795\hspace{0.9em} & & 36\hspace{0.9em} & 2729\hspace{1.2em} \\
& 40\hspace{0.9em} & 3163\hspace{0.9em} & & 40\hspace{0.9em} & 2935\hspace{1.2em} \\
& 35\hspace{0.9em} & 2925\hspace{0.9em} & & 38\hspace{0.9em} & 2754\hspace{1.2em} \\
& 36\hspace{0.9em} & 2625\hspace{0.9em} & & 42\hspace{0.9em} & 3210\hspace{1.2em} \\
& 37\hspace{0.9em} & 2847\hspace{0.9em} & & 39\hspace{0.9em} & 2817\hspace{1.2em} \\
& 41\hspace{0.9em} & 3292\hspace{0.9em} & & 40\hspace{0.9em} & 3126\hspace{1.2em} \\
& 40\hspace{0.9em} & 3473\hspace{0.9em} & & 37\hspace{0.9em} & 2539\hspace{1.2em} \\
& 37\hspace{0.9em} & 2628\hspace{0.9em} & & 36\hspace{0.9em} & 2412\hspace{1.2em} \\
& 38\hspace{0.9em} & 3176\hspace{0.9em} & & 38\hspace{0.9em} & 2991\hspace{1.2em} \\
& 40\hspace{0.9em} & 3421\hspace{0.9em} & & 39\hspace{0.9em} & 2875\hspace{1.2em} \\
& 38\hspace{0.9em} & 2975\hspace{0.9em} & & 40\hspace{0.9em} & 3231\hspace{1.1em}
       \smallskip \\ \hline
\\ [-1ex]
Average & 38.33 & 3024.00 & & 38.75 & 2911.33 \smallskip \\ \hline
\end{tabular}
}

{\footnotesize

Of interest is the growth per week at the end of the pregnancy
and if the is any difference between boys and girls.}
\end{frame}

\begin{frame}[fragile]{\small Scatter plot for Ex 1.}
\begin{figure}[h]
\includegraphics[width= 10.0cm ,height = 6cm,angle=0]{figbrt_1.pdf}
%\epsfig{figure=fig1int.eps,width=6cm,angle=-90]
%\begin{center}
%\caption{log Cpi, log Import deflator, log Ulc, $\Delta$ log Cpi   } \label{fig:fig1}
%\end{center}
\end{figure}
\end{frame}


%\begin{slide}{\small Scatter plot for Ex 1.}
%{\small
%\vspace{-0.3cm}
%\mbox{\psfig{figure=fig/fvektgest1.EPS,angle=-0,width=10cm,height=7.1cm}}%
%}
%\end{slide}

\begin{frame}{\small Example 2: Lethal dose  for beetles}
\small{
Around 480 beetles were exposed for eight different concentrations of
${\rm CS}_2$. The number of deaths for the various concentrations
were recorded.
\vspace{-0.3cm}
{\tiny
\begin{center}
\begin{tabular}{@{}lcc@{}} \\  \hline
$\begin{array}{l} \mbox{Dose} \\ [-.3ex] (\log_{\scriptscriptstyle 10}
{\rm CS}_{\scriptscriptstyle 2}{\rm mg\, l}^{\scriptscriptstyle -1})
\end{array}$
& $\begin{array}{l} \mbox{No} \\ [-.3ex] \mbox{ } \end{array}$ &
$\begin{array}{l} \mbox{Dead} \\ [-.3ex] \mbox{  } \end{array}$ \\ [2ex] \hline
\\ [-2ex]
1.6907 & 59 & \hspace{.3em}6 \\
1.7242 & 60 & 13 \\
1.7552 & 62 & 18 \\
1.7842 & 56 & 28 \\
1.8113 & 63 & 52 \\
1.8369 & 59 & 53 \\
1.8610 & 62 & 61 \\
1.8839 & 60 & 60 \smallskip \\ \hline
\end{tabular}
\end{center}
}

\vspace{0.1cm}
What is the relation of size of dose and mortality?
}
\end{frame}

\begin{frame}[fragile]{\small Proportion dead beetles in  Ex 2.}
\begin{figure}[h]
\includegraphics[width= 10.0cm ,height = 6cm,angle=0]{figbeetl_1.pdf}
%\epsfig{figure=fig1int.eps,width=6cm,angle=-90]
%\begin{center}
%\caption{log Cpi, log Import deflator, log Ulc, $\Delta$ log Cpi   } \label{fig:fig1}
%\end{center}
\end{figure}
\end{frame}

%\begin{slide}{\small Eks. 2: Andel døde biller}
%{\small
%\vspace{-0.3cm}
%\mbox{\psfig{figure=fig/biller1.EPS,angle=-0,width=10cm,height=7.1cm}}%
%}
%\end{slide}

\begin{frame}{\small Example 3: number of children among pregnant. }
\small
de Jong \& Heller, page 15-16: Data for number of children among 141 pregnant women of different ages.

The number increases with age, see figure 1.11 i deJ\&H

\begin{figure}[h]
\includegraphics[width= 10.0cm ,height = 4cm,angle=0]{figpreg_1.pdf}
\end{figure}
\end{frame}





\begin{frame}{\small Example 3b: number of third party claims}
\small
de Jong \& Heller, side 17: Data over number of claims in 176 geographical regions  in New South Wales in a  en 12-months period.

\vspace{0.3cm}
Explanative variables, covariates:
\begin{itemize}
\item Statistical  category, 13 categories
\item Number of accidents in the region
\item Number of killed and injured
\item Size of population
\end{itemize}

In both examples: the response may be  Poisson distributed.

\end{frame}


\begin{frame}{\small Typical model for Ex 1: Linear regression}
\small
For $k=1,...,12$ and $j=1,2$ (where $j=1$ denotes boy  and $j=2$ denotes girl)
$$
\begin{array}{ll}
y_{jk} = & \mbox{ birth weight  for baby nr. } k \mbox{ gender nr. } j \\
x_{jk} = & \mbox{ length of pregnace for baby nr. } k \mbox{ gender nr. } j
\end{array}
$$
assume
$$
y_{jk} = \alpha_j + \beta x_{jk} + \varepsilon_{jk}
$$
where  $\varepsilon_{jk} \sim \mbox{ N}(0,\sigma^2)$, i.e.  normally distributed with expectation  0 and same
variance $\sigma^2$ and also independent.


\end{frame}

\begin{frame}{\small Typical model for Ex 1, cont. }
Parameters in the linear part:
\vspace{-0.1cm}
$$
\begin{array}{ll}
\beta = & \mbox{ slope }  \\
\alpha_j = & \mbox{ intercept for gender} \; j
\end{array}
$$
\end{frame}


\begin{frame}[fragile]{\small Least squares fit for Example 1.}
\begin{figure}[h]
\includegraphics[width= 10.0cm ,height = 5cm,angle=0]{figbrt_2.pdf}
%\epsfig{figure=fig1int.eps,width=6cm,angle=-90]
%\begin{center}
%\caption{log Cpi, log Import deflator, log Ulc, $\Delta$ log Cpi   } \label{fig:fig1}
%\end{center}
\end{figure}
Estimates: $\hat{\alpha}_1=-1447, \hat{\alpha}_2=-1610, \hat{\beta}=121$
\end{frame}



\begin{frame}{\small Alternative formulation Ex. 1}
\small
\begin{itemize}
\item Linearity: $\mbox{E}[y_{jk}] = \mu_{jk} = \alpha_j + \beta x_{jk}$
\item Constant variance: $\mbox{Var}[y_{jk}] = \sigma^2$
\item Normality assumption: $y_{jk} \sim N(\mu_{jk},\sigma^2)$
\item Independent responses: $y_{jk}$'s independent
\end{itemize}
\end{frame}

\begin{frame}{\small Alternative formulation Ex. 1, cont}
\vspace{0.2cm}
I GLM ( and STK3100 ) three first features  are modified to
\begin{itemize}
\item Linearity after transformation via "link-function" $g()$: $g(\mu_{jk}) = \alpha_j + \beta x_{jk}$
\item Variance may depend on the expectation of the responses.
\item Other  distributions for the responses: Binomial, Poisson, Gamma, ...
\end{itemize}

But independent responses are still assumed.

\end{frame}

\begin{frame}{\small EX. 2: Mortality of beetles}
\small
It is reasonable to assume  $y_i$ = number dead beetles for dose $x_i$ is binomially
distributed.
\vspace{-0.5cm}
$$
y_i \sim \mbox{bin}(n_i,\pi_i)
$$

where $\pi_i$ = probability for beetle dying with dose $x_i$ and

$n_i$ = number of  beetles receiving  dose $x_i$.

\vspace{0.5cm}

Linear model for $\pi_i$ fitted with least squares problematic
because

\begin{itemize}
\item $0\leq \pi_i \leq 1$ in contrast to expression $\alpha+\beta x_i$
\item $\mbox{Var}(y_i) = n_i \pi_i (1-\pi_i)$, i.e. non-constant (heteroskedastisc) structure of variance
\end{itemize}

\end{frame}

\begin{frame}{\small Usual model for  Ex. 2: Logistic regression}
\small
Logistic model of  regression:
$$
\pi_i = \frac{\exp(\alpha + \beta x_i)}{1+\exp(\alpha + \beta x_i)}
$$

Then $0 \leq \pi_i \leq 1$

\vspace{0.5cm}
Fit the logistic model of  regression with Maximum Likelihood (ML).
\begin{itemize}
\item Takes into account binomially distributed responses (and non-constant variance)
\item Efficient estimators (approximately for large data)
\end{itemize}

\end{frame}

\begin{frame}{\small Logistisc regression for Ex. 2: Number of dead  beetles}
\small
MLE: $\hat\alpha = -60.72, \hat\beta = 34.27$

Predicted probabilities: $\hat\pi = \frac{\exp(\hat\alpha + \hat\beta x)}{1+\exp(\hat\alpha + \hat\beta x)}$

\begin{figure}[h]
\includegraphics[width= 10.0cm ,height = 4cm,angle=0]{figbeetl_2.pdf}
%\epsfig{figure=fig1int.eps,width=6cm,angle=-90]
%\begin{center}
%\caption{log Cpi, log Import deflator, log Ulc, $\Delta$ log Cpi   } \label{fig:fig1}
%\end{center}
\end{figure}
%\vspace{-0.3cm}
%\mbox{\psfig{figure=fig/biller2.EPS,angle=-0,width=10cm,height=7.1cm}}%
\end{frame}

\begin{frame}[fragile]{\small Estimating logistic regression}
\small
Storvik: "Numerical optimization of likelihoods: Additional literature for STK2120" describes
a Newton-Rahpson routine in {\tt R} for fitting logistisc regression to such observations.
\vspace{0.4cm}
This is already implemented in {\tt R}. Use commando

\vspace{0.2cm}

{\footnotesize
\begin{verbatim}
glm(cbind(Dead,No-Dead)~Dose,family=binomial)
\end{verbatim}
}
\end{frame}




\section{ preliminary  description of GLM}
\begin{frame}{\small Example of GLM}
\begin{itemize}

\item {\tt glm} = Generalized Linear Model
\item {\tt family=binomial} because data  binary or binomial.
\item For binomial data  {\tt cbind(Dead,No-Dead)} needs "no. successes" (dead) and "no. failures" (No-Dead).
\end{itemize}
\end{frame}



\begin{frame}{\small Ex. 3: number of previous children for mothers}
\small
$y_i = $ number of previous children for mother  $i$.

Reasonable to assume $y_i$ Poisson distributed  with expectation  $\mu_i$
where $\mu_i$ depends on $x_i=$ mothers age.

\vspace{0.3cm}
As in  Ex. 2:
\begin{itemize}
\item Expectations $\mu_i > 0$
\item Variance of $y_i$ equals $\mu_i$, i.e. non-constant variance
\end{itemize}
\end{frame}

\begin{frame}{\small Ex. 3: number of previous children for mothers, cont.}

Usual solution: Poisson-regression

\vspace{0.3cm}
$y_i \sim \mbox{Po}(\mu_i)$  where $\mu_i=\exp(\alpha+\beta x_i)$

\vspace{0.3cm}
This is also a GLM and can be fitted with the  {\tt glm}-routine.

\vspace{0.3cm}
Only have to specify that data is assumed to be Poisson distributed with {\tt family=poisson}

\end{frame}



\begin{frame}{\small Poisson-regression for Ex. 3}
\small
MLE for $(\alpha,\beta)$: $(\hat\alpha,\hat\beta)=(-4.0895,0.1129)$

\vspace{0.3cm}
Fitted expectations: $\hat\mu_i = \exp(\hat\alpha+\hat\beta x_i)$
%\vspace{-0.7cm}
%\mbox{\psfig{figure=fig/antbarnforv.ps,angle=-0,width=10cm,height=7.1cm}%}%
\begin{figure}[h]
\includegraphics[width= 10.0cm ,height = 4cm,angle=0]{figpreg_2.pdf}
\end{figure}
\end{frame}

\begin{frame}{\small Definition of GLM}
\small
Independent responses $y_1, y_2, \ldots, y_n$

Vectors of covariates ${\bf x}_1, {\bf x}_2, \ldots, {\bf x}_n$

where ${\bf x}_i = (x_{i1},x_{i2},\ldots,x_{ip})$ is $p$-dimensional

\vspace{0.4cm}
A GLM = Generalized Linear Model is defined  by the
following three components:
\end{frame}

\begin{frame}{\small Definition of GLM, cont.}
\begin{itemize}
\item $y_1, y_2, \ldots, y_n$ has a distribution belonging to an exponential family

(Exponential families will be defined later, suffices to know that normal-, binomial-, Poisson-,
gamma-distributions belong to the exponential family)

\item Linear components  (predictors) $\eta_i = \beta_0 + \beta_1 x_{i1} + \cdots + \beta_p x_{ip}$

\item Link function $g()$: The expectation $\mu_i = \mbox{E}[y_i]$  is related to the  linear component
by $g(\mu_i) = \eta_i$
\end{itemize}

\end{frame}

\begin{frame}{\small Linear regression is a GLM}
\small
\begin{itemize}
\item Responses ($y_i$-er) from normal distribution
\item Linear component $\eta_i = \beta_0 + \beta_1 x_{i1} + \cdots + \beta_p x_{ip}$
\item $\mbox{E}[y_i] = \mu_i = \eta_i$, i.e  link function $g(\mu_i) = \mu_i$ is
the identity  function
\end{itemize}

In particular R-commands {\tt lm} for linear regression and {\tt glm} essentially  the same,
only a bit different output.

\vspace{0.3cm}
Linear regression is  in particular default-specification of  {\tt glm}

\end{frame}

\begin{frame}[fragile]{\small Ex. 1: Birth weights}
\vspace{0.2cm}
{\tiny
\begin{verbatim}

> lm(vekt~sex+svlengde)

Call:
 lm(formula = vekt ~ sex + svlengde)

Coefficients:
(Intercept)          sex     svlengde
    -1447.2       -163.0        120.9
\end{verbatim}
}
\end{frame}

\begin{frame}[fragile]{\small Ex. 1: Birth weights}
\vspace{0.2cm}
{\tiny
\begin{verbatim}

> glm(vekt~sex+svlengde)

Call:  glm(formula = vekt ~ sex + svlengde)

Coefficients:
(Intercept)          sex     svlengde
    -1447.2       -163.0        120.9

Degrees of Freedom: 23 Total (i.e. Null);  21 Residual
Null Deviance:      1830000
Residual Deviance: 658800       AIC: 321.4

\end{verbatim}
}
\end{frame}

\begin{frame}[fragile]{ \small Logistisc regression is GLM}
\small
\begin{itemize}
\item Responses ($y_i$'s) binomially distributed $\mbox{bin}(n_i,\pi_i)$
\item Linear component $\eta_i = \beta_0 + \beta_1 x_{i1} + \cdots + \beta_p x_{ip}$
\item $\mbox{E}[y_i]/n_i = \pi_i = \frac{\exp(\eta_i)}{1+\exp(\eta_i)}$,
so that link function $g(\pi_i) = \log(\frac{\pi_i}{1-\pi_i})$
\end{itemize}

Denote $g(\pi) = \log(\frac{\pi}{1-\pi}) = \mbox{logit}(\pi)$ as logit-function.
%}
\end{frame}
\begin{frame}[fragile]{ \small Logistic regression is GLM, cont.}
\vspace{0.2cm}
{\tiny
\begin{verbatim}
> glm(cbind(Dode,Ant-Dode)~Dose,family=binomial)

Call:  glm(formula = cbind(Dode, Ant - Dode) ~ Dose, family = binomial)
Coefficients:
(Intercept)         Dose
     -60.72        34.27

Degrees of Freedom: 7 Total (i.e. Null);  6 Residual
Null Deviance:      284.2
Residual Deviance: 11.23        AIC: 41.43
\end{verbatim}
}
\end{frame}

\begin{frame}[fragile]{\small Poisson regression is a GLM}
\small
\begin{itemize}
\item Response $y_i \sim \mbox{Po}(\mu_i)$
\item Linear component $\eta_i = \beta_0 + \beta_1 x_{i1}+ \cdots + \beta_p x_{ip}$
\item $\mbox{E}[y_i] = \mu_i = \exp(\eta_i)$, i. e.  link function $g(\mu_i) = \log(\mu_i)$ is
the ( natural) logarithmic function.
\end{itemize}
\end{frame}

\begin{frame}[fragile]{\small Poisson regression is a GLM, cont.}
\vspace{0.2cm}
{\tiny

\begin{verbatim}
> glm(children~age,family=poisson)

Call:  glm(formula = children ~ age, family = poisson)

Coefficients:
(Intercept)          age
    -4.0895       0.1129

Degrees of Freedom: 140 Total (i.e. Null);  139 Residual
Null Deviance:      194.4
Residual Deviance: 165  AIC: 290
\end{verbatim}
}
\end{frame}

\section{Some extensions }

\begin{frame}{ \small Some extensions}
\small
Other GLM's:
\begin{itemize}
\item Count data with negative binomial distribution: Over dispersion.
\item Continuous,  non-normal responses: gamma-, inverse gaussian distributions
\end{itemize}
These will be considered.
\end{frame}

\begin{frame}{ \small Some other  extensions}
\vspace{0.4cm}
Extensions of  GLM:
\begin{itemize}
\item Multinomial responses (ordinal and nominal)
\item Life time data
\item Analysis of  dependent data,GLMM
\item Generalized additive models (GAM)
\end{itemize}

We will consider  multinomial responses and GLMM.


\end{frame}
\begin{frame}{\small Example 4: Growth of trees and ozone exposure}
Growth for two groups of trees is recorded at five different
points of time. Of the trees 54 are located in an
environment with heavy traffic and 25 trees are a control
group. In total there are 395 measurements $y_{i,j},\; i=1,\cdots,79,\;j=1,\cdots,5.$
\end{frame}


\begin{frame}{\small Plot of 10 profiles in each group}
\small
\begin{figure}[h]
\includegraphics[width= 10.0cm ,height = 6cm,angle=0]{figsit_1.pdf}
\end{figure}
\end{frame}

\begin{frame}{\small Plot of average profiles}
\begin{figure}[h]
\includegraphics[width= 10.0cm ,height = 6cm,angle=0]{figsit_2.pdf}
\end{figure}
\end{frame}



\begin{frame}[fragile]{Exposure of ozone}
\tiny
\begin{verbatim}
Linear mixed-effects model fit by maximum likelihood

Random effects:
 Formula: ~1 + Time | tree
 Structure: General positive-definite, Log-Cholesky parametrization
            StdDev      Corr
(Intercept) 0.790968468 (Intr)
Time        0.002487428 -0.649
Residual    0.162608831

Fixed effects: size ~ Time + factor(treat) * Time
                             Value  Std.Error  DF   t-value p-value
(Intercept)              2.1217179 0.17806707 314 11.915274  0.0000
Time                     0.0141472 0.00063379 314 22.321782  0.0000
factor(treat)ozone       0.2216775 0.21537748  77  1.029251  0.3066
Time:factor(treat)ozone -0.0021385 0.00076658 314 -2.789663  0.0056

\end{verbatim}
\end{frame}



\begin{frame}{\small Survey of textbook by de Jong \& Heller}
\small
\begin{itemize}
\item Chapter 1: Introduction, Data examples:  will not be treated in detail
\item Chapter 2: Diverse distributions: with some exceptions known before
\item Chapter 3: Exponential classes, ML-estimation
\item Chapter 4: Linear modeling (mainly known from STK1110/STK2120)
\item Chapter 5: Generalized linear models

\end{itemize}
\end{frame}

\begin{frame}{\small Survey of textbook by de Jong \& Heller, cont.}
\begin{itemize}
\item Chapter6: Count data (Poisson regression, over dispersion)
\item Chapter 7: Categorical responses (binomial data, multinomial data)
\item Chapter 8: Continuous responses
\item Chapter 9: Correlated data
\item Chapter 10: Extensions
\end{itemize}
\end{frame}

\section{Plan STK3100}
\begin{frame}{\small Plan for course, STK3100/STK4100}
\small
Will follow  the textbook of de Jong \& Heller, but not in all details,
and not in sequence. Also some parts must be supplemented.\\

In the last part of the course we will treat GLMM and
the relevant material in Zuur et al.

\vspace{0.3cm}
Approximate plan for first lectures:
\end{frame}
\begin{frame}{\small Plan for course, STK3100/STK4100, cont.}
\begin{itemize}
\item Introduction, today!
\item Chapter 4. Linear models, mainly repetition of STK1110/STK2120, Friday August 26th
\item Chapter 3: Exponential classes, August 29th.
\item Chapter 5: GLM and ML-theory September 5th.
\item Chapter 7: Binomial and binary  data
\item Chapter 6: Count data
\end{itemize}

\end{frame}
\begin{frame}{\small Plan for course, STK3100/STK4100, cont.}
\small
\begin{itemize}
\item Chapter 7: Multinomial data
\item Chapter 8: A little of continuous responses
\item Extensions: Correlated data and GAM, material from
Zuur et al. chapters 6, 7 and 13.
\end{itemize}

\end{frame}

\end{document}
