barley | R Documentation |

Incidence of *R. secalis* on the leaves of ten varieties of barley grown
at nine sites.

barley

A data frame with 90 observations on the following 3 variables.

- y
the proportion of leaf affected (values in [0,1])

- site
a factor with 9 levels

`A`

to`I`

- variety
a factor with 10 levels

`c(1:9, "X")`

This dataset was used in Wedderburn's original paper (1974) on quasi-likelihood.

Originally in an unpublished Aberystwyth PhD thesis by J F Jenkyn.

Gabriel, K R (1998). Generalised bilinear regression. *Biometrika*
**85**, 689–700.

McCullagh, P and Nelder, J A (1989) *Generalized Linear Models* (2nd ed).
Chapman and Hall.

Wedderburn, R W M (1974). Quasilikelihood functions, generalized linear models
and the Gauss-Newton method. *Biometrika* **61**, 439–47.

set.seed(1) ### Fit Wedderburn's logit model with variance proportional to [mu(1-mu)]^2 logitModel <- glm(y ~ site + variety, family = wedderburn, data = barley) fit <- fitted(logitModel) print(sum((barley$y - fit)^2 / (fit * (1-fit))^2)) ## Agrees with the chi-squared value reported in McCullagh and Nelder ## (1989, p331), which differs slightly from Wedderburn's reported value. ### Fit the biplot model as in Gabriel (1998, p694) biplotModel <- gnm(y ~ -1 + instances(Mult(site, variety), 2), family = wedderburn, data = barley) barleySVD <- svd(matrix(biplotModel$predictors, 10, 9)) A <- sweep(barleySVD$v, 2, sqrt(barleySVD$d), "*")[, 1:2] B <- sweep(barleySVD$u, 2, sqrt(barleySVD$d), "*")[, 1:2] ## These are essentially A and B as in Gabriel (1998, p694), from which ## the biplot is made by plot(rbind(A, B), pch = c(levels(barley$site), levels(barley$variety))) ## Fit the double-additive model as in Gabriel (1998, p697) variety.binary <- factor(match(barley$variety, c(2,3,6), nomatch = 0) > 0, labels = c("rest", "2,3,6")) doubleAdditive <- gnm(y ~ variety + Mult(site, variety.binary), family = wedderburn, data = barley) ## It is unclear why Gabriel's chi-squared statistics differ slightly ## from the ones produced in these fits. Possibly Gabriel adjusted the ## data somehow prior to fitting?

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.