Title: Module 7: LogLinear Modeling
 1Module 7 Log-Linear Modeling
- RSF Conference Workshop 11-12 January 2003 
 
  2Summary
- What is a log-linear model? 
 - Log-linear models applied to resource selection 
 - Base rates 
 - White-tailed deer example
 
  3What is a Log-Linear Model?
- Log-linear models are also called Poisson 
regression models.  - Log-linear models are regression models for count 
data 
  4What is a Log-Linear Model?
- Recall regular (normal theory) regression 
 - We assume responses Y1,  Yn are independently 
and identically distributed normal random 
variables  - I.e., YiNormal(?i,?) 
 - We also assume 
 - ?i  ß0  ß1xi1  ...  ßpxip
 
  5What is a Log-Linear Model?
- An alternative view of the regular regression 
equation is  - g(?i) ß0  ß1xi1  ...  ßpxip 
 -  where the function g(x)  x. 
 - g is called the link function 
 - g links the linear predictor ß0  ß1xi1  ...  
ßpxip to ?i, the expected value of Yi.  
  6What is a Log-Linear Model?
- In regular regression, coefficients ß0,  , ßp 
are estimated by minimizing the function  - D is called the sum of squares 
 - Estimates are said to be least squares estimates
 
  7What is a Log-Linear Model?
- For a log-linear model 
 - We assume responses Y1,  Yn are independently 
and identically distributed Poisson random 
variables  - I.e., YiPoisson(?i) 
 - We also assume 
 - g(?i) ß0  ß1xi1  ...  ßpxip 
 -  where g(x)  log(x)
 
  8What is a Log-Linear Model?
- In Poisson regression, coefficients ß0, , ßp are 
estimated by minimizing the function  - D is called the deviance function 
 - D is derived from the form of the Poisson 
distribution (left for the interested reader!) 
  9What is a Log-Linear Model?
- Differences between D statistics for different 
models can be used to assess the relative fit of 
those models. 
  10What is a Log-Linear Model?
- Log-linear model fitting demonstration
 
  11(No Transcript) 
 12(No Transcript) 
 13(No Transcript) 
 14(No Transcript) 
 15RSF Setting
- Log-linear modelling can be used to relate 
resource selection to factors such as individual 
animals involved, or time of day. Potentially 
this approach is very versatile.  - It is assumed that data available consists of I 
independent counts Y1 to YI, where the ith count 
has a Poisson distribution with mean value  - µi  exp(ß0  ß1xi1  ...  ßpxip)
 
  16Base Rates
- Sometimes it is known that µi should be 
proportional to some base rate, Bi, so that the 
equation is better taken as  - µi  Biexp(ß0  ß1xi1  ...  ßpxip) 
exp(log(Bi)  ß0  ß1xi1  ...  ßpxip)  
  17Base Rates
- E.g., suppose that Yi  number of times that 
animal is seen in the ith type of habitat, where 
it is known that 60 of the habitat available to 
the animal is of this type. Then it is 
appropriate to set Bi  0.60 so that if there is 
no selection then the model  - µi  Biexp(ß0) 
 -  should fit exp(ß0) allows for the total number 
of observations made on the animal. 
  18Computer Programs
- Fitting log-linear model requires a suitable 
computer program. Many are available, including 
SAS Proc Genmod, GLIM, S-Plus glm(), and Manlys 
LOGLIN. Quattro or Excel can also be used. 
  19White-tailed Deer Example
- This application of log-linear modelling was 
described by Heisey (1985).  - The data were reported by Nelson (1979) from a 
radio tracking study of habitat use by 
white-tailed deer.  - Data consisted of habitat use (HU) of two 
white-tailed deer in four types of habitat, with 
the proportional availability of those habitats 
(HA). 
  20White-tailed Deer Example
- Data 
 -  
 Midday Morning and 
evening  -  Deer 68 Deer 342 
Deer 68 Deer 342  -  Habitat HU HA HU HA HU 
 HA HU HA  
 -  Aspen 18 0.66 29 0.65 43 
0.66 46 0.65  -  Clearcut 2 0.20 1 0.13 33 
0.20 29 0.13  -  Plantation 0 0.09 4 0.13 5 
0.09 4 0.13  -  Spruce 0 0.05 0 0.09 0 
0.05 2 0.09  
 
  21White-tailed Deer Example
- This is a Design III study with sampling protocol 
A, where availability was censused and use was 
sampled for each of two animals.  - One method for analysing data 
 - Estimate selection ratios first using the midday 
results, and then separately for the morning and 
evening results using animals as replicates. 
  22White-tailed Deer Example
- Problem 
 - Variance estimates would be unreliable as they 
would be based on differences between only two 
animals. Hence tests for selection and for 
differences between selection ratios would also 
be unreliable.  
  23White-tailed Deer Example
- Another Method 
 - Assume counts are values from independent Poisson 
distributions. Reasonable providing that the 
individual observations on deer locations were 
far enough apart in time to be independent. 
Assume that this was the case.  - Heissey used program GLIM to analyse data. This 
automatically constructs X variables for the 4 
habitat types, 2 deer, and 2 times of day. 
  24White-tailed Deer Example
- Variables can be set up easily enough for use in 
a program that does not have this facility, as 
below. Will be seen that base rates and 12 
variables are needed to account for selection 
related to time of day  deer.  
  25White-tailed Deer Example
- Data 
 - Base rates  proportion available of each habitat 
type.  - X1  1 for aspen, otherwise 0 
 - X2  1 for clearcut, otherwise 0 
 - X3  1 for plantation, otherwise 0 
 - X4  1 for midday, 0 for morning  afternoon 
 - X5  1 for deer 68, 0 for deer 342 
 - X6  X1X4 X7  X2X4 X8  X3X4 X9  X1X5 
X10  X2X5 X11  X3X5  X12  X4X5 
  26White-tailed Deer Example
- Data 
 -  Sample Base 
 -  count rate X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 
X12  -  
  -  18 0.66 1 0 0 1 1 1 0 0 1 0 0 
1  -  29 0.65 1 0 0 1 0 1 0 0 0 0 0 
0  -  43 0.66 1 0 0 0 1 0 0 0 1 0 0 
0  -  46 0.65 1 0 0 0 0 0 0 0 0 0 0 
0  -  2 0.20 0 1 0 1 1 0 1 0 0 1 0 
1  -  1 0.13 0 1 0 1 0 0 1 0 0 0 0 
0  -  . 
 -  . 
 -  5 0.09 0 0 1 0 1 0 0 0 0 0 1 
0  -  4 0.13 0 0 1 0 0 0 0 0 0 0 0 
0  -  0 0.05 0 0 0 1 1 0 0 0 0 0 0 
1  -  0 0.09 0 0 0 1 0 0 0 0 0 0 0 
0  -  0 0.05 0 0 0 0 1 0 0 0 0 0 0 
0  -  2 0.09 0 0 0 0 0 0 0 0 0 0 0 
0  
  27White-tailed Deer Example
- No Selection Model 
 - Includes X4, X5  X12 allows the expected counts 
to depend on the deer  the time of day, with 
deer effect possibly varying with the time of 
day habitat use is proportional to availability. 
 No selection deviance  78.26 with 12 df. 
  28White-tailed Deer Example
- Selection Model 1 
 - Adding X1 to X3 allows some selection to take 
place, at same level for both deer and both times 
of day. Deviance  32.42 with 9 df. 
  29White-tailed Deer Example
- Selection Model 2 
 - It is possible to expand model to either allow 
selection to depend on time of day (adding X6 to 
X8) or allow selection to depend on deer (adding 
X9 to X11). Deviance is reduced to 6.44 with 6 
df if the first option is taken, but reduced 
hardly at all to 30.88 with 6 df if the second 
option is chosen. The first option is therefore 
best. 
  30White-tailed Deer Example
- Selection Model 3 
 - The next stage consists of allowing selection to 
depend on both the deer and the time of day by 
including all of variables X1 to X12. Deviance  
4.41 with 3 degrees of freedom. 
  31White-tailed Deer Example
- The only way that the model can be expanded now 
is by adding X variables that allow selection of 
habitat by deer to vary with the time of day. 
Then there are as many parameters as sample 
frequencies so that the model is 'saturated' with 
parameters and fits data exactly. 
  32White-tailed Deer Example
- The model building process is summarised in an 
analysis of deviance table. A reasonable 
conclusion is that there was selection, and that 
this depended on the time of day but not on the 
deer. 
  33White-tailed Deer Example
- Model building summary 
 -  
 
 Difference  -  Model XL² 
df XL² df  
 -  No selection of habitat 78.26 
12  -  
 45.84 3  -  Constant selection on habitat 32.42 
 9  -  
 25.98 3  -  Selection varies with time 6.44 
 6  -  
 2.03 3  -  Selection varies with time  deer 4.41 
 3  -  
 4.41 3  -  Selection with time effect varying 
  -  with deer 0.00 
 0  
 - Significantly large at 0.1 level.
 
  34Summary
- Log-linear models explained 
 - Log-linear models applied to resource selection 
 - White-tailed deer example