Lecture 29—Friday, March 3, 2006

What was covered?

Terminology Defined

Goodness of Fit Tests for Transformed Count Models

Fig. 1  Log-Arrhenius Regression Model

> log.arrhenius<-lm(log(sp.richness)~ log(island.area), data=islands)

> means<-fitted(log.arrhenius)
> means

Appledore Island        Bear Island        Block Island    Cuttyhunk Island
        5.050165           4.199691            6.434003            5.188721
  Fishers Island   Gardiners Island  Grand Manan Island           Gull Rock
        6.164149           6.205569            6.964010            4.294147
    Horse Island       Isle au Haut         Kent Island Machias Seal Island
        4.294147           6.317777            5.432068            4.594997
Marthas Vineyard     Matinicus Rock Mount Desert Island     Muskeget Island
        6.964010           4.521731            7.185109            5.461491
Nantucket Island     Naushon Island     Penikese Island   Tuckernuck Island
        6.891348           6.380507            4.996805            5.762341
Whaleboat Island Wooden Ball Island
        5.103115           5.096054

> sigma<-sqrt((sum(residuals(log.arrhenius)^2))/dim(islands)[1])
> sigma

[1] 0.3751165

> prob.func<-function(x, means, sigma)
    mean(pnorm(log(x+.5) ,mean=means, sd=sigma)-pnorm(log(x-.5), mean=means, sd=sigma))

> sum(sapply(1:2000,function(x) prob.func(x,means,sigma)))
[1] 0.9884405

> tail.prob<-function(x, means, sigma) mean(1-pnorm(log(x-.5), mean=means, sd=sigma))

> sum(sapply(1:2000, function(x) prob.func(x, means, sigma))) + tail.prob(2001, means, sigma)
[1] 1

> exp.probs<-c(sapply(1:2000, function(x) prob.func(x, means, sigma)), tail.prob(2001, means, sigma))
> length(exp.probs)

[1] 2001

> exp.freqs<-exp.probs*dim(islands)[1]
> sum(exp.freqs)

[1] 22

> min((1:2001)[cumsum(exp.freqs)>5])
[1] 114
> sum(exp.freqs[1:114])
[1] 5.032401

> sapply(c(5,10,15,20),function(x) min((1:2001)[cumsum(exp.freqs)>x]))
[1] 114 219 501 1136

> Ei<-c(sum(exp.freqs[1:114]), sum(exp.freqs[115:219]), sum(exp.freqs[220:501]), sum(exp.freqs[502:2001]))
[1] 5.032401 4.969453 5.004261 6.993884

> sum(islands$sp.richness<=114)
[1] 5
> sum(islands$sp.richness<=219)-sum(islands$sp.richness<=114)
[1] 4
> sum(islands$sp.richness<=501)-sum(islands$sp.richness<=219)
[1] 5
> sum(islands$sp.richness>501)
[1] 8
> Oi<-c(5,4,5,8)

> sum((Oi-Ei)^2/Ei)
[1] 0.3340717

which is quite small.

Energy Cost of Echo-Location in Bats: An Example of Analysis of Covariance

The Models

> type.factor<-factor(type,labels=c('nonecho bats', 'birds','echo bats'))
> contrasts(type.factor)

                X1        X2
             birds echo bats
nonecho bats     0         0
birds            1         0
echo bats        0         1

Model 1—Coincident Lines

Model 2—Parallel Lines

Group Intercept
nonecho bats β0
birds

β0 + β2

echo bats β0 + β3

Model 3—Non-parallel Lines

The terms x1z and x2z are called interaction terms. Literally they are the products of the variables x1 with z and x2 with z.

Group Intercept Slope
nonecho bats β0 β1
birds

β0 + β2

β1 + β4

echo bats β0 + β3 β1 + β5

Testing the Models

Step 1

Step 2

Cited reference

 

Course Home Page


Jack Weiss
Phone: (919) 962-5930
E-Mail: jack_weiss@unc.edu
Address: Curriculum in Ecology, Box 3275, University of North Carolina, Chapel Hill, 27516
Copyright © 2006
Last Revised--March 6, 2006
URL: http://www.unc.edu/courses/2006spring/ecol/145/001/docs/lectures/lecture29.htm