I am trying to reproduce the results that are in the book An introduction to Generalized Linear Models third edition of Dobson and Barnett, page 161. The fit is an ordinal regression applied to dataset (download link) . My big confusion is that the numerical results are the same plus the signal is the opposite, I think it has to see reparametrization, but I'm not sure. Follow the code I used and also leave the pictures of the estimates presented in the book and the estimates I got. Thanks for the possible comments of what's going on.
library(readxl) #para usar la función "read_excel"
car_pref <- read_excel('car.xls')
car_pref <- car_pref[-1,]
car_pref <- car_pref[-1,]
colnames(car_pref) <- c("sex","age","response","frequency")
car_pref$frequency <- as.numeric(car_pref$frequency)
car_pref$sex <- factor(car_pref$sex)
car_pref$age <- factor(car_pref$age)
car_pref$response <- factor(car_pref$response)
car_pref$sex <- relevel(car_pref$sex, ref="women")
car_pref$age <- relevel(car_pref$age, ref="24-40")
car_pref$age <- relevel(car_pref$age, ref="18-23")
car_pref$response <- relevel(car_pref$response, ref="very important")
library(MASS)
res.polr <- polr(factor(response)~factor(age) + factor(sex), weights=frequency,data=car_pref)
summary(res.polr)
Myresults
See that the estimates are numerically the same plus the sign is the opposite.
The code that the book presents is
res.polr <- polr(factor(response)~factor(age) + factor(sex), weights=frequency,data=car_pref)
More using this I do not get the output that the book presents.