Learn R Programming

glarma (version 1.6-0)

OxBoatRace: Oxford-Cambridge Boat Race

Description

Results of the boat race between Oxford and Cambridge from 1829--2011.

Usage

data(OxBoatRace)

Arguments

Format

A data frame containing the following columns:

[, 1]

Year Year in which the race occurred. Some years are missing when the race was not run.

[, 2]

Intercept A vector of ones, providing the intercept in the model.

[, 3]

Camwin A binary response, zero for an Oxford win, one for a Cambridge win.

[, 4]

WinnerWeight Weight of winning team's crew.

[, 5]

LoserWeight Weight of losing team's crew.

[, 6]

Diff Difference between winning team's weight and losing team's weight.

Examples

Run this code
# NOT RUN {
### Example with Oxford-Cambridge Boat Race
data(OxBoatRace)

y1 <- OxBoatRace$Camwin
n1 <- rep(1, length(OxBoatRace$Year))
Y <- cbind(y1, n1 - y1)
X <- cbind(OxBoatRace$Intercept, OxBoatRace$Diff)
colnames(X) <- c("Intercept", "Weight Diff")

oxcamglm <- glm(Y ~ Diff + I(Diff^2),
                data = OxBoatRace,
                family = binomial(link = "logit"), x = TRUE)
summary(oxcamglm)

X <- oxcamglm$x

glarmamod <- glarma(Y, X, thetaLags = c(1, 2), type = "Bin", method = "NR",
                    residuals = "Pearson", maxit = 100, grad = 1e-6)

summary(glarmamod)
likTests(glarmamod)

## Plot Probability of Cambridge win versus Cambridge Weight advantage:
beta <- coef(glarmamod, "beta")
par(mfrow = c(1, 1))
plot(OxBoatRace$Diff, 1 / (1 + exp(-(beta[1] + beta[2] * OxBoatRace$Diff +
                                       beta[3] * OxBoatRace$Diff^2))),
     ylab = "Prob", xlab = "Weight Diff")
title("Probability of Cambridge win \n versus Cambridge weight advantage")

## Residuals and fit plots
par(mfrow=c(3, 2))
plot.glarma(glarmamod)
# }

Run the code above in your browser using DataLab