Installation of some packages
# install.packages(BSDA)
library(BSDA)
## Loading required package: lattice
##
## Attaching package: 'BSDA'
## The following object is masked from 'package:datasets':
##
## Orange
Generating the dataset
# Set seed for reproducibility
set.seed(123)
# Number of students
n <- 500
# Create the synthetic dataset
education_dataset <- data.frame(
student_id = 1:n,
school_type = sample(c("Public", "Private"), n, replace = TRUE, prob = c(0.7, 0.3)),
teaching_method = sample(c("Traditional", "Flipped_Classroom", "Blended"), n, replace = TRUE),
pre_test_score = round(rnorm(n, mean = 50, sd = 10), 1),
grade_level = sample(9:12, n, replace = TRUE)
)
# Generate post-test scores correlated with pre-test scores and affected by teaching method
education_dataset$post_test_score <- with(education_dataset,
pre_test_score +
rnorm(n, mean = 5, sd = 3) + # General improvement
ifelse(teaching_method == "Flipped_Classroom", 3, 0) + # Boost for flipped classroom
ifelse(teaching_method == "Blended", 1.5, 0) # Smaller boost for blended
)
# Generate other scores (positively correlated)
education_dataset$math_score <- with(education_dataset,
round(post_test_score * 1.1 + rnorm(n, mean=10, sd=5))
)
education_dataset$reading_score <- with(education_dataset,
round(post_test_score * 0.95 + rnorm(n, mean=15, sd=6))
)
education_dataset$science_score <- with(education_dataset,
round(post_test_score * 1.05 + rnorm(n, mean=12, sd=4))
)
# Generate other variables
education_dataset$hours_studied <- sample(3:20, n, replace = TRUE)
education_dataset$extracurricular <- sample(c("Yes", "No"), n, replace = TRUE, prob = c(0.6, 0.4))
# Ensure scores are within a plausible range (0-100)
score_cols <- c("pre_test_score", "post_test_score", "math_score", "reading_score", "science_score")
education_dataset[score_cols] <- lapply(education_dataset[score_cols], function(x) pmin(pmax(x, 0), 100))
# Add gender for some exercises
education_dataset$gender <- sample(c("Male", "Female"), n, replace = TRUE)
# Load required packages
library(BSDA)
To see how the data set is look like
print(education_dataset)
## student_id school_type teaching_method pre_test_score grade_level
## 1 1 Public Flipped_Classroom 61.1 10
## 2 2 Private Flipped_Classroom 39.0 9
## 3 3 Public Blended 58.0 11
## 4 4 Private Blended 52.4 10
## 5 5 Private Blended 51.4 10
## 6 6 Public Blended 57.3 12
## 7 7 Public Flipped_Classroom 41.4 9
## 8 8 Private Traditional 37.7 9
## 9 9 Public Traditional 47.1 12
## 10 10 Public Blended 62.1 11
## 11 11 Private Traditional 55.8 12
## 12 12 Public Flipped_Classroom 72.8 10
## 13 13 Public Flipped_Classroom 40.0 9
## 14 14 Public Blended 51.1 12
## 15 15 Public Flipped_Classroom 80.6 12
## 16 16 Private Traditional 50.2 9
## 17 17 Public Blended 58.9 12
## 18 18 Public Traditional 58.5 11
## 19 19 Public Traditional 66.1 11
## 20 20 Private Blended 50.6 12
## 21 21 Private Flipped_Classroom 62.1 9
## 22 22 Public Traditional 32.5 12
## 23 23 Public Traditional 42.5 10
## 24 24 Private Flipped_Classroom 50.8 9
## 25 25 Public Flipped_Classroom 44.1 11
## 26 26 Private Flipped_Classroom 52.2 9
## 27 27 Public Flipped_Classroom 32.8 11
## 28 28 Public Traditional 55.4 10
## 29 29 Public Blended 45.1 12
## 30 30 Public Blended 45.4 9
## 31 31 Private Flipped_Classroom 48.5 11
## 32 32 Private Blended 44.2 12
## 33 33 Public Blended 32.7 12
## 34 34 Private Blended 56.0 11
## 35 35 Public Flipped_Classroom 50.3 11
## 36 36 Public Blended 19.5 10
## 37 37 Private Blended 61.1 12
## 38 38 Public Flipped_Classroom 43.1 10
## 39 39 Public Flipped_Classroom 52.0 12
## 40 40 Public Blended 52.9 9
## 41 41 Public Flipped_Classroom 39.5 10
## 42 42 Public Blended 34.9 10
## 43 43 Public Flipped_Classroom 65.3 12
## 44 44 Public Flipped_Classroom 69.2 10
## 45 45 Public Traditional 56.0 10
## 46 46 Public Flipped_Classroom 51.7 11
## 47 47 Public Blended 51.4 11
## 48 48 Public Traditional 53.1 9
## 49 49 Public Traditional 47.3 10
## 50 50 Private Blended 60.5 11
## 51 51 Public Flipped_Classroom 56.9 9
## 52 52 Public Traditional 44.0 10
## 53 53 Private Traditional 51.2 9
## 54 54 Public Blended 50.4 10
## 55 55 Public Blended 50.7 11
## 56 56 Public Blended 60.3 12
## 57 57 Public Traditional 44.9 11
## 58 58 Private Flipped_Classroom 56.2 11
## 59 59 Private Flipped_Classroom 51.7 12
## 60 60 Public Blended 49.7 9
## 61 61 Public Blended 59.8 9
## 62 62 Public Blended 51.4 10
## 63 63 Public Blended 39.0 12
## 64 64 Public Flipped_Classroom 37.2 9
## 65 65 Private Traditional 46.6 10
## 66 66 Public Blended 42.8 11
## 67 67 Private Flipped_Classroom 37.6 10
## 68 68 Private Traditional 43.4 9
## 69 69 Private Blended 31.7 11
## 70 70 Public Blended 45.8 9
## 71 71 Private Blended 46.3 9
## 72 72 Public Flipped_Classroom 47.1 12
## 73 73 Private Traditional 49.8 11
## 74 74 Public Flipped_Classroom 53.6 9
## 75 75 Public Blended 45.3 12
## 76 76 Public Traditional 53.0 11
## 77 77 Public Flipped_Classroom 40.5 9
## 78 78 Public Traditional 56.7 12
## 79 79 Public Flipped_Classroom 50.9 12
## 80 80 Public Flipped_Classroom 48.9 10
## 81 81 Public Blended 43.2 12
## 82 82 Public Flipped_Classroom 67.0 12
## 83 83 Public Flipped_Classroom 53.9 12
## 84 84 Private Flipped_Classroom 52.5 12
## 85 85 Public Flipped_Classroom 24.1 9
## 86 86 Public Flipped_Classroom 30.4 10
## 87 87 Private Blended 49.4 11
## 88 88 Private Traditional 59.0 9
## 89 89 Private Traditional 49.7 11
## 90 90 Public Blended 40.0 12
## 91 91 Public Blended 48.4 10
## 92 92 Public Blended 44.7 10
## 93 93 Public Blended 52.2 12
## 94 94 Public Flipped_Classroom 40.8 11
## 95 95 Public Traditional 41.0 12
## 96 96 Public Traditional 52.9 11
## 97 97 Private Blended 59.3 12
## 98 98 Public Flipped_Classroom 66.7 10
## 99 99 Public Flipped_Classroom 52.9 11
## 100 100 Public Blended 46.3 10
## 101 101 Public Traditional 35.7 12
## 102 102 Public Blended 41.2 9
## 103 103 Public Blended 61.2 11
## 104 104 Private Traditional 42.8 10
## 105 105 Public Traditional 54.6 10
## 106 106 Private Blended 46.9 10
## 107 107 Private Blended 58.5 12
## 108 108 Public Flipped_Classroom 49.1 10
## 109 109 Public Flipped_Classroom 42.8 10
## 110 110 Public Blended 42.6 11
## 111 111 Private Flipped_Classroom 49.9 12
## 112 112 Public Blended 57.0 10
## 113 113 Public Blended 66.3 11
## 114 114 Private Flipped_Classroom 66.2 9
## 115 115 Private Blended 64.2 12
## 116 116 Public Blended 40.1 12
## 117 117 Public Traditional 56.1 12
## 118 118 Private Blended 45.1 12
## 119 119 Public Traditional 45.8 9
## 120 120 Public Flipped_Classroom 52.0 9
## 121 121 Public Traditional 65.0 11
## 122 122 Public Blended 37.1 11
## 123 123 Public Blended 71.5 11
## 124 124 Public Flipped_Classroom 48.4 12
## 125 125 Public Flipped_Classroom 44.8 10
## 126 126 Private Traditional 58.4 10
## 127 127 Public Flipped_Classroom 47.0 12
## 128 128 Public Blended 60.9 12
## 129 129 Public Blended 50.4 12
## 130 130 Public Blended 52.9 12
## 131 131 Public Flipped_Classroom 50.0 12
## 132 132 Private Traditional 56.9 12
## 133 133 Public Flipped_Classroom 48.6 12
## 134 134 Private Blended 43.9 11
## 135 135 Public Flipped_Classroom 56.3 10
## 136 136 Public Blended 38.1 9
## 137 137 Private Blended 58.3 9
## 138 138 Private Traditional 56.0 9
## 139 139 Private Flipped_Classroom 38.2 10
## 140 140 Public Flipped_Classroom 56.7 9
## 141 141 Public Flipped_Classroom 41.2 12
## 142 142 Public Flipped_Classroom 61.0 9
## 143 143 Public Flipped_Classroom 39.1 11
## 144 144 Public Traditional 49.1 11
## 145 145 Private Traditional 34.9 10
## 146 146 Public Blended 47.4 12
## 147 147 Public Traditional 56.0 9
## 148 148 Public Blended 83.0 11
## 149 149 Public Blended 59.5 11
## 150 150 Private Flipped_Classroom 37.8 11
## 151 151 Private Blended 58.9 12
## 152 152 Public Flipped_Classroom 33.4 9
## 153 153 Public Traditional 48.0 10
## 154 154 Public Traditional 59.6 12
## 155 155 Public Flipped_Classroom 27.3 11
## 156 156 Public Traditional 57.2 11
## 157 157 Public Blended 58.9 9
## 158 158 Public Flipped_Classroom 41.6 11
## 159 159 Public Flipped_Classroom 48.4 11
## 160 160 Public Blended 72.6 12
## 161 161 Public Traditional 42.6 9
## 162 162 Public Traditional 51.4 12
## 163 163 Public Flipped_Classroom 48.3 9
## 164 164 Public Blended 52.5 9
## 165 165 Public Traditional 67.1 12
## 166 166 Public Traditional 42.4 10
## 167 167 Private Blended 48.0 9
## 168 168 Public Blended 47.0 11
## 169 169 Public Flipped_Classroom 41.3 12
## 170 170 Public Traditional 27.9 9
## 171 171 Public Blended 48.3 12
## 172 172 Public Blended 28.0 9
## 173 173 Private Blended 47.9 11
## 174 174 Private Traditional 42.3 12
## 175 175 Public Blended 55.1 11
## 176 176 Public Blended 47.8 9
## 177 177 Public Traditional 43.3 10
## 178 178 Public Flipped_Classroom 42.7 9
## 179 179 Private Traditional 49.4 12
## 180 180 Public Flipped_Classroom 57.5 9
## 181 181 Private Flipped_Classroom 51.3 12
## 182 182 Public Traditional 44.1 10
## 183 183 Private Blended 48.1 10
## 184 184 Public Traditional 69.8 11
## 185 185 Public Flipped_Classroom 36.5 12
## 186 186 Public Flipped_Classroom 47.4 10
## 187 187 Public Traditional 45.3 10
## 188 188 Public Flipped_Classroom 44.3 11
## 189 189 Private Traditional 73.3 10
## 190 190 Private Traditional 45.1 9
## 191 191 Public Flipped_Classroom 42.3 12
## 192 192 Public Flipped_Classroom 40.3 9
## 193 193 Private Flipped_Classroom 62.7 9
## 194 194 Public Flipped_Classroom 61.0 11
## 195 195 Private Blended 30.8 12
## 196 196 Public Traditional 46.4 10
## 197 197 Public Traditional 56.6 12
## 198 198 Public Traditional 48.3 11
## 199 199 Public Traditional 50.0 12
## 200 200 Public Blended 36.2 12
## 201 201 Public Flipped_Classroom 37.4 11
## 202 202 Private Traditional 53.3 10
## 203 203 Public Traditional 47.2 10
## 204 204 Public Blended 46.1 10
## 205 205 Public Blended 62.1 12
## 206 206 Private Traditional 52.3 12
## 207 207 Public Traditional 35.7 9
## 208 208 Public Flipped_Classroom 40.8 11
## 209 209 Public Blended 44.6 11
## 210 210 Public Traditional 38.5 12
## 211 211 Public Traditional 59.2 11
## 212 212 Public Blended 33.1 11
## 213 213 Public Traditional 38.6 12
## 214 214 Public Flipped_Classroom 49.2 10
## 215 215 Public Flipped_Classroom 56.1 10
## 216 216 Private Blended 72.8 9
## 217 217 Public Traditional 47.3 12
## 218 218 Public Blended 46.0 10
## 219 219 Private Traditional 42.6 11
## 220 220 Private Blended 30.2 9
## 221 221 Public Blended 57.2 11
## 222 222 Private Traditional 60.4 10
## 223 223 Private Blended 41.1 11
## 224 224 Public Blended 62.4 10
## 225 225 Public Blended 50.1 9
## 226 226 Public Blended 54.0 9
## 227 227 Public Blended 62.4 9
## 228 228 Public Flipped_Classroom 43.5 10
## 229 229 Public Blended 58.3 9
## 230 230 Private Flipped_Classroom 59.5 10
## 231 231 Public Blended 65.9 9
## 232 232 Public Flipped_Classroom 65.5 11
## 233 233 Public Traditional 61.5 9
## 234 234 Public Traditional 37.2 11
## 235 235 Public Blended 55.9 12
## 236 236 Public Traditional 47.0 11
## 237 237 Public Flipped_Classroom 50.5 12
## 238 238 Private Traditional 62.0 10
## 239 239 Public Flipped_Classroom 57.9 10
## 240 240 Private Flipped_Classroom 32.2 10
## 241 241 Public Traditional 53.6 12
## 242 242 Public Traditional 47.5 11
## 243 243 Public Flipped_Classroom 47.2 9
## 244 244 Public Blended 44.4 9
## 245 245 Public Traditional 51.5 11
## 246 246 Private Flipped_Classroom 56.6 12
## 247 247 Public Traditional 54.0 9
## 248 248 Private Flipped_Classroom 53.4 9
## 249 249 Private Blended 44.3 9
## 250 250 Private Flipped_Classroom 51.0 10
## 251 251 Public Flipped_Classroom 45.6 9
## 252 252 Public Blended 31.9 10
## 253 253 Public Traditional 52.5 11
## 254 254 Public Flipped_Classroom 66.7 9
## 255 255 Public Blended 36.2 12
## 256 256 Private Blended 61.5 12
## 257 257 Public Traditional 60.1 11
## 258 258 Public Blended 53.9 9
## 259 259 Public Traditional 41.1 11
## 260 260 Private Traditional 36.3 11
## 261 261 Private Blended 65.2 10
## 262 262 Private Traditional 55.7 9
## 263 263 Public Traditional 52.4 11
## 264 264 Private Blended 52.9 11
## 265 265 Public Traditional 34.8 12
## 266 266 Public Traditional 61.4 9
## 267 267 Public Traditional 66.0 10
## 268 268 Public Flipped_Classroom 50.3 10
## 269 269 Public Flipped_Classroom 37.7 12
## 270 270 Public Flipped_Classroom 46.9 10
## 271 271 Private Flipped_Classroom 45.2 12
## 272 272 Public Blended 57.7 11
## 273 273 Public Blended 54.0 12
## 274 274 Public Flipped_Classroom 41.5 11
## 275 275 Private Traditional 48.7 12
## 276 276 Private Blended 65.3 11
## 277 277 Private Traditional 52.6 12
## 278 278 Public Blended 58.8 9
## 279 279 Public Blended 60.5 12
## 280 280 Public Blended 68.6 10
## 281 281 Private Traditional 24.5 10
## 282 282 Public Flipped_Classroom 24.8 9
## 283 283 Public Blended 57.8 9
## 284 284 Public Blended 46.6 9
## 285 285 Public Traditional 59.3 10
## 286 286 Public Traditional 53.1 11
## 287 287 Public Traditional 50.0 11
## 288 288 Public Blended 47.5 11
## 289 289 Public Blended 65.2 12
## 290 290 Public Traditional 29.1 11
## 291 291 Public Traditional 49.9 9
## 292 292 Public Flipped_Classroom 74.1 9
## 293 293 Public Blended 46.0 11
## 294 294 Private Blended 63.3 9
## 295 295 Private Flipped_Classroom 53.6 12
## 296 296 Private Traditional 52.6 9
## 297 297 Private Blended 48.9 12
## 298 298 Public Traditional 43.4 9
## 299 299 Public Traditional 49.3 12
## 300 300 Private Blended 43.9 12
## 301 301 Private Flipped_Classroom 52.9 12
## 302 302 Public Blended 35.2 11
## 303 303 Private Blended 46.6 11
## 304 304 Private Blended 60.2 12
## 305 305 Public Flipped_Classroom 31.9 12
## 306 306 Public Traditional 59.8 12
## 307 307 Public Blended 45.7 10
## 308 308 Public Blended 67.3 11
## 309 309 Public Flipped_Classroom 50.3 10
## 310 310 Public Flipped_Classroom 60.2 12
## 311 311 Public Flipped_Classroom 54.4 12
## 312 312 Public Blended 33.6 12
## 313 313 Private Blended 52.1 12
## 314 314 Public Flipped_Classroom 50.5 10
## 315 315 Public Traditional 52.5 10
## 316 316 Private Traditional 54.9 10
## 317 317 Private Traditional 49.1 11
## 318 318 Public Flipped_Classroom 48.7 10
## 319 319 Public Traditional 24.0 12
## 320 320 Private Flipped_Classroom 47.6 12
## 321 321 Private Flipped_Classroom 61.2 11
## 322 322 Public Blended 61.8 12
## 323 323 Public Blended 61.8 10
## 324 324 Private Blended 57.4 9
## 325 325 Public Blended 50.0 9
## 326 326 Public Flipped_Classroom 41.9 11
## 327 327 Private Flipped_Classroom 45.2 9
## 328 328 Public Flipped_Classroom 45.2 10
## 329 329 Public Blended 57.7 10
## 330 330 Private Blended 49.5 10
## 331 331 Public Blended 57.6 9
## 332 332 Public Traditional 28.4 11
## 333 333 Private Blended 42.8 12
## 334 334 Private Traditional 44.6 11
## 335 335 Public Blended 60.5 10
## 336 336 Public Flipped_Classroom 35.3 10
## 337 337 Public Traditional 52.0 10
## 338 338 Public Traditional 45.7 12
## 339 339 Public Traditional 65.4 11
## 340 340 Private Blended 55.0 9
## 341 341 Public Traditional 61.1 10
## 342 342 Public Flipped_Classroom 42.4 11
## 343 343 Public Traditional 62.1 9
## 344 344 Public Blended 54.5 12
## 345 345 Public Blended 59.0 11
## 346 346 Public Blended 46.7 11
## 347 347 Private Flipped_Classroom 65.2 10
## 348 348 Public Blended 39.1 11
## 349 349 Public Flipped_Classroom 46.1 12
## 350 350 Public Traditional 39.3 11
## 351 351 Public Blended 43.1 10
## 352 352 Private Flipped_Classroom 57.9 12
## 353 353 Public Flipped_Classroom 47.3 9
## 354 354 Public Traditional 52.6 9
## 355 355 Public Flipped_Classroom 73.6 12
## 356 356 Private Traditional 56.3 11
## 357 357 Public Flipped_Classroom 51.5 9
## 358 358 Public Blended 59.3 11
## 359 359 Public Blended 50.9 11
## 360 360 Private Flipped_Classroom 44.0 10
## 361 361 Public Flipped_Classroom 61.4 11
## 362 362 Public Traditional 51.3 12
## 363 363 Private Flipped_Classroom 56.1 9
## 364 364 Public Blended 52.9 9
## 365 365 Public Flipped_Classroom 51.6 9
## 366 366 Private Blended 53.3 11
## 367 367 Public Traditional 36.1 9
## 368 368 Public Flipped_Classroom 54.9 10
## 369 369 Public Blended 39.5 9
## 370 370 Public Traditional 49.7 10
## 371 371 Public Flipped_Classroom 50.0 12
## 372 372 Public Blended 46.9 9
## 373 373 Private Flipped_Classroom 35.6 12
## 374 374 Public Traditional 67.6 12
## 375 375 Public Blended 48.4 10
## 376 376 Private Blended 32.2 10
## 377 377 Private Blended 40.1 10
## 378 378 Public Traditional 58.6 12
## 379 379 Public Blended 56.9 11
## 380 380 Private Flipped_Classroom 44.4 11
## 381 381 Public Flipped_Classroom 54.4 10
## 382 382 Private Flipped_Classroom 59.8 12
## 383 383 Public Blended 54.0 10
## 384 384 Private Traditional 43.5 10
## 385 385 Public Traditional 57.2 12
## 386 386 Private Flipped_Classroom 43.8 11
## 387 387 Public Flipped_Classroom 49.4 9
## 388 388 Public Blended 57.6 11
## 389 389 Public Flipped_Classroom 39.9 12
## 390 390 Public Flipped_Classroom 43.1 9
## 391 391 Private Traditional 42.0 10
## 392 392 Public Blended 46.4 11
## 393 393 Private Traditional 33.0 10
## 394 394 Private Blended 51.7 10
## 395 395 Public Blended 61.6 9
## 396 396 Public Blended 51.1 10
## 397 397 Public Blended 53.8 12
## 398 398 Public Flipped_Classroom 45.4 12
## 399 399 Public Flipped_Classroom 41.2 11
## 400 400 Private Traditional 49.0 12
## 401 401 Private Traditional 41.8 10
## 402 402 Public Blended 39.1 11
## 403 403 Private Flipped_Classroom 48.8 11
## 404 404 Public Traditional 43.3 12
## 405 405 Public Flipped_Classroom 40.3 10
## 406 406 Public Flipped_Classroom 39.9 9
## 407 407 Private Flipped_Classroom 62.4 9
## 408 408 Public Traditional 56.8 10
## 409 409 Public Blended 48.7 11
## 410 410 Public Blended 39.4 10
## 411 411 Public Flipped_Classroom 50.4 9
## 412 412 Private Flipped_Classroom 53.0 11
## 413 413 Public Flipped_Classroom 34.1 9
## 414 414 Public Traditional 42.3 9
## 415 415 Public Blended 43.8 11
## 416 416 Public Traditional 52.8 9
## 417 417 Private Flipped_Classroom 41.3 12
## 418 418 Public Blended 43.0 10
## 419 419 Public Traditional 23.1 12
## 420 420 Public Traditional 48.4 11
## 421 421 Public Flipped_Classroom 41.5 12
## 422 422 Public Blended 43.3 11
## 423 423 Public Traditional 51.9 11
## 424 424 Public Flipped_Classroom 56.1 11
## 425 425 Private Traditional 52.0 11
## 426 426 Public Traditional 42.4 10
## 427 427 Public Blended 56.3 9
## 428 428 Public Blended 66.6 11
## 429 429 Public Blended 56.6 10
## 430 430 Private Blended 40.6 9
## 431 431 Private Blended 57.1 9
## 432 432 Public Flipped_Classroom 63.2 11
## 433 433 Public Blended 41.6 10
## 434 434 Private Flipped_Classroom 49.5 10
## 435 435 Public Blended 37.0 12
## 436 436 Public Flipped_Classroom 40.2 10
## 437 437 Public Blended 38.6 10
## 438 438 Public Flipped_Classroom 57.9 10
## 439 439 Public Flipped_Classroom 54.5 9
## 440 440 Public Blended 60.4 12
## 441 441 Public Flipped_Classroom 59.8 12
## 442 442 Public Traditional 26.8 11
## 443 443 Private Blended 43.9 11
## 444 444 Public Traditional 65.0 11
## 445 445 Private Blended 63.6 10
## 446 446 Private Flipped_Classroom 47.5 11
## 447 447 Private Traditional 57.3 10
## 448 448 Public Traditional 47.3 9
## 449 449 Public Blended 33.5 9
## 450 450 Public Traditional 55.2 12
## 451 451 Public Flipped_Classroom 37.6 11
## 452 452 Public Blended 53.6 11
## 453 453 Public Blended 73.4 12
## 454 454 Public Flipped_Classroom 45.2 12
## 455 455 Public Flipped_Classroom 44.8 11
## 456 456 Private Flipped_Classroom 30.7 10
## 457 457 Private Blended 56.5 9
## 458 458 Private Blended 47.9 9
## 459 459 Public Blended 35.1 9
## 460 460 Public Flipped_Classroom 46.2 9
## 461 461 Private Traditional 68.0 9
## 462 462 Public Blended 55.8 12
## 463 463 Public Blended 41.7 12
## 464 464 Public Blended 59.8 10
## 465 465 Public Blended 44.2 9
## 466 466 Public Blended 49.9 10
## 467 467 Public Blended 42.3 10
## 468 468 Public Traditional 30.3 11
## 469 469 Public Traditional 60.0 9
## 470 470 Private Traditional 54.2 11
## 471 471 Public Traditional 42.2 11
## 472 472 Private Traditional 30.3 9
## 473 473 Public Flipped_Classroom 50.6 10
## 474 474 Private Traditional 64.9 12
## 475 475 Public Flipped_Classroom 46.9 11
## 476 476 Public Flipped_Classroom 39.6 10
## 477 477 Public Blended 51.6 9
## 478 478 Public Blended 58.8 11
## 479 479 Public Traditional 50.4 10
## 480 480 Private Flipped_Classroom 40.9 9
## 481 481 Public Flipped_Classroom 33.5 11
## 482 482 Private Traditional 37.1 9
## 483 483 Public Blended 47.1 10
## 484 484 Public Blended 55.4 10
## 485 485 Private Flipped_Classroom 68.1 12
## 486 486 Public Traditional 40.1 12
## 487 487 Public Blended 44.8 12
## 488 488 Public Flipped_Classroom 59.3 12
## 489 489 Public Traditional 47.5 9
## 490 490 Private Blended 38.5 12
## 491 491 Private Flipped_Classroom 55.4 12
## 492 492 Public Flipped_Classroom 77.0 11
## 493 493 Public Flipped_Classroom 73.3 9
## 494 494 Private Flipped_Classroom 48.4 11
## 495 495 Public Flipped_Classroom 48.7 10
## 496 496 Private Traditional 48.1 11
## 497 497 Public Traditional 33.6 11
## 498 498 Public Blended 60.0 11
## 499 499 Public Traditional 58.1 9
## 500 500 Private Traditional 54.1 12
## post_test_score math_score reading_score science_score hours_studied
## 1 73.52859 97 88 88 8
## 2 48.83218 55 73 60 19
## 3 69.17057 95 88 79 5
## 4 65.73725 80 75 85 5
## 5 56.48458 68 61 72 3
## 6 64.43806 77 74 82 19
## 7 57.39879 67 72 69 20
## 8 45.40628 64 58 59 11
## 9 58.65922 68 72 66 16
## 10 70.38596 82 87 86 17
## 11 61.79828 73 69 79 18
## 12 84.99768 100 97 100 15
## 13 51.18909 64 67 65 19
## 14 56.97206 73 79 69 11
## 15 88.59521 100 82 100 11
## 16 53.99098 72 64 73 10
## 17 69.37411 83 65 85 10
## 18 61.90661 87 71 77 18
## 19 71.60333 89 89 87 14
## 20 53.33819 66 64 68 20
## 21 74.22380 99 84 90 20
## 22 41.42357 56 59 56 20
## 23 44.60379 54 53 53 17
## 24 55.24933 66 75 74 14
## 25 54.39019 72 75 70 13
## 26 59.64387 70 72 77 3
## 27 40.56193 62 56 62 10
## 28 62.50663 74 86 78 20
## 29 54.67832 63 71 67 5
## 30 49.18539 56 61 63 19
## 31 49.97336 60 65 63 9
## 32 53.18282 71 68 60 17
## 33 35.38495 39 39 47 15
## 34 62.71584 77 79 70 9
## 35 54.74818 70 74 73 11
## 36 26.39415 32 47 33 20
## 37 67.15044 85 80 85 13
## 38 55.34813 58 69 69 18
## 39 59.71026 67 71 75 3
## 40 57.72663 81 71 76 13
## 41 46.54462 70 63 67 6
## 42 40.73837 60 46 54 14
## 43 71.56106 100 95 86 9
## 44 77.76675 93 91 95 14
## 45 59.94620 85 74 77 8
## 46 58.96635 69 76 76 6
## 47 61.18438 82 63 81 3
## 48 53.56765 60 65 75 8
## 49 50.81065 69 67 65 3
## 50 68.85969 75 80 80 7
## 51 70.91808 80 82 92 3
## 52 49.63583 59 58 66 15
## 53 49.14497 60 66 61 6
## 54 60.88201 78 70 71 9
## 55 56.94266 72 69 73 16
## 56 66.53988 90 78 78 10
## 57 49.14839 72 49 63 16
## 58 65.38603 86 78 74 12
## 59 63.41081 78 74 81 10
## 60 56.63158 72 67 80 6
## 61 61.95165 77 67 77 4
## 62 58.70960 80 67 72 11
## 63 49.51606 64 50 65 3
## 64 50.03343 61 62 71 19
## 65 50.73831 69 56 64 14
## 66 52.13120 56 59 61 18
## 67 42.22959 57 64 54 11
## 68 55.19404 67 73 65 10
## 69 39.86939 52 46 51 18
## 70 51.43779 70 63 65 18
## 71 56.32767 73 74 77 18
## 72 54.08099 73 67 71 13
## 73 52.43858 68 56 65 7
## 74 60.66560 73 74 74 6
## 75 52.28730 62 61 67 12
## 76 60.67981 77 67 74 17
## 77 47.50416 72 51 61 5
## 78 61.79495 69 77 73 8
## 79 62.00080 79 77 77 13
## 80 56.18575 69 70 75 12
## 81 51.51152 63 58 68 8
## 82 76.57321 97 89 93 14
## 83 59.98702 75 74 81 16
## 84 57.96939 81 70 79 16
## 85 30.27194 39 48 32 16
## 86 33.02854 38 40 49 17
## 87 55.18046 65 60 70 18
## 88 68.45328 79 82 78 11
## 89 56.68415 76 68 82 13
## 90 44.05416 59 63 58 7
## 91 53.59279 72 54 66 9
## 92 53.39461 70 71 70 20
## 93 63.21421 84 71 83 5
## 94 47.87086 69 57 62 4
## 95 42.13944 61 58 56 9
## 96 54.77218 68 54 73 10
## 97 68.94486 81 80 85 13
## 98 72.83125 93 80 91 12
## 99 66.02622 87 76 81 12
## 100 54.32553 65 67 66 6
## 101 41.52953 60 55 53 9
## 102 51.89375 64 61 72 3
## 103 62.57634 78 65 79 17
## 104 50.94467 63 74 72 15
## 105 64.59483 79 73 86 7
## 106 50.54461 52 60 62 17
## 107 64.16134 82 78 79 3
## 108 58.30272 69 63 79 7
## 109 46.59933 58 49 60 5
## 110 49.55498 59 72 66 15
## 111 56.18191 71 76 71 18
## 112 64.48936 79 74 83 13
## 113 72.00983 94 93 89 19
## 114 76.05383 97 86 91 16
## 115 70.21131 90 86 86 7
## 116 45.07503 49 57 58 19
## 117 62.09420 80 73 77 5
## 118 53.32313 59 69 60 18
## 119 52.39994 80 64 64 11
## 120 60.74513 77 67 77 14
## 121 67.84597 78 74 84 11
## 122 39.61872 54 59 55 5
## 123 82.78600 100 84 100 14
## 124 57.69836 79 74 73 11
## 125 49.53150 70 62 63 19
## 126 59.44604 56 79 69 8
## 127 53.97522 74 66 75 11
## 128 66.50733 74 73 80 3
## 129 57.16554 76 68 71 13
## 130 62.67193 71 57 80 5
## 131 53.42064 68 60 68 9
## 132 66.45787 84 80 82 8
## 133 57.95626 85 71 67 17
## 134 50.16228 62 67 68 7
## 135 65.21671 94 70 77 20
## 136 42.03059 49 57 52 14
## 137 68.11177 83 83 87 18
## 138 63.34052 76 72 82 20
## 139 41.98724 51 45 55 9
## 140 62.05531 81 79 75 12
## 141 48.68282 66 60 63 8
## 142 66.33802 72 79 84 15
## 143 42.13219 52 52 62 18
## 144 52.18659 59 57 70 8
## 145 39.03043 59 50 60 11
## 146 49.63612 69 67 60 11
## 147 60.63401 79 78 71 8
## 148 86.28766 100 100 100 9
## 149 60.33674 77 68 75 18
## 150 43.57034 60 46 55 10
## 151 62.77306 74 77 76 17
## 152 45.92280 71 59 65 4
## 153 51.51266 66 64 62 20
## 154 65.84547 79 75 76 13
## 155 34.09582 45 37 42 13
## 156 60.47977 88 75 76 12
## 157 62.11861 73 67 82 7
## 158 45.10725 62 53 65 12
## 159 57.80423 73 55 78 19
## 160 83.82935 100 100 99 7
## 161 48.56573 68 63 63 3
## 162 57.63090 68 62 75 6
## 163 56.26751 60 69 75 20
## 164 61.88436 87 70 72 19
## 165 73.39370 100 94 91 10
## 166 42.31840 53 67 59 6
## 167 48.96782 72 74 70 12
## 168 52.92849 71 62 66 18
## 169 46.21198 60 61 68 10
## 170 34.67093 52 59 45 16
## 171 53.48315 69 64 67 18
## 172 37.48904 55 47 59 7
## 173 59.42528 77 77 76 18
## 174 52.25304 70 69 64 13
## 175 61.00952 76 75 75 17
## 176 51.88663 69 60 67 13
## 177 47.88568 70 67 62 16
## 178 46.54940 65 48 58 11
## 179 58.15992 76 78 78 6
## 180 59.89368 77 65 78 5
## 181 55.67400 71 76 65 3
## 182 50.84425 59 71 65 8
## 183 55.63107 67 67 67 14
## 184 77.40601 100 95 90 7
## 185 41.66128 57 50 57 19
## 186 50.57307 63 77 62 16
## 187 53.30265 72 58 65 5
## 188 54.02617 64 73 67 17
## 189 85.02148 100 96 100 17
## 190 46.88311 57 65 69 6
## 191 44.79100 56 53 62 8
## 192 50.73337 68 69 63 6
## 193 75.58575 90 85 88 13
## 194 68.49198 85 80 82 17
## 195 39.87558 55 53 51 3
## 196 50.07521 59 69 67 3
## 197 64.85758 93 66 78 14
## 198 54.41654 75 71 59 4
## 199 56.51190 74 60 67 4
## 200 38.76289 44 53 61 16
## 201 43.28953 63 55 62 17
## 202 56.58631 78 67 71 14
## 203 51.43797 69 64 66 3
## 204 48.40241 66 61 63 17
## 205 70.49115 85 82 86 19
## 206 54.57491 62 67 70 19
## 207 41.57420 57 45 53 14
## 208 43.95888 67 62 53 4
## 209 48.36489 64 50 58 9
## 210 49.78210 59 67 60 17
## 211 65.88236 98 74 80 5
## 212 39.79359 52 52 55 17
## 213 40.17593 57 55 57 15
## 214 55.13864 75 72 73 7
## 215 61.16192 75 64 78 10
## 216 80.68156 100 84 99 17
## 217 58.43205 72 70 71 16
## 218 57.21063 73 76 71 4
## 219 48.11357 69 59 62 6
## 220 35.46974 54 56 51 4
## 221 67.94614 83 77 80 3
## 222 69.04965 93 81 89 9
## 223 47.02317 66 68 59 15
## 224 74.27416 83 91 90 17
## 225 58.00595 74 67 67 4
## 226 58.14549 81 67 73 17
## 227 65.93746 67 81 85 15
## 228 49.37032 62 78 65 12
## 229 66.12765 88 74 82 5
## 230 66.20339 85 75 83 8
## 231 70.91235 84 80 89 4
## 232 70.01969 90 73 84 7
## 233 70.79025 84 66 81 16
## 234 42.21094 51 52 59 20
## 235 65.35793 71 70 77 7
## 236 49.89891 69 61 68 7
## 237 55.22535 72 65 74 19
## 238 63.04481 81 68 75 11
## 239 67.27552 92 79 76 17
## 240 39.40043 47 50 58 20
## 241 56.36683 69 68 78 16
## 242 54.79864 66 57 73 4
## 243 55.28355 70 70 68 6
## 244 48.24071 74 61 60 10
## 245 51.20356 72 62 68 5
## 246 67.39143 80 75 87 6
## 247 52.57363 71 64 68 19
## 248 57.33571 68 65 70 4
## 249 53.73455 64 62 75 12
## 250 62.14636 82 77 77 20
## 251 52.36005 73 58 67 7
## 252 39.46912 52 64 58 7
## 253 56.02197 62 57 70 19
## 254 76.81116 97 92 99 3
## 255 44.16876 60 52 57 16
## 256 71.96296 93 85 90 14
## 257 67.27813 76 83 80 16
## 258 60.57007 82 80 76 17
## 259 43.65416 59 64 61 17
## 260 41.61932 47 52 56 20
## 261 70.40781 87 76 86 10
## 262 60.12302 77 72 68 20
## 263 58.36455 79 77 75 20
## 264 60.21090 68 76 85 10
## 265 34.66955 53 45 51 19
## 266 67.36828 84 80 94 17
## 267 70.21730 89 81 93 19
## 268 57.37093 69 75 75 13
## 269 38.36260 50 59 56 7
## 270 50.55890 64 62 55 4
## 271 53.85213 66 71 74 3
## 272 65.89672 82 79 83 6
## 273 61.84891 77 79 84 16
## 274 50.03711 62 59 61 19
## 275 52.52464 68 66 69 18
## 276 72.03855 97 78 88 4
## 277 57.67766 73 68 79 10
## 278 66.01503 74 79 79 7
## 279 67.97207 82 72 83 18
## 280 75.60805 98 80 88 15
## 281 33.72440 40 46 47 17
## 282 35.82975 45 51 51 9
## 283 65.06618 73 77 80 9
## 284 55.09527 75 67 68 15
## 285 56.53259 71 68 76 15
## 286 57.36825 80 66 71 16
## 287 51.68211 74 69 60 18
## 288 57.84221 75 71 69 5
## 289 71.74833 88 84 87 18
## 290 32.07911 44 39 40 4
## 291 56.15152 74 58 70 4
## 292 87.54705 100 92 100 3
## 293 50.79463 65 61 60 4
## 294 68.57038 93 78 84 9
## 295 60.06269 81 72 75 4
## 296 55.88327 71 65 74 10
## 297 58.10848 66 64 73 8
## 298 46.15596 59 53 59 12
## 299 54.05970 62 61 70 5
## 300 47.23416 65 57 64 12
## 301 61.71611 81 77 75 19
## 302 41.11415 57 53 53 11
## 303 49.24920 66 57 62 17
## 304 64.77448 81 76 77 19
## 305 36.98801 49 55 46 20
## 306 60.92296 73 67 78 18
## 307 49.61189 53 73 63 3
## 308 67.31440 84 79 83 5
## 309 62.40423 79 79 86 18
## 310 66.70948 100 85 82 12
## 311 62.86912 88 71 74 6
## 312 40.22729 57 51 52 10
## 313 59.49949 71 69 74 19
## 314 58.56535 68 71 73 18
## 315 59.76127 79 72 68 6
## 316 63.10179 74 73 79 13
## 317 52.09181 72 61 68 12
## 318 52.20452 69 67 67 6
## 319 29.73101 39 40 36 14
## 320 55.24119 69 74 73 6
## 321 66.77719 84 78 85 12
## 322 68.57395 83 79 85 20
## 323 71.07728 88 83 89 17
## 324 64.06137 78 74 74 14
## 325 52.82629 75 66 71 4
## 326 50.85307 67 66 65 19
## 327 49.76366 63 65 64 15
## 328 54.02181 68 63 75 16
## 329 64.81047 77 70 79 11
## 330 60.53709 84 73 80 10
## 331 63.52938 78 71 71 15
## 332 35.60195 50 45 48 13
## 333 51.95632 69 63 67 7
## 334 48.97387 61 53 57 16
## 335 62.59210 78 70 82 6
## 336 43.19398 70 53 65 15
## 337 57.89970 71 74 70 5
## 338 51.87491 65 58 68 16
## 339 70.92209 94 91 82 6
## 340 60.86413 70 77 84 7
## 341 69.37181 87 87 88 19
## 342 50.30929 70 67 63 4
## 343 66.82758 86 85 78 19
## 344 62.37177 83 81 77 12
## 345 66.67781 80 68 81 6
## 346 58.47913 79 68 75 16
## 347 77.08199 100 92 89 19
## 348 48.54776 53 67 63 7
## 349 54.88660 74 72 59 16
## 350 42.39740 55 56 61 5
## 351 46.33586 59 56 59 12
## 352 63.10095 80 86 78 7
## 353 52.71056 67 70 71 3
## 354 59.10715 78 74 71 20
## 355 79.90561 100 87 94 17
## 356 60.77053 79 72 73 20
## 357 63.46421 73 74 73 12
## 358 66.61770 88 79 86 18
## 359 57.43317 74 66 72 17
## 360 49.65836 78 63 62 19
## 361 67.29670 79 91 85 9
## 362 54.02191 70 68 65 18
## 363 63.58922 83 60 74 20
## 364 57.43114 76 72 70 16
## 365 60.07263 74 79 75 13
## 366 63.08024 75 75 75 14
## 367 42.00313 63 53 59 15
## 368 61.22453 72 71 71 17
## 369 42.77387 58 65 58 15
## 370 55.30236 74 71 73 3
## 371 58.25206 78 68 68 14
## 372 50.62080 76 70 57 3
## 373 44.76010 50 55 66 17
## 374 74.58125 90 80 88 13
## 375 54.07174 59 71 67 7
## 376 39.63847 49 54 58 5
## 377 44.54275 62 60 62 4
## 378 70.40461 78 96 84 14
## 379 58.32352 78 67 67 8
## 380 54.16351 64 65 67 9
## 381 62.59922 82 80 79 6
## 382 63.58603 75 81 83 12
## 383 59.47161 73 57 79 13
## 384 46.36023 62 58 62 11
## 385 60.71137 74 70 74 10
## 386 49.78514 67 70 74 16
## 387 56.40535 75 70 72 16
## 388 64.61383 80 70 89 9
## 389 44.96182 50 58 59 8
## 390 52.06298 68 63 66 17
## 391 44.26439 50 49 64 11
## 392 56.86260 78 65 76 17
## 393 37.56590 53 41 53 7
## 394 55.28699 75 76 64 8
## 395 67.30779 87 71 76 11
## 396 59.81493 76 66 77 17
## 397 61.29712 76 76 75 6
## 398 52.36774 65 69 70 11
## 399 54.31678 67 68 72 10
## 400 54.92010 67 69 67 9
## 401 46.09858 68 66 54 20
## 402 43.88287 55 56 65 12
## 403 60.36424 77 75 78 14
## 404 49.94463 67 65 74 13
## 405 43.73331 47 67 60 8
## 406 50.98603 62 66 65 13
## 407 72.76758 85 79 90 11
## 408 62.82281 81 76 78 4
## 409 50.71690 65 64 57 5
## 410 45.22337 59 58 64 17
## 411 57.47679 75 65 70 15
## 412 61.53300 76 76 76 3
## 413 35.42301 47 42 51 19
## 414 50.22422 68 63 65 12
## 415 45.59626 52 58 62 16
## 416 56.92960 75 72 71 13
## 417 46.04301 56 55 53 5
## 418 48.03842 57 69 64 17
## 419 25.45168 38 39 36 5
## 420 53.96056 75 66 71 17
## 421 49.00908 67 67 63 19
## 422 49.53508 59 69 63 19
## 423 58.80775 81 73 78 5
## 424 67.08841 83 86 84 13
## 425 60.26019 79 72 76 13
## 426 48.83066 71 72 64 9
## 427 62.05955 77 84 82 16
## 428 70.46195 82 81 90 12
## 429 59.57570 79 74 68 20
## 430 51.04059 64 61 70 20
## 431 63.90490 70 75 84 10
## 432 76.95327 97 79 92 14
## 433 50.41617 66 57 65 9
## 434 59.32454 72 70 78 9
## 435 43.05057 61 58 60 15
## 436 50.90886 59 62 70 11
## 437 48.12059 59 56 63 11
## 438 59.58662 77 79 70 18
## 439 62.33391 73 71 74 20
## 440 66.47177 82 85 79 14
## 441 69.14455 78 80 78 13
## 442 37.61352 57 47 48 3
## 443 56.19145 81 61 72 5
## 444 71.91273 94 86 90 16
## 445 71.23563 96 88 89 20
## 446 63.43251 77 76 84 9
## 447 64.47547 88 89 77 13
## 448 48.37161 65 72 65 8
## 449 37.39341 45 54 53 18
## 450 60.15929 75 72 67 15
## 451 48.59842 72 64 65 18
## 452 58.33333 76 67 72 16
## 453 81.53108 100 94 97 17
## 454 49.18700 69 72 65 9
## 455 53.67917 62 62 69 3
## 456 37.88930 57 50 52 18
## 457 66.93016 79 77 83 9
## 458 59.47957 67 70 70 4
## 459 42.05094 57 52 54 4
## 460 55.14366 77 62 73 7
## 461 72.84402 87 76 89 18
## 462 65.16833 74 80 88 12
## 463 48.78172 67 66 68 14
## 464 64.65591 77 79 82 20
## 465 51.61789 64 66 64 11
## 466 54.23169 73 60 70 8
## 467 45.94874 64 65 59 14
## 468 35.93919 48 51 55 3
## 469 66.82849 90 86 92 18
## 470 60.52716 75 71 80 10
## 471 46.12918 65 51 54 20
## 472 40.55575 55 61 55 17
## 473 56.05353 78 62 68 17
## 474 69.78945 92 80 84 11
## 475 53.56571 70 74 69 6
## 476 49.03555 63 61 63 17
## 477 57.86641 79 67 78 9
## 478 65.28917 81 82 86 16
## 479 56.86949 76 64 73 10
## 480 45.25541 52 54 63 12
## 481 40.90871 57 58 52 11
## 482 47.22595 57 60 60 9
## 483 51.32120 70 63 69 6
## 484 64.81711 90 63 88 12
## 485 73.00448 83 89 92 3
## 486 47.40576 67 64 63 3
## 487 52.20386 66 54 70 14
## 488 68.57368 79 79 89 16
## 489 52.51971 68 64 71 4
## 490 47.22389 65 48 60 14
## 491 68.07702 80 73 84 9
## 492 83.74849 100 94 94 3
## 493 80.03903 100 87 93 5
## 494 58.49156 76 71 68 6
## 495 56.06712 73 58 70 14
## 496 57.72326 67 64 71 19
## 497 39.45450 48 62 56 13
## 498 67.46588 86 80 85 19
## 499 59.89442 73 64 72 18
## 500 63.37715 68 68 76 9
## extracurricular gender
## 1 Yes Male
## 2 No Male
## 3 Yes Male
## 4 No Male
## 5 Yes Female
## 6 No Male
## 7 Yes Male
## 8 Yes Male
## 9 Yes Female
## 10 No Female
## 11 Yes Female
## 12 No Male
## 13 No Male
## 14 No Male
## 15 Yes Male
## 16 Yes Female
## 17 Yes Female
## 18 No Female
## 19 Yes Male
## 20 Yes Male
## 21 Yes Male
## 22 No Female
## 23 Yes Female
## 24 Yes Female
## 25 No Male
## 26 Yes Female
## 27 Yes Male
## 28 Yes Male
## 29 Yes Male
## 30 No Male
## 31 No Male
## 32 Yes Female
## 33 Yes Male
## 34 No Female
## 35 No Male
## 36 No Male
## 37 No Male
## 38 No Male
## 39 No Male
## 40 Yes Male
## 41 No Female
## 42 No Male
## 43 Yes Female
## 44 Yes Female
## 45 Yes Female
## 46 Yes Male
## 47 No Female
## 48 Yes Male
## 49 Yes Male
## 50 No Male
## 51 Yes Male
## 52 Yes Female
## 53 No Female
## 54 Yes Male
## 55 Yes Male
## 56 Yes Male
## 57 No Male
## 58 Yes Female
## 59 Yes Male
## 60 Yes Female
## 61 No Female
## 62 Yes Female
## 63 Yes Male
## 64 Yes Female
## 65 No Female
## 66 Yes Male
## 67 Yes Female
## 68 Yes Male
## 69 Yes Female
## 70 Yes Female
## 71 No Female
## 72 Yes Female
## 73 Yes Male
## 74 Yes Male
## 75 Yes Male
## 76 Yes Male
## 77 No Female
## 78 No Female
## 79 No Female
## 80 No Female
## 81 No Male
## 82 Yes Female
## 83 Yes Female
## 84 No Male
## 85 Yes Female
## 86 Yes Male
## 87 No Male
## 88 Yes Female
## 89 No Male
## 90 Yes Male
## 91 No Female
## 92 Yes Male
## 93 Yes Male
## 94 Yes Female
## 95 Yes Male
## 96 Yes Male
## 97 No Female
## 98 No Male
## 99 Yes Female
## 100 Yes Female
## 101 No Male
## 102 Yes Male
## 103 No Female
## 104 Yes Male
## 105 Yes Male
## 106 Yes Male
## 107 Yes Female
## 108 Yes Male
## 109 Yes Male
## 110 Yes Male
## 111 Yes Male
## 112 Yes Female
## 113 No Male
## 114 Yes Female
## 115 Yes Female
## 116 Yes Female
## 117 Yes Male
## 118 Yes Male
## 119 Yes Male
## 120 No Female
## 121 No Male
## 122 Yes Female
## 123 Yes Male
## 124 Yes Female
## 125 No Male
## 126 Yes Male
## 127 Yes Male
## 128 No Female
## 129 No Female
## 130 Yes Female
## 131 No Female
## 132 Yes Male
## 133 No Female
## 134 No Male
## 135 No Male
## 136 Yes Female
## 137 Yes Male
## 138 Yes Female
## 139 Yes Female
## 140 No Female
## 141 Yes Female
## 142 No Male
## 143 Yes Female
## 144 Yes Female
## 145 Yes Male
## 146 No Male
## 147 Yes Female
## 148 Yes Male
## 149 Yes Male
## 150 Yes Male
## 151 Yes Male
## 152 No Male
## 153 No Female
## 154 No Female
## 155 Yes Male
## 156 No Female
## 157 No Female
## 158 Yes Female
## 159 Yes Female
## 160 Yes Female
## 161 Yes Female
## 162 No Female
## 163 Yes Female
## 164 Yes Male
## 165 No Male
## 166 No Male
## 167 Yes Female
## 168 Yes Male
## 169 Yes Male
## 170 Yes Female
## 171 No Female
## 172 Yes Female
## 173 No Male
## 174 Yes Female
## 175 No Male
## 176 Yes Male
## 177 No Female
## 178 Yes Female
## 179 Yes Male
## 180 No Male
## 181 No Male
## 182 No Male
## 183 Yes Female
## 184 Yes Male
## 185 Yes Male
## 186 Yes Male
## 187 Yes Female
## 188 No Male
## 189 No Male
## 190 Yes Male
## 191 No Female
## 192 Yes Female
## 193 Yes Male
## 194 Yes Male
## 195 No Female
## 196 No Female
## 197 Yes Male
## 198 No Male
## 199 No Male
## 200 Yes Male
## 201 No Male
## 202 No Female
## 203 No Female
## 204 Yes Female
## 205 Yes Male
## 206 Yes Male
## 207 No Female
## 208 No Male
## 209 No Female
## 210 Yes Male
## 211 Yes Female
## 212 No Male
## 213 Yes Male
## 214 Yes Male
## 215 No Female
## 216 Yes Male
## 217 Yes Female
## 218 Yes Male
## 219 Yes Male
## 220 Yes Female
## 221 Yes Female
## 222 Yes Male
## 223 No Male
## 224 No Female
## 225 Yes Male
## 226 No Male
## 227 Yes Male
## 228 Yes Female
## 229 No Female
## 230 No Male
## 231 Yes Female
## 232 Yes Male
## 233 No Male
## 234 No Female
## 235 No Male
## 236 No Female
## 237 No Female
## 238 Yes Male
## 239 No Female
## 240 No Female
## 241 No Male
## 242 Yes Female
## 243 Yes Male
## 244 Yes Female
## 245 No Male
## 246 No Male
## 247 No Female
## 248 No Male
## 249 No Male
## 250 Yes Female
## 251 Yes Male
## 252 Yes Female
## 253 Yes Female
## 254 Yes Male
## 255 Yes Male
## 256 No Male
## 257 No Male
## 258 No Male
## 259 Yes Male
## 260 No Male
## 261 Yes Male
## 262 No Female
## 263 No Female
## 264 No Female
## 265 Yes Female
## 266 Yes Female
## 267 No Male
## 268 Yes Female
## 269 No Male
## 270 Yes Female
## 271 No Female
## 272 No Male
## 273 Yes Female
## 274 No Female
## 275 Yes Male
## 276 Yes Male
## 277 No Female
## 278 No Male
## 279 No Male
## 280 Yes Male
## 281 No Female
## 282 No Male
## 283 Yes Female
## 284 No Female
## 285 No Male
## 286 Yes Male
## 287 Yes Female
## 288 Yes Male
## 289 No Female
## 290 Yes Female
## 291 Yes Female
## 292 Yes Female
## 293 Yes Male
## 294 Yes Female
## 295 No Female
## 296 No Female
## 297 Yes Female
## 298 Yes Male
## 299 No Female
## 300 Yes Male
## 301 No Female
## 302 Yes Male
## 303 No Female
## 304 Yes Male
## 305 No Female
## 306 No Female
## 307 Yes Female
## 308 Yes Male
## 309 No Male
## 310 Yes Female
## 311 No Male
## 312 Yes Male
## 313 Yes Male
## 314 No Male
## 315 Yes Male
## 316 No Female
## 317 Yes Male
## 318 No Male
## 319 No Female
## 320 No Male
## 321 No Male
## 322 No Female
## 323 Yes Male
## 324 No Female
## 325 Yes Female
## 326 No Male
## 327 Yes Female
## 328 Yes Male
## 329 Yes Female
## 330 No Male
## 331 Yes Female
## 332 Yes Female
## 333 Yes Female
## 334 No Male
## 335 No Female
## 336 No Female
## 337 Yes Female
## 338 Yes Male
## 339 No Male
## 340 Yes Male
## 341 No Male
## 342 Yes Male
## 343 Yes Female
## 344 Yes Female
## 345 Yes Male
## 346 Yes Male
## 347 Yes Female
## 348 Yes Female
## 349 No Male
## 350 Yes Male
## 351 Yes Female
## 352 No Male
## 353 Yes Male
## 354 Yes Female
## 355 Yes Male
## 356 Yes Male
## 357 Yes Male
## 358 Yes Male
## 359 Yes Female
## 360 No Male
## 361 No Female
## 362 Yes Female
## 363 No Male
## 364 Yes Female
## 365 Yes Male
## 366 No Male
## 367 No Male
## 368 No Female
## 369 Yes Male
## 370 Yes Male
## 371 Yes Female
## 372 Yes Male
## 373 No Male
## 374 Yes Female
## 375 Yes Female
## 376 Yes Male
## 377 No Male
## 378 Yes Male
## 379 No Female
## 380 Yes Male
## 381 Yes Female
## 382 No Female
## 383 No Female
## 384 Yes Male
## 385 Yes Male
## 386 Yes Male
## 387 No Male
## 388 Yes Male
## 389 No Male
## 390 No Male
## 391 Yes Female
## 392 Yes Female
## 393 Yes Male
## 394 Yes Female
## 395 No Male
## 396 No Male
## 397 Yes Male
## 398 Yes Female
## 399 No Male
## 400 Yes Female
## 401 Yes Male
## 402 Yes Male
## 403 No Male
## 404 Yes Female
## 405 No Male
## 406 No Male
## 407 No Female
## 408 No Male
## 409 Yes Female
## 410 Yes Male
## 411 Yes Female
## 412 Yes Male
## 413 Yes Male
## 414 No Male
## 415 No Male
## 416 No Female
## 417 Yes Male
## 418 Yes Male
## 419 Yes Male
## 420 No Female
## 421 Yes Male
## 422 Yes Male
## 423 Yes Female
## 424 No Male
## 425 No Female
## 426 No Male
## 427 Yes Female
## 428 Yes Male
## 429 No Male
## 430 Yes Female
## 431 Yes Female
## 432 Yes Female
## 433 Yes Female
## 434 No Male
## 435 No Female
## 436 Yes Male
## 437 No Female
## 438 No Female
## 439 Yes Male
## 440 Yes Female
## 441 Yes Male
## 442 Yes Female
## 443 Yes Male
## 444 No Male
## 445 Yes Female
## 446 Yes Male
## 447 No Male
## 448 Yes Female
## 449 Yes Female
## 450 No Male
## 451 Yes Male
## 452 Yes Female
## 453 Yes Male
## 454 Yes Male
## 455 Yes Male
## 456 Yes Male
## 457 No Male
## 458 No Male
## 459 Yes Male
## 460 Yes Male
## 461 Yes Male
## 462 Yes Female
## 463 No Male
## 464 Yes Male
## 465 No Female
## 466 Yes Male
## 467 Yes Male
## 468 Yes Female
## 469 No Male
## 470 No Female
## 471 No Female
## 472 Yes Female
## 473 Yes Male
## 474 No Male
## 475 Yes Female
## 476 Yes Male
## 477 No Male
## 478 No Male
## 479 Yes Male
## 480 Yes Female
## 481 Yes Male
## 482 Yes Female
## 483 Yes Female
## 484 No Female
## 485 Yes Female
## 486 No Female
## 487 Yes Male
## 488 Yes Female
## 489 Yes Female
## 490 Yes Male
## 491 No Female
## 492 Yes Female
## 493 Yes Female
## 494 No Female
## 495 Yes Male
## 496 No Female
## 497 Yes Female
## 498 Yes Female
## 499 Yes Female
## 500 Yes Female
Z-Test Exercises (1-20) 1. Perform a one-sample z-test to check if the average math_score is different from the population mean of 65.
Test the hypothesis that the average reading_score is greater than the population mean of 68.
Is the average science_score less than a hypothesized population mean of 67? (Assume a population SD of 13 for science).
A national benchmark states that the average hours_studied should be 12. Test this claim (Assume a population SD of 4).
Compare the math_score of students in grade_level 10 to the population mean. Is it significantly different?
Test if the reading_score for students who participate in extracurricular activities is higher than the population mean.
The state claims the average post_test_score is 58. Perform a z-test to verify this (Assume σ=12).
Do students in grade_level 12 have a math_score significantly above the population mean?
Test if the pre_test_score for school_type == “Private” is different from a population mean of 55 (Assume σ=11).
Is the average science_score for students using the “Traditional” teaching method equal to 62? (Assume σ=12).
Perform a two-sample z-test to see if there’s a difference in math_score between Public and Private schools. (Use the sample SD of each group as the “known” population SD for this exercise).
Test if the reading_score for grade_level 11 is greater than for grade_level 10. (Treat the SD of each grade as the known population SD).
Is there a significant difference in hours_studied between students who do and do not participate in extracurricular activities? (Use a two-sample z-test).
Test the claim that the post_test_score for the “Flipped_Classroom” method is greater than 60 (Assume σ=11).
A policy suggests that the average pre_test_score for grade_level 9 should be 48. Can you reject this? (Assume σ=9).
Test if the proportion of students from Private schools is different from 35%.
Is the proportion of students in grade_level 12 significantly greater than 20%?
Test if the proportion of students using “Blended” teaching method is less than 40%.
Check if the proportion of students who participate in extracurricular activities and have a reading_score > 70 is greater than 30%.
# 1. One-sample z-test for math_score vs population mean of 65
z.test(education_dataset$math_score, mu = 65, sigma.x = 15)
##
## One-sample z-Test
##
## data: education_dataset$math_score
## z = 10.11, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 65
## 95 percent confidence interval:
## 70.46722 73.09678
## sample estimates:
## mean of x
## 71.782
# 2. One-sample z-test for reading_score > population mean of 68
z.test(education_dataset$reading_score, mu = 68, sigma.x = 14, alternative = "greater")
##
## One-sample z-Test
##
## data: education_dataset$reading_score
## z = 0.61332, p-value = 0.2698
## alternative hypothesis: true mean is greater than 68
## 95 percent confidence interval:
## 67.35416 NA
## sample estimates:
## mean of x
## 68.384
# 3. One-sample z-test for science_score < population mean of 67
z.test(education_dataset$science_score, mu = 67, sigma.x = 13, alternative = "less")
##
## One-sample z-Test
##
## data: education_dataset$science_score
## z = 7.5992, p-value = 1
## alternative hypothesis: true mean is less than 67
## 95 percent confidence interval:
## NA 72.37428
## sample estimates:
## mean of x
## 71.418
# 4. One-sample z-test for hours_studied vs population mean of 12
z.test(education_dataset$hours_studied, mu = 12, sigma.x = 4)
##
## One-sample z-Test
##
## data: education_dataset$hours_studied
## z = -0.682, p-value = 0.4952
## alternative hypothesis: true mean is not equal to 12
## 95 percent confidence interval:
## 11.52739 12.22861
## sample estimates:
## mean of x
## 11.878
# 5. Z-test for grade 10 math_score vs population mean
grade_10_math <- education_dataset$math_score[education_dataset$grade_level == 10]
z.test(grade_10_math, mu = 65, sigma.x = 15)
##
## One-sample z-Test
##
## data: grade_10_math
## z = 4.2413, p-value = 2.223e-05
## alternative hypothesis: true mean is not equal to 65
## 95 percent confidence interval:
## 68.13689 73.52698
## sample estimates:
## mean of x
## 70.83193
# 6. Z-test for extracurricular students' reading_score > population mean
extracurricular_reading <- education_dataset$reading_score[education_dataset$extracurricular == "Yes"]
z.test(extracurricular_reading, mu = 68, sigma.x = 14, alternative = "greater")
##
## One-sample z-Test
##
## data: extracurricular_reading
## z = 0.082341, p-value = 0.4672
## alternative hypothesis: true mean is greater than 68
## 95 percent confidence interval:
## 66.73914 NA
## sample estimates:
## mean of x
## 68.06645
# 7. Z-test for post_test_score vs population mean of 58
z.test(education_dataset$post_test_score, mu = 58, sigma.x = 12)
##
## One-sample z-Test
##
## data: education_dataset$post_test_score
## z = -2.9383, p-value = 0.0033
## alternative hypothesis: true mean is not equal to 58
## 95 percent confidence interval:
## 55.37132 57.47497
## sample estimates:
## mean of x
## 56.42314
# 8. Z-test for grade 12 math_score > population mean
grade_12_math <- education_dataset$math_score[education_dataset$grade_level == 12]
z.test(grade_12_math, mu = 65, sigma.x = 15, alternative = "greater")
##
## One-sample z-Test
##
## data: grade_12_math
## z = 5.5206, p-value = 1.689e-08
## alternative hypothesis: true mean is greater than 65
## 95 percent confidence interval:
## 70.04105 NA
## sample estimates:
## mean of x
## 72.18045
# 9. Z-test for private school pre_test_score vs population mean of 55
private_pre_test <- education_dataset$pre_test_score[education_dataset$school_type == "Private"]
z.test(private_pre_test, mu = 55, sigma.x = 11)
##
## One-sample z-Test
##
## data: private_pre_test
## z = -5.1809, p-value = 2.208e-07
## alternative hypothesis: true mean is not equal to 55
## 95 percent confidence interval:
## 48.43136 52.03717
## sample estimates:
## mean of x
## 50.23427
# 10. Z-test for traditional method science_score vs population mean of 62
traditional_science <- education_dataset$science_score[education_dataset$teaching_method == "Traditional"]
z.test(traditional_science, mu = 62, sigma.x = 12)
##
## One-sample z-Test
##
## data: traditional_science
## z = 7.5028, p-value = 6.247e-14
## alternative hypothesis: true mean is not equal to 62
## 95 percent confidence interval:
## 67.44904 71.30264
## sample estimates:
## mean of x
## 69.37584
# 11. Two-sample z-test for math_score between school types
public_math <- education_dataset$math_score[education_dataset$school_type == "Public"]
private_math <- education_dataset$math_score[education_dataset$school_type == "Private"]
z.test(public_math, private_math, sigma.x = sd(public_math), sigma.y = sd(private_math))
##
## Two-sample z-Test
##
## data: public_math and private_math
## z = -0.18918, p-value = 0.8499
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -2.689659 2.216133
## sample estimates:
## mean of x mean of y
## 71.71429 71.95105
# 12. Two-sample z-test for reading_score between grade 11 and grade 10
grade_11_reading <- education_dataset$reading_score[education_dataset$grade_level == 11]
grade_10_reading <- education_dataset$reading_score[education_dataset$grade_level == 10]
z.test(grade_11_reading, grade_10_reading, sigma.x = sd(grade_11_reading),
sigma.y = sd(grade_10_reading), alternative = "greater")
##
## Two-sample z-Test
##
## data: grade_11_reading and grade_10_reading
## z = -0.13614, p-value = 0.5541
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -2.678403 NA
## sample estimates:
## mean of x mean of y
## 67.73643 67.94118
# 13. Two-sample z-test for hours_studied between extracurricular groups
extracurricular_yes <- education_dataset$hours_studied[education_dataset$extracurricular == "Yes"]
extracurricular_no <- education_dataset$hours_studied[education_dataset$extracurricular == "No"]
z.test(extracurricular_yes, extracurricular_no, sigma.x = sd(extracurricular_yes),
sigma.y = sd(extracurricular_no))
##
## Two-sample z-Test
##
## data: extracurricular_yes and extracurricular_no
## z = -1.9794, p-value = 0.04777
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.898483548 -0.009361324
## sample estimates:
## mean of x mean of y
## 11.49834 12.45226
# 14. Z-test for flipped classroom post_test_score > 60
flipped_post <- education_dataset$post_test_score[education_dataset$teaching_method == "Flipped_Classroom"]
z.test(flipped_post, mu = 60, sigma.x = 11, alternative = "greater")
##
## One-sample z-Test
##
## data: flipped_post
## z = -3.611, p-value = 0.9998
## alternative hypothesis: true mean is greater than 60
## 95 percent confidence interval:
## 55.48549 NA
## sample estimates:
## mean of x
## 56.89835
# 15. Z-test for grade 9 pre_test_score vs population mean of 48
grade_9_pre <- education_dataset$pre_test_score[education_dataset$grade_level == 9]
z.test(grade_9_pre, mu = 48, sigma.x = 9)
##
## One-sample z-Test
##
## data: grade_9_pre
## z = 2.2398, p-value = 0.0251
## alternative hypothesis: true mean is not equal to 48
## 95 percent confidence interval:
## 48.23087 51.46493
## sample estimates:
## mean of x
## 49.8479
# 16. One proportion z-test for math_score > 75
math_high <- sum(education_dataset$math_score > 75)
prop.test(math_high, n = n, p = 0.25)
##
## 1-sample proportions test with continuity correction
##
## data: math_high out of n, null probability 0.25
## X-squared = 43.011, df = 1, p-value = 5.444e-11
## alternative hypothesis: true p is not equal to 0.25
## 95 percent confidence interval:
## 0.3356103 0.4222936
## sample estimates:
## p
## 0.378
# 17. One proportion z-test for private schools proportion
private_count <- sum(education_dataset$school_type == "Private")
prop.test(private_count, n = n, p = 0.35)
##
## 1-sample proportions test with continuity correction
##
## data: private_count out of n, null probability 0.35
## X-squared = 8.7231, df = 1, p-value = 0.003142
## alternative hypothesis: true p is not equal to 0.35
## 95 percent confidence interval:
## 0.2471888 0.3281564
## sample estimates:
## p
## 0.286
# 18. One proportion z-test for grade 12 proportion
grade_12_count <- sum(education_dataset$grade_level == 12)
prop.test(grade_12_count, n = n, p = 0.20, alternative = "greater")
##
## 1-sample proportions test with continuity correction
##
## data: grade_12_count out of n, null probability 0.2
## X-squared = 13.203, df = 1, p-value = 0.0001397
## alternative hypothesis: true p is greater than 0.2
## 95 percent confidence interval:
## 0.233863 1.000000
## sample estimates:
## p
## 0.266
# 19. One proportion z-test for blended method proportion
blended_count <- sum(education_dataset$teaching_method == "Blended")
prop.test(blended_count, n = n, p = 0.40, alternative = "less")
##
## 1-sample proportions test with continuity correction
##
## data: blended_count out of n, null probability 0.4
## X-squared = 1.3021, df = 1, p-value = 0.1269
## alternative hypothesis: true p is less than 0.4
## 95 percent confidence interval:
## 0.0000000 0.4111953
## sample estimates:
## p
## 0.374
# 20. One proportion z-test for extracurricular students with high reading score
extracurricular_high_reading <- sum(education_dataset$extracurricular == "Yes" &
education_dataset$reading_score > 70)
prop.test(extracurricular_high_reading, n = n, p = 0.30, alternative = "greater")
##
## 1-sample proportions test with continuity correction
##
## data: extracurricular_high_reading out of n, null probability 0.3
## X-squared = 5.7167, df = 1, p-value = 0.9916
## alternative hypothesis: true p is greater than 0.3
## 95 percent confidence interval:
## 0.218598 1.000000
## sample estimates:
## p
## 0.25
T-Test Exercises (20 questions)
The t-test is used when the population standard deviation is unknown. This is much more common in real-world scenarios.
Perform a one-sample t-test to check if the average math_score is different from 65.
Test if the average hours_studied is greater than 10.
Is there a significant difference between pre_test_score and post_test_score? (Use a paired t-test).
Compare the math_score between Public and Private schools using an independent samples t-test.
Do students who participate in extracurricular activities have a different average reading_score than those who don’t?
Test if the average science_score for grade_level 11 is different from 70.
Perform a paired t-test to see if the improvement from pre_test_score to post_test_score is greater than 5 points.
Is there a difference in hours_studied between students in grade_level 9 and grade_level 12?
Test if the post_test_score for the “Flipped_Classroom” method is greater than for the “Traditional” method.
Do male and female students (if the data had gender) have equal math_score? (For this exercise, create a synthetic gender column).
Check if the average reading_score for the “Blended” teaching method is different from 67.
Test if students who study more than 15 hours per week (hours_studied > 15) have a higher science_score than those who study less than 10 hours per week.
Is the mean post_test_score for grade_level 10 less than 58?
Perform a paired t-test on math_score and science_score for each student. Is one significantly higher than the other?
Compare the pre_test_score of students in Private vs Public schools. Is there a baseline difference?
Test if the improvement (post_test_score - pre_test_score) is greater than zero for the entire sample.
Is the average hours_studied for students in grade_level 12 different from 13?
Do students who use the “Flipped_Classroom” method have a different pre_test_score than the national average of 50?
Compare the reading_score of the top 25% of students (by math_score) to the bottom 25%.
Test if the variance in math_score is the same for Public and Private schools before performing the t-test in Q4 (use var.test).
# 21. One-sample t-test for math_score vs 65
t.test(education_dataset$math_score, mu = 65)
##
## One Sample t-test
##
## data: education_dataset$math_score
## t = 11.686, df = 499, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 65
## 95 percent confidence interval:
## 70.64173 72.92227
## sample estimates:
## mean of x
## 71.782
# 22. One-sample t-test for hours_studied > 10
t.test(education_dataset$hours_studied, mu = 10, alternative = "greater")
##
## One Sample t-test
##
## data: education_dataset$hours_studied
## t = 7.9146, df = 499, p-value = 8.079e-15
## alternative hypothesis: true mean is greater than 10
## 95 percent confidence interval:
## 11.48698 Inf
## sample estimates:
## mean of x
## 11.878
# 23. Paired t-test for pre_test_score vs post_test_score
t.test(education_dataset$post_test_score, education_dataset$pre_test_score, paired = TRUE)
##
## Paired t-test
##
## data: education_dataset$post_test_score and education_dataset$pre_test_score
## t = 49.413, df = 499, p-value < 2.2e-16
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## 6.347696 6.873390
## sample estimates:
## mean difference
## 6.610543
# 24. Independent t-test for math_score between school types
t.test(math_score ~ school_type, data = education_dataset)
##
## Welch Two Sample t-test
##
## data: math_score by school_type
## t = 0.18918, df = 277.42, p-value = 0.8501
## alternative hypothesis: true difference in means between group Private and group Public is not equal to 0
## 95 percent confidence interval:
## -2.226881 2.700407
## sample estimates:
## mean in group Private mean in group Public
## 71.95105 71.71429
# 25. Independent t-test for reading_score between extracurricular groups
t.test(reading_score ~ extracurricular, data = education_dataset)
##
## Welch Two Sample t-test
##
## data: reading_score by extracurricular
## t = 0.78548, df = 460.07, p-value = 0.4326
## alternative hypothesis: true difference in means between group No and group Yes is not equal to 0
## 95 percent confidence interval:
## -1.198267 2.794020
## sample estimates:
## mean in group No mean in group Yes
## 68.86432 68.06645
# 26. One-sample t-test for grade 11 science_score vs 70
grade_11_science <- education_dataset$science_score[education_dataset$grade_level == 11]
t.test(grade_11_science, mu = 70)
##
## One Sample t-test
##
## data: grade_11_science
## t = 1.0869, df = 128, p-value = 0.2791
## alternative hypothesis: true mean is not equal to 70
## 95 percent confidence interval:
## 69.07147 73.19210
## sample estimates:
## mean of x
## 71.13178
# 27. Paired t-test for improvement > 5 points
improvement <- education_dataset$post_test_score - education_dataset$pre_test_score
t.test(improvement, mu = 5, alternative = "greater")
##
## One Sample t-test
##
## data: improvement
## t = 12.038, df = 499, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 5
## 95 percent confidence interval:
## 6.39008 Inf
## sample estimates:
## mean of x
## 6.610543
# 28. Independent t-test for hours_studied between grade 9 and grade 12
grade_9_hours <- education_dataset$hours_studied[education_dataset$grade_level == 9]
grade_12_hours <- education_dataset$hours_studied[education_dataset$grade_level == 12]
t.test(grade_9_hours, grade_12_hours)
##
## Welch Two Sample t-test
##
## data: grade_9_hours and grade_12_hours
## t = -0.32398, df = 240.2, p-value = 0.7462
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.537559 1.103238
## sample estimates:
## mean of x mean of y
## 11.72269 11.93985
# 29. Independent t-test for post_test_score between teaching methods
flipped_post <- education_dataset$post_test_score[education_dataset$teaching_method == "Flipped_Classroom"]
traditional_post <- education_dataset$post_test_score[education_dataset$teaching_method == "Traditional"]
t.test(flipped_post, traditional_post, alternative = "greater")
##
## Welch Two Sample t-test
##
## data: flipped_post and traditional_post
## t = 1.8414, df = 310.93, p-value = 0.03326
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## 0.2347758 Inf
## sample estimates:
## mean of x mean of y
## 56.89835 54.64212
# 30. Independent t-test for math_score between genders
t.test(math_score ~ gender, data = education_dataset)
##
## Welch Two Sample t-test
##
## data: math_score by gender
## t = -0.44973, df = 487.07, p-value = 0.6531
## alternative hypothesis: true difference in means between group Female and group Male is not equal to 0
## 95 percent confidence interval:
## -2.806192 1.760846
## sample estimates:
## mean in group Female mean in group Male
## 71.49558 72.01825
# 31. One-sample t-test for blended method reading_score vs 67
blended_reading <- education_dataset$reading_score[education_dataset$teaching_method == "Blended"]
t.test(blended_reading, mu = 67)
##
## One Sample t-test
##
## data: blended_reading
## t = 2.3739, df = 186, p-value = 0.01862
## alternative hypothesis: true mean is not equal to 67
## 95 percent confidence interval:
## 67.31718 70.43684
## sample estimates:
## mean of x
## 68.87701
# 32. Independent t-test for science_score by study hours
high_study_science <- education_dataset$science_score[education_dataset$hours_studied > 15]
low_study_science <- education_dataset$science_score[education_dataset$hours_studied < 10]
t.test(high_study_science, low_study_science, alternative = "greater")
##
## Welch Two Sample t-test
##
## data: high_study_science and low_study_science
## t = -0.19712, df = 335.91, p-value = 0.5781
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -2.351879 Inf
## sample estimates:
## mean of x mean of y
## 70.88554 71.13661
# 33. One-sample t-test for grade 10 post_test_score < 58
grade_10_post <- education_dataset$post_test_score[education_dataset$grade_level == 10]
t.test(grade_10_post, mu = 58, alternative = "less")
##
## One Sample t-test
##
## data: grade_10_post
## t = -2.5918, df = 118, p-value = 0.005376
## alternative hypothesis: true mean is less than 58
## 95 percent confidence interval:
## -Inf 57.0887
## sample estimates:
## mean of x
## 55.47107
# 34. Paired t-test for math_score vs science_score
t.test(education_dataset$math_score, education_dataset$science_score, paired = TRUE)
##
## Paired t-test
##
## data: education_dataset$math_score and education_dataset$science_score
## t = 1.2206, df = 499, p-value = 0.2228
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## -0.2219272 0.9499272
## sample estimates:
## mean difference
## 0.364
# 35. Independent t-test for pre_test_score between school types
t.test(pre_test_score ~ school_type, data = education_dataset)
##
## Welch Two Sample t-test
##
## data: pre_test_score by school_type
## t = 0.61225, df = 287.86, p-value = 0.5409
## alternative hypothesis: true difference in means between group Private and group Public is not equal to 0
## 95 percent confidence interval:
## -1.307954 2.489091
## sample estimates:
## mean in group Private mean in group Public
## 50.23427 49.64370
# 36. One-sample t-test for improvement > 0
t.test(improvement, mu = 0, alternative = "greater")
##
## One Sample t-test
##
## data: improvement
## t = 49.413, df = 499, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 0
## 95 percent confidence interval:
## 6.39008 Inf
## sample estimates:
## mean of x
## 6.610543
# 37. One-sample t-test for grade 12 hours_studied vs 13
t.test(grade_12_hours, mu = 13)
##
## One Sample t-test
##
## data: grade_12_hours
## t = -2.4199, df = 132, p-value = 0.01689
## alternative hypothesis: true mean is not equal to 13
## 95 percent confidence interval:
## 11.07325 12.80645
## sample estimates:
## mean of x
## 11.93985
# 38. One-sample t-test for flipped classroom pre_test_score vs 50
flipped_pre <- education_dataset$pre_test_score[education_dataset$teaching_method == "Flipped_Classroom"]
t.test(flipped_pre, mu = 50)
##
## One Sample t-test
##
## data: flipped_pre
## t = -0.90752, df = 163, p-value = 0.3655
## alternative hypothesis: true mean is not equal to 50
## 95 percent confidence interval:
## 47.65491 50.86826
## sample estimates:
## mean of x
## 49.26159
# 39. Compare reading_score between top and bottom math performers
math_quantiles <- quantile(education_dataset$math_score, probs = c(0.25, 0.75))
top_math_reading <- education_dataset$reading_score[education_dataset$math_score > math_quantiles[2]]
bottom_math_reading <- education_dataset$reading_score[education_dataset$math_score < math_quantiles[1]]
t.test(top_math_reading, bottom_math_reading)
##
## Welch Two Sample t-test
##
## data: top_math_reading and bottom_math_reading
## t = 20.167, df = 245.54, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 20.36791 24.77725
## sample estimates:
## mean of x mean of y
## 79.85484 57.28226
# 40. F-test for equality of variances in math_score between school types
var.test(math_score ~ school_type, data = education_dataset)
##
## F test to compare two variances
##
## data: math_score by school_type
## F = 0.88216, num df = 142, denom df = 356, p-value = 0.3876
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.6749671 1.1722057
## sample estimates:
## ratio of variances
## 0.8821577
Chi-Square Test Exercises (20 questions)
The Chi-Square test is used for categorical data to test for independence or goodness-of-fit.
Perform a Chi-Square test to check if school_type is independent of teaching_method.
Test if there is an association between grade_level and participation in extracurricular activities.
Is the distribution of teaching_method equal across all categories? (Goodness-of-fit test).
Check if school_type is independent of grade_level.
Test if there is an association between extracurricular activities and a binned math_score (e.g., High: >70, Low: <=70).
Is the distribution of grade_level in your sample different from the expected distribution (25% in each grade)? (Goodness-of-fit).
Check for independence between teaching_method and a binned post_test_score (e.g., Pass/Fail with a cutoff of 60).
Test if school_type is associated with a binned hours_studied (e.g., Low: <10, Medium: 10-15, High: >15).
Is there a relationship between grade_level and a preferred teaching_method?
Check if the proportion of students from Private schools is the same across all grade_levels.
Test if students with high reading_score (top 50%) are equally distributed across teaching_methods.
Is there an association between extracurricular participation and school_type?
Perform a goodness-of-fit test to see if the school_type distribution matches the national average (75% Public, 25% Private).
Check if the distribution of grade_level is independent of a binned science_score.
Test if the teaching_method used is independent of a student’s grade_level.
Is there an association between being in the top 25% of math_score and participating in extracurricular activities?
Check if the school_type is related to whether a student’s post_test_score improved by more than 10 points.
Test if the distribution of extracurricular activities is the same for grade_level 9 and grade_level 12.
Is there a relationship between a student’s grade_level and their school_type?
Perform a Chi-Square test on a contingency table of teaching_method and a binary outcome of hours_studied (High/Low).
# 41. Chi-square test for independence between school_type and teaching_method
chisq.test(education_dataset$school_type, education_dataset$teaching_method)
##
## Pearson's Chi-squared test
##
## data: education_dataset$school_type and education_dataset$teaching_method
## X-squared = 0.90182, df = 2, p-value = 0.637
# 42. Chi-square test for independence between grade_level and extracurricular
chisq.test(education_dataset$grade_level, education_dataset$extracurricular)
##
## Pearson's Chi-squared test
##
## data: education_dataset$grade_level and education_dataset$extracurricular
## X-squared = 1.9279, df = 3, p-value = 0.5875
# 43. Goodness-of-fit test for equal distribution of teaching_method
teaching_method_counts <- table(education_dataset$teaching_method)
expected <- rep(length(education_dataset$teaching_method)/3, 3)
chisq.test(teaching_method_counts, p = expected/sum(expected))
##
## Chi-squared test for given probabilities
##
## data: teaching_method_counts
## X-squared = 4.396, df = 2, p-value = 0.111
# 44. Chi-square test for independence between school_type and grade_level
chisq.test(education_dataset$school_type, education_dataset$grade_level)
##
## Pearson's Chi-squared test
##
## data: education_dataset$school_type and education_dataset$grade_level
## X-squared = 1.3914, df = 3, p-value = 0.7076
# 45. Chi-square test for association between extracurricular and binned math_score
math_binned <- cut(education_dataset$math_score, breaks = c(0, 70, 100),
labels = c("Low", "High"))
chisq.test(education_dataset$extracurricular, math_binned)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: education_dataset$extracurricular and math_binned
## X-squared = 3.8083, df = 1, p-value = 0.051
# 46. Goodness-of-fit test for equal distribution of grade_level
grade_counts <- table(education_dataset$grade_level)
expected_grades <- rep(n/4, 4)
chisq.test(grade_counts, p = expected_grades/sum(expected_grades))
##
## Chi-squared test for given probabilities
##
## data: grade_counts
## X-squared = 1.216, df = 3, p-value = 0.7492
# 47. Chi-square test for independence between teaching_method and pass/fail post_test
post_test_pass <- ifelse(education_dataset$post_test_score >= 60, "Pass", "Fail")
chisq.test(education_dataset$teaching_method, post_test_pass)
##
## Pearson's Chi-squared test
##
## data: education_dataset$teaching_method and post_test_pass
## X-squared = 5.272, df = 2, p-value = 0.07165
# 48. Chi-square test for association between school_type and binned hours_studied
hours_binned <- cut(education_dataset$hours_studied, breaks = c(0, 10, 15, 20),
labels = c("Low", "Medium", "High"))
chisq.test(education_dataset$school_type, hours_binned)
##
## Pearson's Chi-squared test
##
## data: education_dataset$school_type and hours_binned
## X-squared = 0.58842, df = 2, p-value = 0.7451
# 49. Chi-square test for independence between grade_level and teaching_method
chisq.test(education_dataset$grade_level, education_dataset$teaching_method)
##
## Pearson's Chi-squared test
##
## data: education_dataset$grade_level and education_dataset$teaching_method
## X-squared = 2.1737, df = 6, p-value = 0.9031
# 50. Chi-square test for equal proportion of private schools across grade_levels
private_by_grade <- table(education_dataset$school_type, education_dataset$grade_level)
chisq.test(private_by_grade)
##
## Pearson's Chi-squared test
##
## data: private_by_grade
## X-squared = 1.3914, df = 3, p-value = 0.7076
# 51. Chi-square test for association between high reading score and teaching_method
reading_high <- education_dataset$reading_score > median(education_dataset$reading_score)
chisq.test(education_dataset$teaching_method, reading_high)
##
## Pearson's Chi-squared test
##
## data: education_dataset$teaching_method and reading_high
## X-squared = 6.5679, df = 2, p-value = 0.03748
# 52. Chi-square test for independence between extracurricular and school_type
chisq.test(education_dataset$extracurricular, education_dataset$school_type)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: education_dataset$extracurricular and education_dataset$school_type
## X-squared = 0.52566, df = 1, p-value = 0.4684
# 53. Goodness-of-fit test for school_type distribution vs national average
school_type_counts <- table(education_dataset$school_type)
chisq.test(school_type_counts, p = c(0.75, 0.25))
##
## Chi-squared test for given probabilities
##
## data: school_type_counts
## X-squared = 574.12, df = 1, p-value < 2.2e-16
# 54. Chi-square test for independence between grade_level and binned science_score
science_binned <- cut(education_dataset$science_score, breaks = c(0, 60, 80, 100),
labels = c("Low", "Medium", "High"))
chisq.test(education_dataset$grade_level, science_binned)
##
## Pearson's Chi-squared test
##
## data: education_dataset$grade_level and science_binned
## X-squared = 1.9706, df = 6, p-value = 0.9224
# 55. Chi-square test for independence between teaching_method and grade_level
chisq.test(education_dataset$teaching_method, education_dataset$grade_level)
##
## Pearson's Chi-squared test
##
## data: education_dataset$teaching_method and education_dataset$grade_level
## X-squared = 2.1737, df = 6, p-value = 0.9031
# 56. Chi-square test for association between top math performers and extracurricular
top_math <- education_dataset$math_score > quantile(education_dataset$math_score, 0.75)
chisq.test(education_dataset$extracurricular, top_math)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: education_dataset$extracurricular and top_math
## X-squared = 0.0009804, df = 1, p-value = 0.975
# 57. Chi-square test for association between school_type and significant improvement
significant_improvement <- (education_dataset$post_test_score - education_dataset$pre_test_score) > 10
chisq.test(education_dataset$school_type, significant_improvement)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: education_dataset$school_type and significant_improvement
## X-squared = 1.8277, df = 1, p-value = 0.1764
# 58. Chi-square test for extracurricular distribution between grade 9 and grade 12
extracurricular_grade9_12 <- education_dataset[education_dataset$grade_level %in% c(9, 12),
c("extracurricular", "grade_level")]
chisq.test(extracurricular_grade9_12$extracurricular, extracurricular_grade9_12$grade_level)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: extracurricular_grade9_12$extracurricular and extracurricular_grade9_12$grade_level
## X-squared = 0.76585, df = 1, p-value = 0.3815
# 59. Chi-square test for independence between grade_level and school_type
chisq.test(education_dataset$grade_level, education_dataset$school_type)
##
## Pearson's Chi-squared test
##
## data: education_dataset$grade_level and education_dataset$school_type
## X-squared = 1.3914, df = 3, p-value = 0.7076
# 60. Chi-square test for independence between teaching_method and binned hours_studied
chisq.test(education_dataset$teaching_method, hours_binned)
##
## Pearson's Chi-squared test
##
## data: education_dataset$teaching_method and hours_binned
## X-squared = 0.43627, df = 4, p-value = 0.9794
F-Test Exercises (20 questions)
The F-test is primarily used to compare two population variances, often as part of ANOVA (Analysis of Variance).
Use var.test() to compare the variance of math_score between Public and Private schools.
Is the variance of hours_studied the same for students who do and do not participate in extracurricular activities?
Perform a one-way ANOVA to test if the mean math_score is the same across all grade_levels.
Perform a one-way ANOVA to see if the teaching_method has a significant effect on post_test_score.
Test if the variance in reading_score is different between grade_level 10 and grade_level 11.
Use an ANOVA to check if the average hours_studied differs by school_type.
Perform a one-way ANOVA to see if pre_test_score varies significantly by grade_level.
Compare the variance of science_score between the “Traditional” and “Flipped_Classroom” teaching methods.
Test using ANOVA if there is a difference in post_test_score among the different levels of extracurricular participation (this is equivalent to a t-test for two groups, but it still works).
10 Perform a two-way ANOVA to examine the effects of school_type and teaching_method on math_score.
Check for an interaction effect between school_type and teaching_method on post_test_score using a two-way ANOVA.
Use var.test() to check if the variance of pre_test_score is equal for Public and Private schools.
Perform a one-way ANOVA to test if reading_score differs by the grade_level.
Is the variability in hours_studied the same across all teaching_methods? (Use bartlett.test() for homogeneity of variances).
Perform a two-way ANOVA with grade_level and extracurricular as factors for science_score.
Test if the variance of post_test_score is the same for students with low, medium, and high hours_studied (you’ll need to create this category).
Perform an ANOVA to see if the improvement (post_test_score - pre_test_score) differs by teaching_method.
Check for equal variances between math_score and reading_score (Hint: This is not a standard F-test for two groups; it’s for two different variables from the same sample. Think about the structure of your data).
Perform a one-way ANOVA to test if hours_studied is different across the three teaching_methods.
Conduct a two-way ANOVA to analyze the impact of school_type and grade_level on reading_score, including their interaction term.
# 61. F-test for equality of variances in math_score between school types
var.test(math_score ~ school_type, data = education_dataset)
##
## F test to compare two variances
##
## data: math_score by school_type
## F = 0.88216, num df = 142, denom df = 356, p-value = 0.3876
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.6749671 1.1722057
## sample estimates:
## ratio of variances
## 0.8821577
# 62. F-test for equality of variances in hours_studied between extracurricular groups
var.test(hours_studied ~ extracurricular, data = education_dataset)
##
## F test to compare two variances
##
## data: hours_studied by extracurricular
## F = 0.97141, num df = 198, denom df = 300, p-value = 0.83
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.7557319 1.2570595
## sample estimates:
## ratio of variances
## 0.9714126
# 63. One-way ANOVA for math_score across grade_levels
anova_math_grade <- aov(math_score ~ as.factor(grade_level), data = education_dataset)
summary(anova_math_grade)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(grade_level) 3 149 49.82 0.295 0.829
## Residuals 496 83890 169.13
# 64. One-way ANOVA for post_test_score across teaching_methods
anova_post_method <- aov(post_test_score ~ teaching_method, data = education_dataset)
summary(anova_post_method)
## Df Sum Sq Mean Sq F value Pr(>F)
## teaching_method 2 698 348.8 3.048 0.0484 *
## Residuals 497 56879 114.4
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# 65. F-test for equality of variances in reading_score between grade 10 and 11
grade_10_reading <- education_dataset$reading_score[education_dataset$grade_level == 10]
grade_11_reading <- education_dataset$reading_score[education_dataset$grade_level == 11]
var.test(grade_10_reading, grade_11_reading)
##
## F test to compare two variances
##
## data: grade_10_reading and grade_11_reading
## F = 0.91042, num df = 118, denom df = 128, p-value = 0.6058
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.6389447 1.3006217
## sample estimates:
## ratio of variances
## 0.9104221
# 66. One-way ANOVA for hours_studied by school_type
anova_hours_school <- aov(hours_studied ~ school_type, data = education_dataset)
summary(anova_hours_school)
## Df Sum Sq Mean Sq F value Pr(>F)
## school_type 1 1 1.283 0.045 0.831
## Residuals 498 14046 28.205
# 67. One-way ANOVA for pre_test_score across grade_levels
anova_pre_grade <- aov(pre_test_score ~ as.factor(grade_level), data = education_dataset)
summary(anova_pre_grade)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(grade_level) 3 133 44.26 0.426 0.734
## Residuals 496 51495 103.82
# 68. F-test for equality of variances in science_score between teaching methods
traditional_science <- education_dataset$science_score[education_dataset$teaching_method == "Traditional"]
flipped_science <- education_dataset$science_score[education_dataset$teaching_method == "Flipped_Classroom"]
var.test(traditional_science, flipped_science)
##
## F test to compare two variances
##
## data: traditional_science and flipped_science
## F = 0.92232, num df = 148, denom df = 163, p-value = 0.6172
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.6733283 1.2664685
## sample estimates:
## ratio of variances
## 0.9223198
# 69. One-way ANOVA for post_test_score by extracurricular
anova_post_extracurricular <- aov(post_test_score ~ extracurricular, data = education_dataset)
summary(anova_post_extracurricular)
## Df Sum Sq Mean Sq F value Pr(>F)
## extracurricular 1 53 52.83 0.457 0.499
## Residuals 498 57524 115.51
# 70. Two-way ANOVA for math_score by school_type and teaching_method
anova_math_two_way <- aov(math_score ~ school_type * teaching_method, data = education_dataset)
summary(anova_math_two_way)
## Df Sum Sq Mean Sq F value Pr(>F)
## school_type 1 6 5.72 0.034 0.854
## teaching_method 2 413 206.46 1.221 0.296
## school_type:teaching_method 2 62 31.04 0.184 0.832
## Residuals 494 83559 169.15
# 71. Two-way ANOVA for post_test_score with interaction
anova_post_interaction <- aov(post_test_score ~ school_type * teaching_method, data = education_dataset)
summary(anova_post_interaction)
## Df Sum Sq Mean Sq F value Pr(>F)
## school_type 1 128 128.2 1.117 0.2911
## teaching_method 2 724 362.1 3.154 0.0435 *
## school_type:teaching_method 2 13 6.6 0.057 0.9441
## Residuals 494 56711 114.8
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# 72. F-test for equality of variances in pre_test_score between school types
var.test(pre_test_score ~ school_type, data = education_dataset)
##
## F test to compare two variances
##
## data: pre_test_score by school_type
## F = 0.81652, num df = 142, denom df = 356, p-value = 0.1613
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.6247436 1.0849833
## sample estimates:
## ratio of variances
## 0.8165174
# 73. One-way ANOVA for reading_score across grade_levels
anova_reading_grade <- aov(reading_score ~ as.factor(grade_level), data = education_dataset)
summary(anova_reading_grade)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(grade_level) 3 194 64.73 0.495 0.686
## Residuals 496 64794 130.63
# 74. Bartlett test for homogeneity of variances in hours_studied across teaching_methods
bartlett.test(hours_studied ~ teaching_method, data = education_dataset)
##
## Bartlett test of homogeneity of variances
##
## data: hours_studied by teaching_method
## Bartlett's K-squared = 0.0013411, df = 2, p-value = 0.9993
# 75. Two-way ANOVA for science_score by grade_level and extracurricular
anova_science_two_way <- aov(science_score ~ as.factor(grade_level) * extracurricular,
data = education_dataset)
summary(anova_science_two_way)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(grade_level) 3 152 50.50 0.359 0.782
## extracurricular 1 80 80.02 0.570 0.451
## as.factor(grade_level):extracurricular 3 211 70.32 0.501 0.682
## Residuals 492 69123 140.49
# 76. Bartlett test for homogeneity of variances in post_test_score across study hour categories
study_hours_cat <- cut(education_dataset$hours_studied, breaks = c(0, 10, 15, 20),
labels = c("Low", "Medium", "High"))
bartlett.test(education_dataset$post_test_score ~ study_hours_cat)
##
## Bartlett test of homogeneity of variances
##
## data: education_dataset$post_test_score by study_hours_cat
## Bartlett's K-squared = 1.5434, df = 2, p-value = 0.4622
# 77. One-way ANOVA for improvement by teaching_method
education_dataset$improvement <- education_dataset$post_test_score - education_dataset$pre_test_score
anova_improvement_method <- aov(improvement ~ teaching_method, data = education_dataset)
summary(anova_improvement_method)
## Df Sum Sq Mean Sq F value Pr(>F)
## teaching_method 2 397 198.52 24.25 8.92e-11 ***
## Residuals 497 4068 8.19
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# 78. F-test for equality of variances between math_score and reading_score
# Note: This tests if the ratio of variances is 1
var.test(education_dataset$math_score, education_dataset$reading_score)
##
## F test to compare two variances
##
## data: education_dataset$math_score and education_dataset$reading_score
## F = 1.2931, num df = 499, denom df = 499, p-value = 0.004157
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 1.084801 1.541503
## sample estimates:
## ratio of variances
## 1.293145
# 79. One-way ANOVA for hours_studied across teaching_methods
anova_hours_method <- aov(hours_studied ~ teaching_method, data = education_dataset)
summary(anova_hours_method)
## Df Sum Sq Mean Sq F value Pr(>F)
## teaching_method 2 1 0.709 0.025 0.975
## Residuals 497 14046 28.262
# 80. Two-way ANOVA for reading_score by school_type and grade_level with interaction
anova_reading_interaction <- aov(reading_score ~ school_type * as.factor(grade_level),
data = education_dataset)
summary(anova_reading_interaction)
## Df Sum Sq Mean Sq F value Pr(>F)
## school_type 1 176 176.09 1.352 0.245
## as.factor(grade_level) 3 179 59.62 0.458 0.712
## school_type:as.factor(grade_level) 3 557 185.64 1.425 0.235
## Residuals 492 64076 130.24