Cassidy <- read.csv("Cassady.csv")
Model1.1 <- lm(GPA ~ CTA.tot + BStotal, Cassidy)
Model1.1
##
## Call:
## lm(formula = GPA ~ CTA.tot + BStotal, data = Cassidy)
##
## Coefficients:
## (Intercept) CTA.tot BStotal
## 3.61892 -0.02007 0.01347
summary(Model1.1)
##
## Call:
## lm(formula = GPA ~ CTA.tot + BStotal, data = Cassidy)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.99239 -0.29138 0.01516 0.36849 0.93941
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.618924 0.079305 45.633 < 2e-16 ***
## CTA.tot -0.020068 0.003065 -6.547 1.69e-10 ***
## BStotal 0.013469 0.005077 2.653 0.00828 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4852 on 426 degrees of freedom
## (57 observations deleted due to missingness)
## Multiple R-squared: 0.1066, Adjusted R-squared: 0.1024
## F-statistic: 25.43 on 2 and 426 DF, p-value: 3.706e-11
anova(Model1.1)
## Analysis of Variance Table
##
## Response: GPA
## Df Sum Sq Mean Sq F value Pr(>F)
## CTA.tot 1 10.316 10.3159 43.8125 1.089e-10 ***
## BStotal 1 1.657 1.6570 7.0376 0.00828 **
## Residuals 426 100.304 0.2355
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
attributes(Model1.1)
## $names
## [1] "coefficients" "residuals" "effects" "rank"
## [5] "fitted.values" "assign" "qr" "df.residual"
## [9] "na.action" "xlevels" "call" "terms"
## [13] "model"
##
## $class
## [1] "lm"
Model1.1$fitted.values
## 1 3 4 5 8 9 10 11
## 2.964641 3.125996 3.039668 3.125454 2.852730 3.152391 3.412460 3.011917
## 12 13 14 15 16 17 19 23
## 2.611103 3.158448 3.298923 3.312121 2.959938 3.205183 2.945928 2.904979
## 25 26 27 28 29 30 31 34
## 3.226064 3.245318 2.944573 3.171646 2.917635 3.198584 3.206267 3.073204
## 35 37 38 39 41 42 43 44
## 3.258787 3.118584 2.972594 2.870630 3.144980 3.285454 3.386064 2.871713
## 45 46 48 50 51 52 53 54
## 2.911849 3.166131 3.051511 3.251917 3.080345 3.131782 3.292053 3.138923
## 55 56 57 58 59 60 61 62
## 3.372324 3.372324 3.065521 3.212324 3.325590 3.093543 3.172459 2.918177
## 63 65 66 67 68 69 70 71
## 3.104844 2.985250 3.225251 3.245318 3.151849 2.937703 2.978109 3.058651
## 72 73 74 75 76 77 79 80
## 2.852188 3.011375 3.225251 3.253272 3.118313 3.292053 2.664979 2.998448
## 81 83 84 86 87 88 89 90
## 2.878041 2.737025 3.185928 3.232121 3.225793 3.106199 2.885995 2.978380
## 91 92 93 94 95 96 97 99
## 3.231850 3.111443 3.292053 2.924505 3.266741 3.192256 3.012730 3.053407
## 100 101 102 103 104 106 107 108
## 3.119126 3.053949 3.044912 2.997906 3.327757 3.058651 3.098245 2.985792
## 109 111 112 113 114 117 118 119
## 3.486674 2.898109 3.211782 3.185115 3.225793 3.199939 2.891781 3.191714
## 120 121 122 123 124 125 126 127
## 3.298923 3.118313 2.885453 3.091375 2.898651 3.118313 2.818922 3.019058
## 128 129 130 131 132 133 134 135
## 3.032256 2.937703 3.246673 3.084776 2.924234 2.797499 3.078448 2.891781
## 136 137 138 139 140 141 142 143
## 2.784843 2.925047 3.232121 3.158448 2.697160 2.978109 2.991578 2.965995
## 144 145 147 148 149 150 151 152
## 2.712255 2.924505 2.985521 3.139194 3.104844 3.111443 3.011104 2.817567
## 153 155 156 158 161 162 163 164
## 3.286538 3.366267 3.139194 3.091375 2.783759 3.271985 3.171917 3.265657
## 165 166 167 168 169 171 172 174
## 2.925047 2.985250 2.965453 3.104844 3.392392 3.131511 3.078448 3.205996
## 175 176 177 178 179 180 181 182
## 2.851646 3.073204 2.851375 2.964641 3.231850 3.292053 3.332460 2.980277
## 183 185 186 187 188 189 190 191
## 3.167215 2.737838 3.185115 3.118855 2.831307 3.004776 3.225793 3.231850
## 192 193 195 196 197 198 199 200
## 3.266199 3.111443 3.138652 3.040210 2.897838 3.144980 3.059464 3.332189
## 202 203 204 205 207 209 210 213
## 3.219194 2.892865 3.231850 3.058110 3.232392 3.205725 2.777973 3.132866
## 214 215 216 217 218 219 220 221
## 3.178516 3.238720 2.851104 3.171646 3.004505 3.251917 3.018787 2.925318
## 222 223 224 225 226 227 228 229
## 3.265386 2.991307 3.098787 3.126267 2.992391 3.151849 3.031172 3.025386
## 230 231 232 233 234 235 236 237
## 3.252188 3.158448 2.890968 3.426470 3.165047 2.925589 3.251917 3.225251
## 238 239 240 241 242 243 244 245
## 3.126267 3.191714 3.118313 2.957771 2.906063 3.258787 3.051511 2.972323
## 246 247 248 250 251 252 253 254
## 3.225251 3.151579 3.024573 3.365725 3.132053 2.911849 2.884369 3.252188
## 255 257 258 259 260 261 262 263
## 3.158448 2.818651 3.005318 3.112527 3.131782 3.225251 3.151579 3.205183
## 264 265 266 267 268 269 270 271
## 3.144980 3.125454 3.118584 3.238720 3.360210 2.984708 3.178787 2.811239
## 272 273 274 275 276 277 279 280
## 3.151579 3.205183 3.118313 3.365725 3.219465 3.278855 2.930833 3.004505
## 281 282 283 286 287 289 290 291
## 2.972052 3.111443 3.118313 3.238720 2.924234 3.312121 3.292053 3.038042
## 292 293 294 295 296 297 298 299
## 3.118313 2.803827 3.265657 3.192527 3.392392 2.777973 3.145792 3.105386
## 300 301 302 303 304 305 306 307
## 3.158448 3.086131 3.105386 3.271985 2.958854 2.931917 3.185928 3.158719
## 308 309 310 311 312 313 315 316
## 3.071307 3.011375 3.238991 3.238720 3.353069 2.944302 3.085047 3.392392
## 317 318 319 320 321 323 324 325
## 3.245589 3.171917 2.792526 3.125725 3.278855 3.259058 2.951172 2.817296
## 326 327 328 329 330 331 332 333
## 3.251917 3.111443 3.091917 3.234017 3.292053 3.285454 3.119126 3.231850
## 334 335 336 337 338 340 341 342
## 2.811239 3.305522 3.205183 3.212324 2.892323 3.165860 2.804640 3.386064
## 343 344 345 346 347 348 349 350
## 3.099329 3.399533 3.252188 3.091375 3.359126 2.838990 3.399533 3.392392
## 351 352 353 354 355 356 357 358
## 3.285454 3.392392 3.385793 3.098245 3.279397 3.018245 3.078448 3.372324
## 360 362 363 364 365 367 369 370
## 3.120210 3.251917 3.285725 3.111714 3.392663 3.339058 3.078448 3.191985
## 371 372 373 374 375 376 377 378
## 3.104844 3.231850 3.245318 2.730426 3.205725 3.245589 3.225251 3.025115
## 379 380 382 384 385 386 387 388
## 3.285725 3.064979 2.978109 2.977838 3.219465 3.138381 3.059193 2.992933
## 389 390 391 392 394 395 396 397
## 3.078177 2.958042 3.211782 2.998448 2.830494 3.131511 3.500414 3.379194
## 398 399 400 401 402 403 404 405
## 3.385793 3.172188 3.138652 3.386064 3.085589 3.005589 3.259600 3.352256
## 406 407 408 409 410 411 412 413
## 3.118584 3.372324 3.085047 3.191985 3.285454 3.312392 3.231850 3.159803
## 414 415 416 417 418 419 420 421
## 3.191714 3.258787 2.944573 3.124912 3.105115 3.211782 3.278855 3.399262
## 422 423 424 425 426 427 428 429
## 3.051240 3.025115 2.959396 3.199668 3.258787 3.266199 3.238720 3.392392
## 430 431 432 433 434 435 436 437
## 3.305522 3.178516 3.312121 3.238720 3.198584 3.272256 3.292053 3.206267
## 438 439 440 441 442 445 446 447
## 3.179329 3.365725 3.292053 3.372324 3.345657 3.158990 3.131511 3.071307
## 448 449 450 451 452 453 454 455
## 3.305793 3.171646 3.312121 3.071307 3.065521 3.339058 3.113069 3.426200
## 456 457 458 459 460 461 462 463
## 2.925860 3.231850 3.251917 2.984437 3.312392 2.931375 3.392392 3.379194
## 464 465 466 467 468 469 470 471
## 3.447080 3.198855 3.392392 3.379465 3.205454 3.412460 3.225251 3.305522
## 472 473 475 476 477 478 479 480
## 3.091375 3.392392 3.024573 3.318991 3.392392 3.425929 3.386064 3.459736
## 481 482 483 484 485
## 3.199397 3.312121 3.192256 2.864031 3.245318
Model1.1$residuals
## 1 3 4 5 8
## -0.4646405061 -0.3259956916 -0.7896675749 -0.0254537419 0.4492704297
## 9 10 11 12 13
## -0.0283914353 -0.1124596847 -0.5119169570 0.0888967457 -0.6584484215
## 14 15 16 17 19
## -0.7989228998 -0.4221207716 -0.5799383942 -0.3051829226 -0.1459275978
## 23 25 26 27 28
## -0.8649791080 0.0989363702 -0.2453184879 -0.4445727235 0.7783537067
## 29 30 31 34 35
## -0.8176350301 0.1014160133 0.3937331779 -0.1232042042 0.3412126654
## 37 38 39 41 42
## 0.4814161689 0.9394056837 -0.6706295541 -0.5449795748 -0.4194540531
## 43 44 45 46 48
## -0.4960639410 -0.0717134535 -0.4118490187 0.4338687432 0.7484894275
## 50 51 52 53 54
## 0.4480825762 0.1496549101 -0.3317817030 -0.0920529890 0.1910774114
## 55 56 57 58 59
## 0.4276758805 0.6276758805 0.5244786311 0.0156761917 0.3744103817
## 60 61 62 63 65
## 0.7564570383 0.2275407821 0.1818230202 0.1951559904 -0.0142502384
## 66 67 68 69 70
## -0.2252507053 -0.3453184879 0.0481505144 -0.1377028127 -0.7281093528
## 71 72 73 74 75
## -0.5586514581 0.3478123794 -0.1113750073 0.5747492947 0.1467277019
## 76 77 79 80 81
## 0.2116871437 0.1579470110 -0.0849786411 0.6015518897 -0.0780414146
## 83 84 86 87 88
## 0.2209750135 -0.8859280646 0.3778793840 0.6642073450 -0.6061988838
## 89 90 91 92 93
## -0.0859952248 -0.0783803277 -0.4318496412 -0.6114429455 -0.1220529890
## 94 95 96 97 99
## -0.9245049409 0.1932588552 -0.1922560257 -0.1127298815 -0.1534073965
## 100 101 102 103 104
## 0.6808742192 -0.0539493462 -0.2449116366 0.1020938394 -0.6277574172
## 106 107 108 109 111
## 0.3413485419 0.4017549264 0.0142078119 -0.4866738290 0.0018908028
## 112 113 114 117 118
## -0.5017818586 0.5148848600 -0.3257926550 -0.4999388610 -0.6417812361
## 119 120 121 122 123
## 0.4682859240 0.2010771002 -0.2183128563 0.1145467249 0.8086248371
## 124 125 126 127 128
## -0.9986511469 0.1816871437 -0.3189219661 -0.0190578426 -0.5322557144
## 129 130 131 132 133
## -0.7877028127 0.0533266379 -0.7507762269 -0.4742339660 0.4025006907
## 134 135 136 137 138
## -0.0784482659 -0.1917812361 0.0151566129 0.3749531094 -0.1321206160
## 139 140 141 142 143
## 0.6415515785 0.0028396038 0.2218906472 0.8304218005 0.0340046196
## 144 145 147 148 149
## 0.7877449080 -0.9245049409 0.5904787867 -0.2391935634 -0.5048440096
## 150 151 152 153 155
## 0.0885570545 -0.5111040324 0.2824329081 -0.2865379525 0.1297328667
## 156 158 161 162 163
## 0.2608064366 -0.2913751629 0.9212405123 0.2280147936 -0.3719172682
## 164 165 166 167 168
## 0.3343427547 0.2749531094 -0.3852502384 -0.5654534307 0.6951559904
## 169 171 172 174 175
## -0.8923919021 0.0684892719 -1.0784482659 -0.6409958472 -0.1516456709
## 176 177 178 179 180
## 0.4267957958 0.1486253040 0.0353594939 -0.4318496412 -0.0920529890
## 181 182 183 185 186
## -0.0324595291 0.6197228484 -0.1672151562 -0.0378379111 -0.1851151400
## 187 188 189 190 191
## 0.3811451940 0.5016930866 0.6452239287 0.5342073450 -0.0318496412
## 192 193 195 196 197
## 0.0338008049 -0.4114429455 0.5313483863 -1.0402095246 -0.3978382223
## 198 199 200 202 203
## -0.4449795748 -0.0374643827 -0.1321885543 -1.3191937190 -0.1778651355
## 204 205 207 209 210
## -0.5318496412 -0.0781095084 -0.9323915909 0.4942751276 -0.0779734763
## 213 214 215 216 217
## -0.1328656024 -0.8785162041 0.3612804480 -0.4511037212 0.4283537067
## 218 219 220 221 222
## -0.0045050965 0.1580825762 0.1812131323 -0.0423178654 0.3346137295
## 223 224 225 226 227
## 0.1086927754 -0.0987870234 -0.6262666665 -2.9923911241 -0.6168494856
## 228 229 230 231 232
## 0.2688281850 0.4746141963 0.3478116013 0.1415515785 -0.5909683116
## 233 234 235 236 237
## -0.7264704811 -0.0650473574 0.0644111597 -1.1519174238 -0.9252507053
## 238 239 240 241 242
## -0.9262666665 -0.1917140760 -0.0183128563 0.0422294047 0.2939369926
## 243 244 245 246 247
## -0.2587873346 -0.0715105725 -0.1723233414 0.0747492947 -0.2515785107
## 248 250 251 252 253
## 0.0754271209 -0.4657251836 0.1679473222 -0.2118490187 0.2156306244
## 254 255 257 258 259
## 0.2178116013 0.2415515785 0.5813490087 0.1946819790 0.3764731551
## 260 261 262 263 264
## 0.3682182970 0.1747492947 -0.3785785107 -0.1051829226 0.7210204252
## 265 266 267 268 269
## -0.6254537419 -0.9185838311 -0.0387195520 -0.1602101471 0.5152917113
## 270 271 272 273 274
## 0.0912128210 -0.5112391308 0.4484214893 -0.9051829226 -0.6183128563
## 275 276 277 279 280
## -0.9657251836 -0.6194646939 0.5211448828 0.0691670981 -0.2045050965
## 281 282 283 286 287
## 0.9279476334 0.3485570545 -0.0183128563 0.2112804480 -0.4242339660
## 289 290 291 292 293
## -0.6121207716 -1.4920529890 -0.2380417258 -0.1183128563 0.1761727297
## 294 295 296 297 298
## -0.7656572453 -1.1925270005 0.0486080979 -0.7779734763 0.3542075006
## 299 300 301 302 303
## -0.6353859593 0.5915515785 0.2438688988 -0.0053859593 -0.1719852064
## 304 305 306 307 308
## 0.3411455053 0.0680831986 -0.6859280646 0.2412806037 -0.5713073803
## 309 310 311 312 313
## -0.1493750073 -0.0389905268 -0.1387195520 0.2969307386 -0.1443017486
## 315 316 317 318 319
## 0.2149527982 -0.3923919021 0.0544105373 0.4980827318 0.4074737775
## 320 321 323 324 325
## -0.0257247167 -0.3988551172 0.0409416906 0.0358283406 0.5827038830
## 326 327 328 329 330
## 0.0480825762 0.7885570545 0.7080828874 0.2099825600 0.4679470110
## 331 332 333 334 335
## -0.2854540531 0.4608742192 -0.3418496412 0.2887608692 0.1944781643
## 336 337 338 340 341
## -0.4551829226 -0.2123238083 0.1076768142 -0.1858602820 -0.6366401949
## 342 343 344 345 346
## 0.3959360590 0.0006710269 0.3334672123 0.6478116013 0.5786248371
## 347 348 349 350 351
## 0.4408737523 -0.0389897488 -0.1995327877 -0.4923919021 0.2145459469
## 352 353 354 355 356
## 0.1076080979 0.2372070338 -0.4982450736 0.6806029331 0.4717550820
## 357 358 360 362 363
## 0.5275517341 -0.2723241195 0.5797903198 0.6680825762 -0.2857250280
## 364 365 367 369 370
## -0.1117139203 -0.1926628770 0.0809415350 0.2215517341 -0.4419850508
## 371 372 373 374 375
## 0.5951559904 -0.0238496412 0.2546815121 0.4095739494 -0.5057248724
## 376 377 378 379 380
## 0.3544105373 -0.3252507053 -0.3251148288 -1.0857250280 -0.1649794192
## 382 384 385 386 387
## -0.0881093528 -0.0278383779 0.2805353061 0.7716193611 0.7408065922
## 388 389 390 391 392
## 0.3070669262 -0.0781772910 -0.1580415702 -0.4117818586 0.5675518897
## 394 395 396 397 398
## 0.1695060111 0.3684892719 -0.0004136505 0.2208059697 0.2142070338
## 399 400 401 402 403
## 0.4078117570 0.5613483863 0.5139360590 0.0504108485 0.6944110041
## 404 405 406 407 408
## -0.1496002591 -0.0522563369 -0.5185838311 -0.0723241195 0.7149527982
## 409 410 411 412 413
## -0.1919850508 0.7145459469 -0.1123917465 0.1681503588 -0.0598032958
## 414 415 416 417 418
## -0.4917140760 0.0412126654 0.2554272765 -0.5249117922 -0.2051149844
## 419 420 421 422 423
## 0.2832181414 0.3211448828 -0.0992618129 0.5487604024 0.2748851712
## 424 425 426 427 428
## 0.6376035555 0.7003321139 -0.7587873346 0.1338008049 0.5612804480
## 429 430 431 432 433
## 0.0066080979 -0.0055218357 0.5214837959 0.1878792284 0.2612804480
## 434 435 436 437 438
## -0.2085839867 0.4747438187 0.4969470110 -0.9062668221 0.5206708713
## 439 440 441 442 445
## -0.2257251836 -0.1820529890 0.0276758805 0.5543425990 0.6310096288
## 446 447 448 449 450
## 0.0014892719 0.1286926197 0.4442071894 -0.1716462933 -0.5121207716
## 451 452 453 454 455
## -0.3713073803 0.1534786311 0.2609415350 0.6369312054 0.5338004937
## 456 457 458 459 460
## 0.5741401849 -0.0318496412 0.2480825762 -0.2844373139 0.4876082535
## 461 462 463 464 465
## 0.7686251484 0.4076080979 0.4208059697 -0.4470802135 0.8011450384
## 466 467 468 469 470
## 0.4076080979 -0.5484650051 0.6945461025 0.4505403153 0.7047492947
## 471 472 473 475 476
## 0.6804781643 0.4856248371 0.5776080979 0.8434271209 -0.0189906824
## 477 478 479 480 481
## -0.0923919021 0.5740714686 0.4139360590 0.5202638644 -0.2993969113
## 482 483 484 485
## 0.6018792284 0.8077439743 0.0359693818 -0.7453184879
Model1.2 <- lm(GPA ~ CTA.tot + BStotal + CTA.tot*BStotal, Cassidy)
Model1.2
##
## Call:
## lm(formula = GPA ~ CTA.tot + BStotal + CTA.tot * BStotal, data = Cassidy)
##
## Coefficients:
## (Intercept) CTA.tot BStotal CTA.tot:BStotal
## 3.8977792 -0.0267935 -0.0057595 0.0004328
summary(Model1.2)
##
## Call:
## lm(formula = GPA ~ CTA.tot + BStotal + CTA.tot * BStotal, data = Cassidy)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.98711 -0.29737 0.01801 0.36340 0.95016
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.8977792 0.2307491 16.892 < 2e-16 ***
## CTA.tot -0.0267935 0.0060581 -4.423 1.24e-05 ***
## BStotal -0.0057595 0.0157812 -0.365 0.715
## CTA.tot:BStotal 0.0004328 0.0003364 1.287 0.199
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4849 on 425 degrees of freedom
## (57 observations deleted due to missingness)
## Multiple R-squared: 0.1101, Adjusted R-squared: 0.1038
## F-statistic: 17.53 on 3 and 425 DF, p-value: 9.558e-11
Model1.3 <- lm(GPA~CTA.tot + Male, Cassidy)
summary(Model1.3)
##
## Call:
## lm(formula = GPA ~ CTA.tot + Male, data = Cassidy)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.01149 -0.29005 0.03038 0.35374 0.96294
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.740318 0.080940 46.211 < 2e-16 ***
## CTA.tot -0.015184 0.002117 -7.173 3.16e-12 ***
## Male -0.222594 0.047152 -4.721 3.17e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4775 on 437 degrees of freedom
## (46 observations deleted due to missingness)
## Multiple R-squared: 0.1364, Adjusted R-squared: 0.1324
## F-statistic: 34.51 on 2 and 437 DF, p-value: 1.215e-14
Model1.4 <- lm(GPA~CTA.tot + Gender, Cassidy)
summary(Model1.4)
##
## Call:
## lm(formula = GPA ~ CTA.tot + Gender, data = Cassidy)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.01149 -0.29005 0.03038 0.35374 0.96294
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.962912 0.104741 37.835 < 2e-16 ***
## CTA.tot -0.015184 0.002117 -7.173 3.16e-12 ***
## Gender -0.222594 0.047152 -4.721 3.17e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4775 on 437 degrees of freedom
## (46 observations deleted due to missingness)
## Multiple R-squared: 0.1364, Adjusted R-squared: 0.1324
## F-statistic: 34.51 on 2 and 437 DF, p-value: 1.215e-14
library(car)
residualPlots(Model1.1)

## Test stat Pr(>|t|)
## CTA.tot 1.108 0.268
## BStotal 0.597 0.551
## Tukey test 0.499 0.618
library(lme4)
## Loading required package: Matrix
library(nlme)
##
## Attaching package: 'nlme'
## The following object is masked from 'package:lme4':
##
## lmList
Achieve <- read.csv ("Achieve.csv")
Model3.0 <- lme( fixed = geread~1, random = ~1|school, data = Achieve)
summary(Model3.0)
## Linear mixed-effects model fit by REML
## Data: Achieve
## AIC BIC logLik
## 46274.31 46296.03 -23134.15
##
## Random effects:
## Formula: ~1 | school
## (Intercept) Residual
## StdDev: 0.6257119 2.24611
##
## Fixed effects: geread ~ 1
## Value Std.Error DF t-value p-value
## (Intercept) 4.306753 0.05497501 10160 78.3402 0
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -2.3229469 -0.6377948 -0.2137753 0.2849664 3.8811630
##
## Number of Observations: 10320
## Number of Groups: 160
ICC <- 0.6257119/(0.6257119+2.24611)
ICC
## [1] 0.2178798
Model3.1 <- lme( fixed = geread~gevocab, random = ~1|school, data = Achieve)
Model3.1
## Linear mixed-effects model fit by REML
## Data: Achieve
## Log-restricted-likelihood: -21568.6
## Fixed: geread ~ gevocab
## (Intercept) gevocab
## 2.0233559 0.5128977
##
## Random effects:
## Formula: ~1 | school
## (Intercept) Residual
## StdDev: 0.3158785 1.94074
##
## Number of Observations: 10320
## Number of Groups: 160
summary(Model3.1)
## Linear mixed-effects model fit by REML
## Data: Achieve
## AIC BIC logLik
## 43145.2 43174.17 -21568.6
##
## Random effects:
## Formula: ~1 | school
## (Intercept) Residual
## StdDev: 0.3158785 1.94074
##
## Fixed effects: geread ~ gevocab
## Value Std.Error DF t-value p-value
## (Intercept) 2.0233559 0.04930868 10159 41.03447 0
## gevocab 0.5128977 0.00837268 10159 61.25850 0
## Correlation:
## (Intr)
## gevocab -0.758
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.0822506 -0.5734728 -0.2103488 0.3206692 4.4334337
##
## Number of Observations: 10320
## Number of Groups: 160
Model3.2 <- lme( fixed = geread~gevocab + senroll, random = ~1|school, data = Achieve)
summary(Model3.2)
## Linear mixed-effects model fit by REML
## Data: Achieve
## AIC BIC logLik
## 43162.1 43198.31 -21576.05
##
## Random effects:
## Formula: ~1 | school
## (Intercept) Residual
## StdDev: 0.3167654 1.94076
##
## Fixed effects: geread ~ gevocab + senroll
## Value Std.Error DF t-value p-value
## (Intercept) 2.0748819 0.11400758 10159 18.19951 0.0000
## gevocab 0.5128708 0.00837340 10159 61.25000 0.0000
## senroll -0.0001026 0.00020511 158 -0.50012 0.6177
## Correlation:
## (Intr) gevocb
## gevocab -0.327
## senroll -0.901 -0.002
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.0834462 -0.5728938 -0.2103480 0.3212091 4.4335881
##
## Number of Observations: 10320
## Number of Groups: 160
Model3.3 <- lme( fixed = geread~gevocab, random = ~gevocab|school, data = Achieve)
Model3.3
## Linear mixed-effects model fit by REML
## Data: Achieve
## Log-restricted-likelihood: -21496.43
## Fixed: geread ~ gevocab
## (Intercept) gevocab
## 2.0057064 0.5203554
##
## Random effects:
## Formula: ~gevocab | school
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 0.5316531 (Intr)
## gevocab 0.1389443 -0.859
## Residual 1.9146626
##
## Number of Observations: 10320
## Number of Groups: 160
summary(Model3.3)
## Linear mixed-effects model fit by REML
## Data: Achieve
## AIC BIC logLik
## 43004.85 43048.3 -21496.43
##
## Random effects:
## Formula: ~gevocab | school
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 0.5316531 (Intr)
## gevocab 0.1389443 -0.859
## Residual 1.9146626
##
## Fixed effects: geread ~ gevocab
## Value Std.Error DF t-value p-value
## (Intercept) 2.0057064 0.06108786 10159 32.83314 0
## gevocab 0.5203554 0.01441548 10159 36.09699 0
## Correlation:
## (Intr)
## gevocab -0.866
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.7102091 -0.5674433 -0.2074358 0.3176380 4.6774569
##
## Number of Observations: 10320
## Number of Groups: 160
Model3.4 <- lme(fixed = geread~gevocab + age, random = ~gevocab + age|school, data = Achieve)
summary(Model3.4)
## Linear mixed-effects model fit by REML
## Data: Achieve
## AIC BIC logLik
## 43015.77 43088.18 -21497.88
##
## Random effects:
## Formula: ~gevocab + age | school
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 0.492487773 (Intr) gevocb
## gevocab 0.137976606 -0.073
## age 0.006387997 -0.649 -0.601
## Residual 1.914030473
##
## Fixed effects: geread ~ gevocab + age
## Value Std.Error DF t-value p-value
## (Intercept) 2.9614055 0.4151887 10158 7.13267 0.0000
## gevocab 0.5191496 0.0143563 10158 36.16175 0.0000
## age -0.0088390 0.0038396 10158 -2.30208 0.0214
## Correlation:
## (Intr) gevocb
## gevocab -0.095
## age -0.989 -0.032
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.6805531 -0.5687008 -0.2091071 0.3180583 4.6850735
##
## Number of Observations: 10320
## Number of Groups: 160
Model3.5 <- lme(fixed = geread~gevocab + age + gevocab*age, random = ~1|school, data = Achieve)
Model3.6 <- lme( fixed = geread~gevocab + senroll + gevocab*senroll, random = ~1|school, data = Achieve)
summary(Model3.5)
## Linear mixed-effects model fit by REML
## Data: Achieve
## AIC BIC logLik
## 43155.49 43198.94 -21571.75
##
## Random effects:
## Formula: ~1 | school
## (Intercept) Residual
## StdDev: 0.3142524 1.939708
##
## Fixed effects: geread ~ gevocab + age + gevocab * age
## Value Std.Error DF t-value p-value
## (Intercept) 5.187208 0.8667857 10157 5.984418 0.0000
## gevocab -0.028078 0.1881452 10157 -0.149233 0.8814
## age -0.029368 0.0080348 10157 -3.655077 0.0003
## gevocab:age 0.005027 0.0017496 10157 2.873204 0.0041
## Correlation:
## (Intr) gevocb age
## gevocab -0.879
## age -0.998 0.879
## gevocab:age 0.877 -0.999 -0.879
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.0635106 -0.5706179 -0.2108349 0.3190991 4.4467448
##
## Number of Observations: 10320
## Number of Groups: 160
summary(Model3.6)
## Linear mixed-effects model fit by REML
## Data: Achieve
## AIC BIC logLik
## 43175.57 43219.02 -21581.79
##
## Random effects:
## Formula: ~1 | school
## (Intercept) Residual
## StdDev: 0.316492 1.940268
##
## Fixed effects: geread ~ gevocab + senroll + gevocab * senroll
## Value Std.Error DF t-value p-value
## (Intercept) 1.7477004 0.17274011 10158 10.117513 0.0000
## gevocab 0.5851202 0.02986497 10158 19.592189 0.0000
## senroll 0.0005121 0.00031863 158 1.607242 0.1100
## gevocab:senroll -0.0001356 0.00005379 10158 -2.519975 0.0118
## Correlation:
## (Intr) gevocb senrll
## gevocab -0.782
## senroll -0.958 0.735
## gevocab:senroll 0.752 -0.960 -0.766
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.1228018 -0.5697103 -0.2090374 0.3187827 4.4358936
##
## Number of Observations: 10320
## Number of Groups: 160
Cgevocab <- Achieve$gevocab - mean(Achieve$gevocab)
Cage <- Achieve$age - mean(Achieve$age)
Model3.5.C <- lme( fixed = geread~Cgevocab + Cage + Cgevocab*Cage, random = ~1|school, data = Achieve)
summary(Model3.5.C)
## Linear mixed-effects model fit by REML
## Data: Achieve
## AIC BIC logLik
## 43155.49 43198.94 -21571.75
##
## Random effects:
## Formula: ~1 | school
## (Intercept) Residual
## StdDev: 0.3142524 1.939708
##
## Fixed effects: geread ~ Cgevocab + Cage + Cgevocab * Cage
## Value Std.Error DF t-value p-value
## (Intercept) 4.332326 0.03206185 10157 135.12403 0.0000
## Cgevocab 0.512480 0.00837950 10157 61.15878 0.0000
## Cage -0.006777 0.00391727 10157 -1.72999 0.0837
## Cgevocab:Cage 0.005027 0.00174965 10157 2.87320 0.0041
## Correlation:
## (Intr) Cgevcb Cage
## Cgevocab 0.008
## Cage 0.007 0.053
## Cgevocab:Cage 0.043 0.021 0.205
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.0635106 -0.5706179 -0.2108349 0.3190991 4.4467448
##
## Number of Observations: 10320
## Number of Groups: 160
Model3.7 <- lmer(geread~gevocab +(1|school), data = Achieve)
Model3.7
## Linear mixed model fit by REML ['lmerMod']
## Formula: geread ~ gevocab + (1 | school)
## Data: Achieve
## REML criterion at convergence: 43137.2
## Random effects:
## Groups Name Std.Dev.
## school (Intercept) 0.3159
## Residual 1.9407
## Number of obs: 10320, groups: school, 160
## Fixed Effects:
## (Intercept) gevocab
## 2.0234 0.5129
library(lmerTest)
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
summary(Model3.7)
## Linear mixed model fit by REML ['lmerMod']
## Formula: geread ~ gevocab + (1 | school)
## Data: Achieve
##
## REML criterion at convergence: 43137.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0823 -0.5735 -0.2103 0.3207 4.4334
##
## Random effects:
## Groups Name Variance Std.Dev.
## school (Intercept) 0.09978 0.3159
## Residual 3.76647 1.9407
## Number of obs: 10320, groups: school, 160
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 2.023356 0.049309 41.03
## gevocab 0.512898 0.008373 61.26
##
## Correlation of Fixed Effects:
## (Intr)
## gevocab -0.758
anova(Model3.7)
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## gevocab 1 14134 14134 3752.6
Model3.8 <- lmer( geread~gevocab + senroll +(1|school), data = Achieve)
Model3.8
## Linear mixed model fit by REML ['merModLmerTest']
## Formula: geread ~ gevocab + senroll + (1 | school)
## Data: Achieve
## REML criterion at convergence: 43152.1
## Random effects:
## Groups Name Std.Dev.
## school (Intercept) 0.3168
## Residual 1.9408
## Number of obs: 10320, groups: school, 160
## Fixed Effects:
## (Intercept) gevocab senroll
## 2.0748819 0.5128708 -0.0001026
summary(Model3.8)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
## to degrees of freedom [lmerMod]
## Formula: geread ~ gevocab + senroll + (1 | school)
## Data: Achieve
##
## REML criterion at convergence: 43152.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0834 -0.5729 -0.2103 0.3212 4.4336
##
## Random effects:
## Groups Name Variance Std.Dev.
## school (Intercept) 0.1003 0.3168
## Residual 3.7665 1.9408
## Number of obs: 10320, groups: school, 160
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 2.075e+00 1.140e-01 2.370e+02 18.20 <2e-16 ***
## gevocab 5.129e-01 8.373e-03 9.798e+03 61.25 <2e-16 ***
## senroll -1.026e-04 2.051e-04 1.650e+02 -0.50 0.618
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) gevocb
## gevocab -0.327
## senroll -0.901 -0.002
anova(Model3.8)
## Analysis of Variance Table of type III with Satterthwaite
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## gevocab 14130.4 14130.4 1 9798.1 3751.6 <2e-16 ***
## senroll 0.9 0.9 1 165.2 0.3 0.6177
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Model3.9 <- lmer(geread~gevocab + (gevocab|school), data = Achieve)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
Model3.9
## Linear mixed model fit by REML ['merModLmerTest']
## Formula: geread ~ gevocab + (gevocab | school)
## Data: Achieve
## REML criterion at convergence: 43051.37
## Random effects:
## Groups Name Std.Dev. Corr
## school (Intercept) 0.00000
## gevocab 0.07672 NaN
## Residual 1.92909
## Number of obs: 10320, groups: school, 160
## Fixed Effects:
## (Intercept) gevocab
## 2.0251 0.5103
## convergence code 0; 2 optimizer warnings; 0 lme4 warnings
Model3.10 <- lmer( geread~gevocab + age+(gevocab + age|school), Achieve)
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
Model3.10
## Linear mixed model fit by REML ['merModLmerTest']
## Formula: geread ~ gevocab + age + (gevocab + age | school)
## Data: Achieve
## REML criterion at convergence: 42996.65
## Random effects:
## Groups Name Std.Dev. Corr
## school (Intercept) 0.95414
## gevocab 0.13759 0.11
## age 0.01005 -0.87 -0.51
## Residual 1.91385
## Number of obs: 10320, groups: school, 160
## Fixed Effects:
## (Intercept) gevocab age
## 2.96893 0.51924 -0.00891
## convergence code 1; 2 optimizer warnings; 0 lme4 warnings
Model3.12 <- lme( fixed = geread~gevocab, random = ~1|school, data = Achieve, method = "ML")
Model3.13 <- lmer( geread~gevocab + (1|school), data = Achieve, REML = FALSE)
Model3.14 <- lme( fixed = geread~gevocab, random = ~1|school, data = Achieve, method = "ML", control = list(maxIter = 100, opt = "optim"))
Model3.1 <- lme( fixed = geread~gevocab, random = ~1|school, data = Achieve, method = "ML")
Model3.2 <- lme( fixed = geread~gevocab + senroll, random = ~1|school, data = Achieve, method = "ML")
anova(Model3.1, Model3.2)
## Model df AIC BIC logLik Test L.Ratio p-value
## Model3.1 1 4 43132.43 43161.40 -21562.22
## Model3.2 2 5 43134.18 43170.39 -21562.09 1 vs 2 0.2550617 0.6135
intervals(Model3.3)
## Approximate 95% confidence intervals
##
## Fixed effects:
## lower est. upper
## (Intercept) 1.8859621 2.0057064 2.1254506
## gevocab 0.4920982 0.5203554 0.5486126
## attr(,"label")
## [1] "Fixed effects:"
##
## Random Effects:
## Level: school
## lower est. upper
## sd((Intercept)) 0.4250700 0.5316531 0.6649611
## sd(gevocab) 0.1153701 0.1389443 0.1673356
## cor((Intercept),gevocab) -0.9178709 -0.8585096 -0.7615768
##
## Within-group standard error:
## lower est. upper
## 1.888327 1.914663 1.941365