unemployment {asuR}R Documentation

data on long / short term unemployment

Description

Data set with success (long term) unemployment against total number o unemployment.

Usage

data(unemployment)

Format

A data frame with 983 observations on the following 2 variables.

success
a factor with levels <6m >6m
gender
a factor with levels female male

Details

no

Source

GLM course notes by Gerhard Tutz (have a look at his nice book!)

Examples

data(unemployment)
contrast.matrix <- rbind("male-female"=c(1,-1))

u.glm <- glm(success~gender, data=unemployment, family=binomial, contrasts=list(gender=mycontr(contrast.matrix)))

###  for data in the grouped form
#################################
### we make a data set in grouped form
table(unemployment$gender, unemployment$success)
unemployment.grouped <- data.frame(longterm=c(167,175), shortterm=c(403,238), gender=c("male","female"))

u.glm.grouped <- glm(cbind(longterm,shortterm) ~ gender, data=unemployment.grouped, family=binomial, contrasts=list(gender=mycontr(contrast.matrix)))
summary(u.glm.grouped)
coefficients(u.glm.grouped)

### extracting the factors by which the odds change from male to female
factor <- exp(coefficients(u.glm.grouped)[2])

### the "same" calculations by hand:
attach(unemployment.grouped)
p <- longterm/(shortterm+longterm)
detach(unemployment.grouped)
odds <- p/(1-p)

odds[1]*factor
### should give the same as
odds[2]

###   for those who like p-values
#################################
anova(u.glm, test="Chisq")
### is the same
anova(u.glm.grouped,test="Chisq")
### the same p-value
pchisq(17.959,1,lower.tail=FALSE)
### and also almost the same p-value as with a chisq.test()...that you
### can try yourself!

[Package asuR version 0.08-24 Index]