Ein Doktorand bei uns hat eine Reihe von Leuten nach ihrem Ausbildungsgrad befragt und danach in Sekunden gemessen, wie lange etwas dauert.
Ich habe also einen ordered factor für die Schulerfahrung und einen numerischen in Sekunden geeicht. Die Daten sehen etwa so aus:
Code: Alles auswählen
messung <- structure(list(edu = structure(c(6L, 4L, 4L, 6L, 2L, 6L, 6L,
4L, 7L, 9L, 4L, 6L, 4L, 3L, 6L, 8L, 6L, 4L, 6L, 4L, 1L, 6L, 6L,
6L, 9L, 6L, 6L, 6L, 5L, 6L, 9L, 9L, 3L, 6L, 4L, 4L, 5L, 6L, 6L,
4L, 4L, 6L, 6L, 6L, 4L, 6L, 6L, 4L, 4L, 6L, 6L, 4L, 4L, 6L, 6L,
3L, 6L, 6L, 4L, 4L, 6L, 1L, 4L, 4L, 4L, 6L, 4L, 6L, 4L, 4L, 7L,
6L, 4L, 6L, 4L, 6L, 4L, 4L, 6L, 6L, 4L, 4L, 4L, 9L, 6L, 6L, 6L,
7L, 9L, 6L, 4L, 6L, 4L, 7L, 6L, 4L, 4L, 3L, 5L, 4L, 4L, 6L, 7L,
5L, 6L, 6L, 4L, 4L, 6L, 6L, 6L, 8L, 9L, 2L, 6L), .Label = c("5. Klasse",
"6. Klasse", "7. Klasse", "8. Klasse", "9. Klasse", "10. Klasse",
"Abitur", "Fachhochschule", "Abitur + Studium"), class = c("ordered",
"factor")), duration = c(199, 212, 151, 229, 204, 94, 182, 172,
96, 126, 217, 135, 176, 156, 174, 146, 232, 224, 183, 274, 236,
238, 119, 185, 192, 239, 138, 125, 105, 131, 197, 190, 182, 140,
187, 146, 73, 263, 116, 135, 157, 223, 156, 106, 174, 143, 125,
138, 268, 145, 138, 273, 213, NA, 191, 154, 111, 86, NA, 241,
215, 407, 116, 276, 455, 190, 200, 182, 325, 104, 136, NA, 244,
NA, 220, 122, 351, 228, 125, 142, 240, 319, 211, 257, 276, 207,
122, 104, 76, 181, 157, 227, 162, 168, 84, 167, 160, 448, NA,
119, 170, 111, 117, 101, 272, 149, 153, 143, 167, 156, 123, NA,
148, 119, 250)), .Names = c("edu", "duration"), class = "data.frame", row.names = c(NA,
-115L))
Code: Alles auswählen
> str(messung)
'data.frame': 115 obs. of 2 variables:
$ edu : Ord.factor w/ 9 levels "5. Klasse"<"6. Klasse"<..: 6 4 4 6 2 6 6 4 7 9 ...
$ duration: num 199 212 151 229 204 94 182 172 96 126 ...
> levels(messung[,"edu"])
[1] "5. Klasse" "6. Klasse" "7. Klasse" "8. Klasse"
[5] "9. Klasse" "10. Klasse" "Abitur" "Fachhochschule"
[9] "Abitur + Studium"
Code: Alles auswählen
> summary(lm(duration ~ edu, data=messung))
Call:
lm(formula = duration ~ edu, data = messung)
Residuals:
Min 1Q Median 3Q Max
-103.32 -44.96 -10.96 32.68 247.68
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 180.545 12.476 14.472 < 2e-16 ***
edu.L -118.351 42.558 -2.781 0.00648 **
edu.Q 91.211 33.945 2.687 0.00844 **
edu.C -6.893 34.591 -0.199 0.84246
edu^4 33.675 44.942 0.749 0.45544
edu^5 -57.514 42.866 -1.342 0.18273
edu^6 70.856 41.257 1.717 0.08900 .
edu^7 -35.684 27.421 -1.301 0.19612
edu^8 -56.069 27.116 -2.068 0.04124 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 65.11 on 100 degrees of freedom
(6 observations deleted due to missingness)
Multiple R-squared: 0.2331, Adjusted R-squared: 0.1717
F-statistic: 3.799 on 8 and 100 DF, p-value: 0.0006249
Eine Anschlussfrage stelle ich dann später noch.
LG,
Bernhard