[R] Ordinal categorical data with GLM
Andrew Criswell
arc at arcriswell.com
Sun Aug 11 06:31:55 CEST 2002
Hello All:
I am looking for you help.
I am trying to replicate the results of an example found in Alan Agresti's
"Categorical Data Analysis" on pages 267-269. The example is one of a 2 x 2
cross-classification table of ordinal counts: job satisfaction and income.
I am able to get Agresti's results for the independence model (G^2 = 12.03
with df = 9) assuming as he does that the data is nominal, but I'm unable to
derive his model of uniform association (linear-by-linear association, p.
263-269) for which he gets a value of G^2 = 2.39 with df = 8.
The observed data is represented by table 8.2 on page 268 and as follows:
Freq <- c(20, 24, 80, 82, 22, 38, 104, 125, 13, 28, 81, 113, 7, 18, 54,
92)
data.3 <- t(matrix(Freq, nrow = 4))
list.3 <- list(Income = c("< 6,000", "6,000-15,000", "15,000-25,000", ">
25,000"),
Satisfaction = c("Very dissatisfied", "Little
dissatisfied", "Moderately satisfied", "Very satisfied"))
dimnames(data.3) <- list.3
ftable(data.3)
I am able to obtain Agresti's results for the independence model which
assumes the data is nominal, not ordinal, using either glm() or loglm().
library(MASS)
options(contrasts=c("contr.sum", "contr.poly"))
X <- as.integer(gl(4, 4, 16)) - 1
Y <- as.integer(gl(4, 1, 16)) - 1
data.2 <- data.frame(Freq, X = factor(X), Y = factor(Y))
summary(fm3 <- glm(Freq ~ X + Y, data = data.2, family = poisson()))
dummy.coef(fm3)
fm4 <- loglm(Freq ~ X + Y, data = data.2, param = T, fit = T)
fm4; fm4$param
My question is this: can glm() or some other function be used in the manner
Agresti employed for ordinal count data?
Thank you,
ANDREW
Andrew Criswell
Professor of Finance
Graduate School
Bangkok University
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list