unemployment: data on long / short term unemployment

Description Usage Format Details Source Examples

Description

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

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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!

asuR documentation built on May 2, 2019, 4:50 p.m.

Related to unemployment in asuR...