This repository has been archived by the owner on Dec 30, 2023. It is now read-only.
forked from ajdamico/asdfree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
21-enade.Rmd
193 lines (143 loc) · 5.67 KB
/
21-enade.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
# Exame Nacional de Desempenho de Estudantes (ENADE) {-}
[![Build Status](https://travis-ci.org/asdfree/enade.svg?branch=master)](https://travis-ci.org/asdfree/enade) [![Build status](https://ci.appveyor.com/api/projects/status/github/asdfree/enade?svg=TRUE)](https://ci.appveyor.com/project/ajdamico/enade)
The Exame Nacional de Desempenho de Estudantes (ENADE) evaluates the performance of undergraduate students in relation to the program content, skills and competences acquired in their training. The exam is mandatory and the student's regularity in the exam must be included in his or her school record.
* One table with one row per individual undergraduate student in Brazil.
* An enumeration of undergraduate students in Brazil.
* Released annually since 2004.
* Compiled by the Brazilian [Instituto Nacional de Estudos e Pesquisas Educacionais Anísio Teixeira (INEP)](http://www.inep.gov.br/).
## Simplified Download and Importation {-}
The R `lodown` package easily downloads and imports all available ENADE microdata by simply specifying `"enade"` with an `output_dir =` parameter in the `lodown()` function. Depending on your internet connection and computer processing speed, you might prefer to run this step overnight.
```{r eval = FALSE }
library(lodown)
lodown( "enade" , output_dir = file.path( path.expand( "~" ) , "ENADE" ) )
```
## Analysis Examples with base R \ {-}
Load a data frame:
```{r eval = FALSE }
enade_df <- readRDS( file.path( path.expand( "~" ) , "ENADE" , "2016 main.rds" ) )
```
```{r eval = FALSE }
```
### Variable Recoding {-}
Add new columns to the data set:
```{r eval = FALSE }
enade_df <-
transform(
enade_df ,
# qual foi o tempo gasto por voce para concluir a prova?
less_than_two_hours = as.numeric( qp_i9 %in% c( 'A' , 'B' ) ) ,
state_name =
factor(
co_uf_curso ,
levels = c( 11:17 , 21:29 , 31:33 , 35 , 41:43 , 50:53 ) ,
labels = c( "Rondonia" , "Acre" , "Amazonas" ,
"Roraima" , "Para" , "Amapa" , "Tocantins" ,
"Maranhao" , "Piaui" , "Ceara" , "Rio Grande do Norte" ,
"Paraiba" , "Pernambuco" , "Alagoas" , "Sergipe" ,
"Bahia" , "Minas Gerais" , "Espirito Santo" ,
"Rio de Janeiro" , "Sao Paulo" , "Parana" ,
"Santa Catarina" , "Rio Grande do Sul" ,
"Mato Grosso do Sul" , "Mato Grosso" , "Goias" ,
"Distrito Federal" )
)
)
```
### Unweighted Counts {-}
Count the unweighted number of records in the table, overall and by groups:
```{r eval = FALSE , results = "hide" }
nrow( enade_df )
table( enade_df[ , "tp_sexo" ] , useNA = "always" )
```
### Descriptive Statistics {-}
Calculate the mean (average) of a linear variable, overall and by groups:
```{r eval = FALSE , results = "hide" }
mean( enade_df[ , "nt_obj_fg" ] , na.rm = TRUE )
tapply(
enade_df[ , "nt_obj_fg" ] ,
enade_df[ , "tp_sexo" ] ,
mean ,
na.rm = TRUE
)
```
Calculate the distribution of a categorical variable, overall and by groups:
```{r eval = FALSE , results = "hide" }
prop.table( table( enade_df[ , "state_name" ] ) )
prop.table(
table( enade_df[ , c( "state_name" , "tp_sexo" ) ] ) ,
margin = 2
)
```
Calculate the sum of a linear variable, overall and by groups:
```{r eval = FALSE , results = "hide" }
sum( enade_df[ , "nt_obj_fg" ] , na.rm = TRUE )
tapply(
enade_df[ , "nt_obj_fg" ] ,
enade_df[ , "tp_sexo" ] ,
sum ,
na.rm = TRUE
)
```
Calculate the median (50th percentile) of a linear variable, overall and by groups:
```{r eval = FALSE , results = "hide" }
quantile( enade_df[ , "nt_obj_fg" ] , 0.5 , na.rm = TRUE )
tapply(
enade_df[ , "nt_obj_fg" ] ,
enade_df[ , "tp_sexo" ] ,
quantile ,
0.5 ,
na.rm = TRUE
)
```
### Subsetting {-}
Limit your `data.frame` to Students reporting that the general training section of the test was easy or very easy:
```{r eval = FALSE , results = "hide" }
sub_enade_df <- subset( enade_df , qp_i1 %in% c( "A" , "B" ) )
```
Calculate the mean (average) of this subset:
```{r eval = FALSE , results = "hide" }
mean( sub_enade_df[ , "nt_obj_fg" ] , na.rm = TRUE )
```
### Measures of Uncertainty {-}
Calculate the variance, overall and by groups:
```{r eval = FALSE , results = "hide" }
var( enade_df[ , "nt_obj_fg" ] , na.rm = TRUE )
tapply(
enade_df[ , "nt_obj_fg" ] ,
enade_df[ , "tp_sexo" ] ,
var ,
na.rm = TRUE
)
```
### Regression Models and Tests of Association {-}
Perform a t-test:
```{r eval = FALSE , results = "hide" }
t.test( nt_obj_fg ~ less_than_two_hours , enade_df )
```
Perform a chi-squared test of association:
```{r eval = FALSE , results = "hide" }
this_table <- table( enade_df[ , c( "less_than_two_hours" , "state_name" ) ] )
chisq.test( this_table )
```
Perform a generalized linear model:
```{r eval = FALSE , results = "hide" }
glm_result <-
glm(
nt_obj_fg ~ less_than_two_hours + state_name ,
data = enade_df
)
summary( glm_result )
```
## Analysis Examples with `dplyr` \ {-}
The R `dplyr` library offers an alternative grammar of data manipulation to base R and SQL syntax. [dplyr](https://github.com/tidyverse/dplyr/) offers many verbs, such as `summarize`, `group_by`, and `mutate`, the convenience of pipe-able functions, and the `tidyverse` style of non-standard evaluation. [This vignette](https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html) details the available features. As a starting point for ENADE users, this code replicates previously-presented examples:
```{r eval = FALSE , results = "hide" }
library(dplyr)
enade_tbl <- tbl_df( enade_df )
```
Calculate the mean (average) of a linear variable, overall and by groups:
```{r eval = FALSE , results = "hide" }
enade_tbl %>%
summarize( mean = mean( nt_obj_fg , na.rm = TRUE ) )
enade_tbl %>%
group_by( tp_sexo ) %>%
summarize( mean = mean( nt_obj_fg , na.rm = TRUE ) )
```