-
Notifications
You must be signed in to change notification settings - Fork 0
/
evaluation.Rmd
391 lines (268 loc) · 9.35 KB
/
evaluation.Rmd
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
---
title: "Evaluation"
output: html_document
---
```{r}
library(psych)
source('util.R')
source('survey_696322_R_syntax_file.R')
data <- data[,c(2:length(data))]
```
```{r}
summary(data$Q002)
data <- data[data$Q002 < 30,]
hist(data$Q002, main = "Anzahl erwerbstatiger Semsester")
```
someone had 333 semesters -> remove
```{r}
summary(data$Q003)
hist(data$Q003, main = "Anzahl Praktika")
```
```{r}
summary(data$Q013)
boxplot(data$Q013, main = "Alter")
```
```{r}
summary(data$Q015)
hist(data$Q015, main = "Anzahl Semester")
```
```{r}
plot(data$Q016, main = "Haufigkeit akademischer Grade")
levels(data$Q016)[3] <- levels(data$Q016)[2]
```
No respondent was a doctor, so we remove this category.
```{r}
data["AnteilErwerbssemester"] <- data$Q002 / data$Q015
paste("Students with working semesters > 0 but semesters = 0: ", sum(is.infinite(data$AnteilErwerbssemester)))
data <- data[!is.infinite(data$AnteilErwerbssemester),]
data[is.nan(data$AnteilErwerbssemester),]$AnteilErwerbssemester <- 0
data[data$AnteilErwerbssemester > 1,]$AnteilErwerbssemester <- 1
```
someone had Erwerbssemester > 0 while Semester = 0, which is impossible -> remove
```{r}
data["PraktikaProSemester"] <- data$Q003 / data$Q015
paste("Students with internships > 0 but semesters = 0: ", sum(is.infinite(data$AnteilErwerbssemester)))
data[is.infinite(data$PraktikaProSemester),]$PraktikaProSemester <- 1
data[is.nan(data$PraktikaProSemester),]$PraktikaProSemester <- 0
data[data$PraktikaProSemester > 1,]$PraktikaProSemester <- 1
```
Dependent Variable
---
Explanations in karriereerwartung.Rmd
```{r}
pca.data <- data[,c("Q001_SQ003", "Q001_SQ005")]
indx <- sapply(pca.data, is.factor)
pca.data[indx] <- lapply(pca.data[indx], as.numeric)
pca.result <- principal(pca.data, nfactors = 1, scores = TRUE)
erfolg.scores <- pca.result$scores[,'PC1']
data["Erfolg"] <- erfolg.scores
```
Hypothesis 1
---
More work during university -> higher aspiration for career success
### `Erwerbstätigkeit` index
```{r}
erwerb.data <- data[,c("AnteilErwerbssemester", "PraktikaProSemester")]
boxplot(list(data$AnteilErwerbssemester, data$PraktikaProSemester))
```
```{r}
alpha(erwerb.data)
KMO(erwerb.data)
```
Anteil Erwerbssemester and Praktika pro Semester are not reliable measures (alpha = 0.11), KMO = 0.5 -> therefore PCA not really fitting
We decide to test the hypothesis for both individually -> no `Erwerbstätigkeit` index
### Test
Does the amount of semesters in which a student worked affect the aspiration for career success?
```{r}
plot(data$Q002, data$Erfolg, xlab = "Anzahl erwerbstätige Semester", ylab = "Erfolgserwartung")
```
The plot seems to show a slight negative correlation. We use a linear regression to see if this is significant. Our hypotheses using a significance level of $\alpha=0.05$ are:
* $H_0$: The regression coefficient of the variable `Anzahl erwerbstätige Semester` is 0. $\beta_{Anzahl erwerbstätige Semester} = 0$
* $H_A$: The regression coefficient of the variable `Anzahl erwerbstätige Semester` is different from 0. $\beta_{Anzahl erwerbstätige Semester} \neq 0$
```{r}
lm.result <- lm(Erfolg ~ Q002, data)
summary(lm.result)
```
The result of the linear regression using ordinary least squares is that $\beta_{Anzahl erwerbstätige Semester}$ is not significantly different from 0, as the corresponding p-value is 0.124 > $\alpha$. Therefore, there is no evidence that the aspiration for career sucess is dependent upon the amount of semesters in which a student worked.
We still need to look at a few plots of the linear model to see if it is useful for our dataset.
```{r}
plot(lm.result)
```
quantile-quantile not really god, residual plot ok
```{r}
plot(data$Q003, data$Erfolg, xlab = "Anzahl Praktika", ylab = "Erfolgserwartung")
```
```{r}
lm.result <- lm(Erfolg ~ Q003, data)
summary(lm.result)
```
significant: the more internships, the less Erfolg aspiration -> our hypothesis is false
```{r}
plot(lm.result)
```
quantile-quantile not really god, residual plot ok
Hypothesis 2
---
higher support of parents -> higher aspiration for career success
```{r}
support.data <- data[,c("Q004_SQ001", "Q004_SQ002", "Q004_SQ003", "Q004_SQ004", "Q004_SQ005", "Q004_SQ006", "Q004_SQ007")]
support.data <- factors.as.numeric(support.data)
alpha(support.data)
KMO(support.data)
```
good alpha and KMO -> PCA
```{r}
support.data <- support.data[-1]
support.names <- c("Books", "Fees", "Travel", "Food", "Allowance", "Expenses")
alpha(support.data)
KMO(support.data)
```
```{r}
pca.result <- principal(support.data, nfactors = 1, scores = TRUE)
support.scores <- pca.result$scores[,'PC1']
data["HilfeEltern"] <- support.scores
plot(pca.result$value, type = 'b', main = 'Screeplot')
```
```{r}
barplot(pca.result$loadings[,1], names.arg = support.names, main = "Item loadings on parental support factor", ylab = "Loading", xlab = "Items")
```
```{r}
hist(data$HilfeEltern)
```
```{r}
plot(data$HilfeEltern, data$Erfolg, xlab = "Parental support", ylab = "Aspiration for career success")
```
```{r}
lm.result <- lm(Erfolg ~ HilfeEltern, data)
plot(lm.result)
```
quantile and residual plots suggest that the linear model fits the data
```{r}
summary(lm.result)
```
As the p-value is lower than $\alpha$, we know that $\beta_{parental support}$ is significantly different from 0. As the estimate of $\beta_{parental support}$ is positive, we know that more support of parents leads to a higher aspiration for career success.
Hypothesis 3
---
higher cost of living -> higher aspiration for career success
```{r}
plot(data$Q005)
```
ordinal scale
```{r}
boxplot(Erfolg ~ Q005, data)
```
medians do not seem to differ a lot
since only 351-600 is normally distributed, we need to use a robust test -> Kruskall-Wallis test:
```{r}
kruskal.test(Erfolg ~ Q005, data)
```
insignificant -> median is not different in groups -> no evidence that aspiration for career success is dependent on cost of living
Hypothesis 4
---
higher social assistance -> less aspiration for career success
```{r}
plot(data$Q006)
```
ordinal scale
```{r}
levels(data$Q006)[4] <- levels(data$Q006)[3]
levels(data$Q006)[3] <- "über 250€"
```
too few occurences for the last two categories, so we combine them
```{r}
boxplot(Erfolg ~ Q006, data)
```
The median in category `0-100€` seems the be higher than the other medians. As the categories are not normally distributed, we use a Kruskall-Wallis test to investigate this.
```{r}
kruskal.test(Erfolg ~ Q006, data)
```
insignificant -> median is not different in groups -> no evidence that aspiration for career success is dependent on social assistance
Hypothesis 5
---
more grants -> higher aspiration for career success
```{r}
plot(data$Q007)
```
ordinal scale
```{r}
summary(data$Q007)
```
only four respondents receive grants -> too small sample
```{r}
levels(data$Q007)[4] <- levels(data$Q007)[2]
levels(data$Q007)[3] <- levels(data$Q007)[2]
levels(data$Q007)[2] <- "ja"
levels(data$Q007)[1] <- "nein"
```
convert into dichotomous variable: receive grant yes or no
```{r}
boxplot(Erfolg ~ Q007, data, main = "Leistungsstipendium erhalten")
```
There seems to be a significant difference in the medians. Apparently, students who receive grants have less aspiration for career success.
We use a statistical test to see if this holds up. Since both groups are not normally distributed, we need to use the robust Kruskall-Wallis test.
Our test hypotheses using a significance level $\alpha=0.05$ are:
* $H_0: \mu^{Erfolg}_{kein Leistungsstipendium} = \mu^{Erfolg}_{Leistungsstipendium erhalten}$
* $H_A: \mu^{Erfolg}_{kein Leistungsstipendium} \neq \mu^{Erfolg}_{Leistungsstipendium erhalten}$
```{r}
kruskal.test(Erfolg ~ Q007, data)
```
The p-value is 0.04, which is lower than our $\alpha$. Therefore, we can accept $H_A$. There is evidence that students who receive grants have significantly lower aspiration for career success.
Hypothesis 6
---
more available financial capital -> higher aspiration for career success
```{r}
plot(data$Q008)
```
ordinal scale
```{r}
levels(data$Q008)[5] <- levels(data$Q008)[4]
levels(data$Q008)[4] <- "über 1000€"
```
We see that only three observations fall into the `über 2000€` category. We therefore decided to combine this level with the `1001-2000€` level. The newly created level is simply called `über 1000`.
```{r}
boxplot(Erfolg ~ Q008, data)
```
medians do not seem to differ a lot
since no category is normally distributed, we need to use a robust test -> Kruskall-Wallis test:
```{r}
kruskal.test(Erfolg ~ Q008, data)
```
insignificant -> median is not different in groups -> no evidence that aspiration for career success is dependent on available financial capital
Hypothesis 7
---
better living -> higher aspiration for career success
```{r}
data$Q012 <- factor(data$Q012, levels=rev(levels(data$Q012)))
wohn.data <- data[,c("Q009", "Q010", "Q011", "Q012")]
wohn.data <- factors.as.numeric(wohn.data)
alpha(wohn.data[,1:2])
KMO(wohn.data)
```
$\alpha$ and KMO too low
Let's try individual hypotheses
```{r}
boxplot(Erfolg ~ Q009, data)
```
```{r}
summary.aov(aov(Erfolg ~ Q009, data))
```
significant -> housing affects aspiration for career success
all the following variables are insignificant
```{r}
boxplot(Erfolg ~ Q010, data)
```
```{r}
summary.aov(aov(Erfolg ~ Q010, data))
```
```{r}
boxplot(Erfolg ~ Q011, data)
```
```{r}
summary.aov(aov(Erfolg ~Q011, data))
```
```{r}
boxplot(Erfolg ~ Q012, data)
```
```{r}
summary.aov(aov(Erfolg ~ Q012, data))
```