Skip to main content

LA_a

Page 1


Exploring Income Group Differences in Book Ownership, Reading Practices, and Frequency of Bookstore and Library Visits

Karen E. Ballengee

University of North Dakota

EFR 513: Large Dataset Management

Dr. Steven LeMire

July 13, 2025

Data set:

NATIONAL CENTER FOR EDUCATION STATISTICS

NHES_19_ECPP_V1_0.csv

Results.

The following results examine how annual household income relates to reading-related behaviors that pertain to children, such as book ownership, reading practices, bookstore visits, and library visits. Using four guiding questions, this section employs a statistical analysis to compare households with annual incomes above and below $30,000. The analysis revealed that a substantial portion of households fell into the above $30,000 category. The participants in the households earning more than $30,000 were more likely to have visited a library or a bookstore, or both, in the past month, and their children tended to own more books. In contrast, guardians in the below $30,000 income households averaged more time spent reading to their child than those in the above $30,000 group

Question 1: What percentage of households reported an annual income above or below $30,000?

Table 1 shows that of the 7,092 participants, 81.9% reported a yearly household income above $30,000, while 18.1% reported a household income below $30,000.

1

Question 2: What percentage of each income group visited a library in the past month, took their child to a bookstore in the past month, or did both?

Table 2 shows that the income group that earned above $30,000 had a higher percentage who visited a library, a bookstore, or both in the past month.

Table

Table 2

Percentage of Each Group Who Visited a Library, a Bookstore, or Both in the Past Month

Question 3: What is the relationship between annual household income and the number of books the child owns?

Both groups have a range of 999 books owned, with each group having numerous outliers above the 100th percentile (Figure 1). For both groups, the mean is higher than the median (Table 3), which suggests that the outliers may be pulling up the mean to skew the data to the right. The interquartile range of the above $30,000 group is larger and shows more variability than the interquartile range of the below $30,000 group. The income group that made above $30,000 owned M=75.61 books, while those with an income below $30,000 owned M=35.97 books. This was found to be statistically significant, t(2566.2) =18.758, p <.001.

Table 3

Summary Statistics for Household Income and Number of Books Owned

Number of Books Owned by Income Group

Question 4: What is the relationship between annual household income and the number of minutes that the guardian spent reading to the child?

The mean number of minutes is higher in the under $30,000 income group, and both groups have outliers above the 100th percentile. The mean and median for the above $30,000 group are almost identical, suggesting that the data is symmetrical. While the mean is higher than the median for the group that earns below $30,000, which may indicate that outliers are causing a skew to the right. The above $30,000 group has a larger range, which suggests more variability.

The guardians in the income group that made above $30,000 spent M=15.248 minutes reading to their child, while the guardians in the income group below $30,000 spent M=18.013 minutes reading to their child. This was found to be statistically significant, t (1348.9) =-6.4116, p <.001.

Table 4

Summary Statistics for Household Income and Number of Minutes Read to the Child

Figure 2

Minutes Spent Reading to the Child by Income Group

This analysis explored the link between household income and four key reading-related behaviors of bookstore and library visits, book ownership, and reading practices. By comparing households with annual incomes above and below $30,000, four meaningful observations were made:

• A majority of the participants (81.9%) reported household incomes above $30,000.

• The group making above $30,000 was more likely in the past month to have visited a library (34.3%), a bookstore (26.8%), or both (13.2%).

• The children in the households making above $30,000 owned more books (M=75.61) than the children in households making below $30,000 (M=35.97).

• The guardians in the below $30,000 group reported that they spent more time reading to their children (M=18.013) compared to the above $30,000 guardians (M=15.248).

It is important to note that all responses were self-reported, which may reflect inaccuracies in the data. For further inquiry, it may be beneficial to investigate the access gaps in library and bookstore visitation rates to determine potential barriers faced by the below $30,000 income group, such as financial barriers, transportation barriers, or lack of community resources.

It would also be crucial to explore book ownership patterns to determine if income limits access to book ownership or if any other variables explain why children in households that earn below $30,000 own fewer books. Additionally, the reading time of the group below $30,000 needs to be examined to determine the quality, frequency, and outcome of the amount of time the guardian spent reading to the child. These findings can help inform interventions to increase library and/or bookstore visits, increase the number of books owned, and maintain or improve the quality of time spent reading to the child.

Total Household income File: ecpp

Name: TTLHHINC

Position: 419

Length: 2

Label: 143. Total income

Description:

143. Which category best fits the total income of all persons in your household over the past 12 months?

Minutes Spent Reading to child File: ecpp

Name: FORDDAYX

Position: 241

Length: 2

Label: 72. Minutes spent each time reading to child

Description: 72. About how many minutes on each of those times did you or someone in your family read to this child?

Number of books the child owns File: ecpp

Name: HABOOKS Position: 236 Length: 3

Label: 70. Books child owns File: ecpp Name: HABOOKS Position: 236 Length: 3

Label: 70. Books child owns

Description:

70. About how many books does this child have of his/her own, including those shared with brothers or sisters?

Time spent reading to the child

File: ecpp Name: DRELOR Position: 239 Length: 2

Label: 71. Time spent reading to child

Description:

71. How many times have you or someone in your family read to this child in the past week?

Visited a library in the last month File: ecpp

Name: FOLIBRAY Position: 248

Length: 1

Label: 75. Visited a library in the past month

Description:

Visited a bookstore in the past month File: ecpp Name: FOBOOKST Position: 249 Length: 1

Label: 76. Visited a bookstore in the past month

Description:

7,092 21,242,044.00 100.00

Appendix B

R Code

setwd("C:/Users/karen/Desktop/EFR 513/Final")

> LCD <-read.csv("NHES19.csv",header=TRUE)

> dim(LCD)

[1] 7092 625

> attributes(LCD)

$names

[1] "BASMID" "RCNOW" "RCWEEK" "RCTYPE"

[5] "RCAGE" "RCPLACE" "RCTIME" "RCDAYS"

[9] "RCHRS" "RCCVRWK" "RCSTRTY" "RCSTRTM"

[13] "RCSPEAK" "RCSKNFV" "RCSKFV" "RCOTCH"

[17] "RCFEE" "RCREL" "RCTANF" "RCSSAC"

[21] "RCEMPL" "RCOTHER" "RCCOST" "RCUNIT"

[25] "RCCSTHNX" "RCOTHC" "RCTLHR" "NCNOW"

[29] "NCWEEK" "NCINHH" "NCPLACE" "NCTIME"

[33] "NCDAYS" "NCHRS" "NCCVRWK" "NCSTRTY"

[37] "NCSTRTM" "NCALKNE" "NCAGE" "NCSPEAK"

[41] "NCSKNFV" "NCSKFV" "NCOTCH" "NCRCMDPT"

[45] "NCFEE" "NCREL" "NCTANF" "NCSSAC"

[49] "NCEMPL" "NCOTHER" "NCCOST" "NCUNIT"

[53] "NCCSTHNX" "NCOTHC" "NCTLHR" "CPNNOWX"

[57] "CPWEEKX" "CPPLACEX" "CPSPRLG" "CPWORK"

[61] "CPHEADST" "CPDAYS" "CPHRS" "CPCVRWK"

[65] "CPSTRTY" "CPSTRTM" "CPSPEAK" "CPTIME"

[69] "CPRCMDPT" "CPTEST" "CPPHYSE" "CPDENTA"

[73] "CPDISAB" "CPMEDAM" "CPSKNFV" "CPSKFV"

[77] "CPFEE" "CPREL" "CPTANF" "CPSSAC"

[81] "CPEMPL" "CPOTHER" "CPCOST" "CPUNIT"

[85] "CPCSTHNX" "CPOTHC" "CPTLHR" "PCEVRHDX"

[89] "MAINRESN" "PPCHOIC" "CRSRCH" "PPDIFCLT"

[93] "WHYDIFCLT" "CCPY" "CCREASN1" "CCREASN2" [97] "CCREASN3" "CCREASN4" "CCREASN5" "DCLOA"

[101] "DCOST" "DRELY" "DLERN" "DCHIL"

[105] "DHROP" "DNBGRP" "DRTWEB" "DRECFAM"

[109] "DQUAL" "DRELOR" "HABOOKS" "FOREADTOX"

[113] "FORDDAYX" "FOSTORYX" "FOWORDSX" "FOSANG"

[117] "FOCRAFTSX" "FODINNERX" "FOLIBRAY" "FOBOOKST"

[121] "DPIAGE" "DPLETTER" "DPNAME" "DPLTRSND"

[125] "DPEXPLN" "DPCOUNT" "DPSHAPE" "HDHEALTH"

[129] "HDINTDIS" "HDSPEECHX" "HDDISTRBX" "HDDEAFIMX"

[133] "HDBLINDX" "HDORTHOX" "HDAUTISMX" "HDPDDX"

[137] "HDADDX" "HDLEARNX" "HDDELAYX" "HDTRBRAIN"

[141] "HDOTHERX" "HDDLYRSK" "HDIFSPIEP" "HDCOMMUX"

[145] "HDSPCLED" "HDLEARN" "HDPLAY" "HDOUT"

[149] "HDFRNDS" "HDCHDCARE" "CDOBMM" "CDOBYY"

[153] "CPLCBRTH" "CMOVEAGE" "CHISPAN" "CAMIND"

[157] "CASIAN" "CBLACK" "CPACI" "CWHITE"

[161] "CHISPRM" "CSEX" "CLIVYN" "CLIVELSWX"

[165] "CSPEAKX" "CENGLPRG" "HHTOTALXX" "HHBROSX"

[169] "HHSISSX" "HHMOM" "HHDAD" "HHAUNTSX"

[173] "HHUNCLSX" "HHGMASX" "HHGPASX" "HHCSNSX"

[177] "HHPRTNRSX" "HHORELSX" "HHONRELSX" "RELATION"

[181] "HHENGLISH" "HHSPANISH" "HHFRENCH" "HHCHINESE"

[185] "HHOTHLANG" "P1REL" "P1SEX" "P1MRSTA"

[189] "P1BFGF" "P1FRLNG" "P1SPEAK" "P1PLCBRTH"

[193] "P1AGEMV" "P1HISPAN" "P1AMIND" "P1ASIAN"

[197] "P1BLACK" "P1PACI" "P1WHITE" "P1HISPRM"

[201] "P1EDUC" "P1ENRL" "P1EMPL" "P1HRSWK"

[205] "P1LKWRK" "P1MTHSWRK" "P1AGE" "P2GUARD"

[209] "P2REL" "P2SEX" "P2MRSTA" "P2BFGF"

[213] "P2FRLNG" "P2SPEAK" "P2PLCBRTH" "P2AGEMV"

[217] "P2HISPAN" "P2AMIND" "P2ASIAN" "P2BLACK"

[221] "P2PACI" "P2WHITE" "P2HISPRM" "P2EDUC" [225] "P2ENRL" "P2EMPL" "P2HRSWK" "P2LKWRK" [229] "P2MTHSWRK" "P2AGE" "HWELFTANST" "HWIC" [233] "HFOODST" "HMEDICAID" "HCHIP" "HSECN8" [237] "TTLHHINC" "OWNRNTHB" "HVINTSPHO" "HVINTCOM" [241] "CHLDNT" "LRNCOMP" "LRNTAB" "LRNCELL" [245] "DSBLTY" "PAR1EDUC" "PAR1EMPL" "PAR1FTFY" [249] "PAR1MARST" "PAR1TYPE" "PAR1FSTGN" "PAR2EDUC" [253] "PAR2EMPL" "PAR2FTFY" "PAR2MARST" "PAR2TYPE" [257] "PAR2FSTGN" "HHPARN19X" "HHPARN19_BRD" "NUMSIBSX" [261] "FAMILY19X" "FAMILY19_BRD" "HHUNDR6X" "HHUNDR10X" [265] "HHUNDR16X" "HHUNDR18X" "HHUNID" "LANGUAGEX" [269] "PARGRADEX" "RACEETH" "RACEETH2" "INTACC" [273] "ANYCAREX" "ANYCARE2X" "CAREHOURX" "CPARRNEWX"

[277] "MOSTHRSX" "NCARRNEWX" "RCARRNEWX" "CENREG"

[281] "ZIP18PO2" "ZIPBLHI2" "ZIPLOCL" "ENGLSPANX"

[285] "AGE2018" "MODECOMP" "CHAGE1" "CHAGE2" [289] "CHAGE3" "CHAGE4" "CHSEX1" "CHSEX2"

[293] "CHSEX3" "CHSEX4" "CHENRL1" "CHENRL2"

[297] "CHENRL3" "CHENRL4" "CHGRD1" "CHGRD2"

[301] "CHGRD3" "CHGRD4" "EPSU" "ESTRATUM"

[305] "FEWT" "FEWT1" "FEWT2" "FEWT3"

[309] "FEWT4" "FEWT5" "FEWT6" "FEWT7"

[313] "FEWT8" "FEWT9" "FEWT10" "FEWT11"

[317] "FEWT12" "FEWT13" "FEWT14" "FEWT15"

[321] "FEWT16" "FEWT17" "FEWT18" "FEWT19"

[325] "FEWT20" "FEWT21" "FEWT22" "FEWT23" [329] "FEWT24" "FEWT25" "FEWT26" "FEWT27"

[333] "FEWT28" "FEWT29" "FEWT30" "FEWT31"

[337] "FEWT32" "FEWT33" "FEWT34" "FEWT35"

[341] "FEWT36" "FEWT37" "FEWT38" "FEWT39"

[345] "FEWT40" "FEWT41" "FEWT42" "FEWT43"

[349] "FEWT44" "FEWT45" "FEWT46" "FEWT47"

[353] "FEWT48" "FEWT49" "FEWT50" "FEWT51"

[357] "FEWT52" "FEWT53" "FEWT54" "FEWT55"

[361] "FEWT56" "FEWT57" "FEWT58" "FEWT59"

[365] "FEWT60" "FEWT61" "FEWT62" "FEWT63"

[369] "FEWT64" "FEWT65" "FEWT66" "FEWT67"

[373] "FEWT68" "FEWT69" "FEWT70" "FEWT71"

[377] "FEWT72" "FEWT73" "FEWT74" "FEWT75"

[381] "FEWT76" "FEWT77" "FEWT78" "FEWT79"

[385] "FEWT80" "F_RCNOW" "F_RCWEEK" "F_RCTYPE"

[389] "F_RCAGE" "F_RCPLACE" "F_RCTIME" "F_RCDAYS"

[393] "F_RCHRS" "F_RCCVRWK" "F_RCSTRTY" "F_RCSTRTM"

[397] "F_RCSPEAK" "F_RCSKNFV" "F_RCSKFV" "F_RCOTCH"

[401] "F_RCFEE" "F_RCREL" "F_RCTANF" "F_RCSSAC"

[405] "F_RCEMPL" "F_RCOTHER" "F_RCCOST" "F_RCUNIT"

[409] "F_RCCSTHNX" "F_RCOTHC" "F_RCTLHR" "F_NCNOW"

[413] "F_NCWEEK" "F_NCINHH" "F_NCPLACE" "F_NCTIME"

[417] "F_NCDAYS" "F_NCHRS" "F_NCCVRWK" "F_NCSTRTY"

[421] "F_NCSTRTM" "F_NCALKNE" "F_NCAGE" "F_NCSPEAK"

[425] "F_NCSKNFV" "F_NCSKFV" "F_NCOTCH" "F_NCRCMDPT"

[429] "F_NCFEE" "F_NCREL" "F_NCTANF" "F_NCSSAC"

[433] "F_NCEMPL" "F_NCOTHER" "F_NCCOST" "F_NCUNIT"

[437] "F_NCCSTHNX" "F_NCOTHC" "F_NCTLHR" "F_CPNNOWX"

[441] "F_CPWEEKX" "F_CPPLACEX" "F_CPSPRLG" "F_CPWORK"

[445] "F_CPHEADST" "F_CPDAYS" "F_CPHRS" "F_CPCVRWK"

[449] "F_CPSTRTY" "F_CPSTRTM" "F_CPSPEAK" "F_CPTIME"

[453] "F_CPRCMDPT" "F_CPTEST" "F_CPPHYSE" "F_CPDENTA"

[457] "F_CPDISAB" "F_CPMEDAM" "F_CPSKNFV" "F_CPSKFV"

[461] "F_CPFEE" "F_CPREL" "F_CPTANF" "F_CPSSAC"

[465] "F_CPEMPL" "F_CPOTHER" "F_CPCOST" "F_CPUNIT" [469] "F_CPCSTHNX" "F_CPOTHC" "F_CPTLHR" "F_PCEVRHDX" [473] "F_MAINRESN" "F_PPCHOIC" "F_CRSRCH" "F_PPDIFCLT" [477] "F_WHYDIFCLT" "F_CCPY" "F_DCLOA" "F_DCOST"

[481] "F_DRELY" "F_DLERN" "F_DCHIL" "F_DHROP"

[485] "F_DNBGRP" "F_DRTWEB" "F_DRECFAM" "F_DQUAL"

[489] "F_DRELOR" "F_HABOOKS" "F_FOREADTOX" "F_FORDDAYX"

[493] "F_FOSTORYX" "F_FOWORDSX" "F_FOSANG" "F_FOCRAFTSX"

[497] "F_FODINNERX" "F_FOLIBRAY" "F_FOBOOKST" "F_DPIAGE"

[501] "F_DPLETTER" "F_DPNAME" "F_DPLTRSND" "F_DPEXPLN"

[505] "F_DPCOUNT" "F_DPSHAPE" "F_HDHEALTH" "F_HDINTDIS"

[509] "F_HDSPEECHX" "F_HDDISTRBX" "F_HDDEAFIMX" "F_HDBLINDX"

[513] "F_HDORTHOX" "F_HDAUTISMX" "F_HDPDDX" "F_HDADDX"

[517] "F_HDLEARNX" "F_HDDELAYX" "F_HDTRBRAIN" "F_HDOTHERX"

[521] "F_HDDLYRSK" "F_HDIFSPIEP" "F_HDCOMMUX" "F_HDSPCLED"

[525] "F_HDLEARN" "F_HDPLAY" "F_HDOUT" "F_HDFRNDS"

[529] "F_HDCHDCARE" "F_CDOBMM" "F_CDOBYY" "F_CPLCBRTH"

[533] "F_CMOVEAGE" "F_CHISPAN" "F_CAMIND" "F_CASIAN"

[537] "F_CBLACK" "F_CPACI" "F_CWHITE" "F_CHISPRM"

[541] "F_CSEX" "F_CLIVYN" "F_CLIVELSWX" "F_CSPEAKX"

[545] "F_CENGLPRG" "F_HHTOTALXX" "F_HHBROSX" "F_HHSISSX"

[549] "F_HHMOM" "F_HHDAD" "F_HHAUNTSX" "F_HHUNCLSX"

[553] "F_HHGMASX" "F_HHGPASX" "F_HHCSNSX" "F_HHPRTNRSX"

[557] "F_HHORELSX" "F_HHONRELSX" "F_RELATION" "F_HHENGLISH"

[561] "F_HHSPANISH" "F_HHFRENCH" "F_HHCHINESE" "F_HHOTHLANG"

[565] "F_P1REL" "F_P1SEX" "F_P1MRSTA" "F_P1BFGF"

[569] "F_P1FRLNG" "F_P1SPEAK" "F_P1PLCBRTH" "F_P1AGEMV"

[573] "F_P1HISPAN" "F_P1AMIND" "F_P1ASIAN" "F_P1BLACK"

[577] "F_P1PACI" "F_P1WHITE" "F_P1HISPRM" "F_P1EDUC"

[581] "F_P1ENRL" "F_P1EMPL" "F_P1HRSWK" "F_P1LKWRK"

[585] "F_P1MTHSWRK" "F_P1AGE" "F_P2GUARD" "F_P2REL"

[589] "F_P2SEX" "F_P2MRSTA" "F_P2BFGF" "F_P2FRLNG"

[593] "F_P2SPEAK" "F_P2PLCBRTH" "F_P2AGEMV" "F_P2HISPAN"

[597] "F_P2AMIND" "F_P2ASIAN" "F_P2BLACK" "F_P2PACI"

[601] "F_P2WHITE" "F_P2HISPRM" "F_P2EDUC" "F_P2ENRL"

[605] "F_P2EMPL" "F_P2HRSWK" "F_P2LKWRK" "F_P2MTHSWRK"

[609] "F_P2AGE" "F_HWELFTANST" "F_HWIC" "F_HFOODST"

[613] "F_HMEDICAID" "F_HCHIP" "F_HSECN8" "F_TTLHHINC"

[617] "F_OWNRNTHB" "F_HVINTSPHO" "F_HVINTCOM" "F_CHLDNT"

[621] "F_LRNCOMP" "F_LRNTAB" "F_LRNCELL" "F_HHUNID"

[625] "F_ZIPLOCL"

$class

[1] "data.frame"

$row.names

[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14

[15] 15 16 17 18 19 20 21 22 23 24 25 26 27 28

[29] 29 30 31 32 33 34 35 36 37 38 39 40 41 42

[43] 43 44 45 46 47 48 49 50 51 52 53 54 55 56

[57] 57 58 59 60 61 62 63 64 65 66 67 68 69 70 [71] 71 72 73 74 75 76 77 78 79 80 81 82 83 84

[85] 85 86 87 88 89 90 91 92 93 94 95 96 97 98

[99] 99 100 101 102 103 104 105

[113] 113 114

[127] 127 128 129 130 131 132 133 134 135 136 137 138 139 140 [141] 141 142 143 144 145 146 147 148 149 150 151 152 153 154

[155] 155 156 157 158 159 160 161 162 163 164

[169] 169 170 171 172 173 174

[183] 183 184 185 186 187 188 189 190 191 192 193 194 195 196

[197] 197 198 199 200 201 202 203 204 205 206 207 208 209 210

[211] 211 212 213 214 215 216 217 218 219 220 221 222 223 224

[225] 225 226 227 228 229 230 231 232 233 234 235 236 237 238 [239] 239 240 241 242 243 244 245 246 247 248 249 250 251 252

[253] 253 254 255 256 257 258 259 260 261 262 263 264 265 266

[267] 267 268 269 270 271 272 273 274 275 276 277 278 279 280

[281] 281 282 283 284 285 286 287 288 289 290 291 292 293 294 [295] 295 296 297 298 299 300 301 302 303 304 305 306 307 308

[309] 309 310 311 312 313 314 315 316 317 318 319 320 321 322 [323] 323 324 325 326 327 328 329 330 331 332 333 334 335 336

[337] 337 338 339 340 341 342 343 344 345 346 347 348 349 350 [351] 351 352 353 354 355 356 357 358 359 360 361 362 363 364

[365] 365 366 367 368 369 370 371 372 373 374 375 376 377 378 [379] 379 380 381 382 383 384 385 386 387 388 389 390 391 392 [393] 393 394 395 396 397 398 399 400 401 402 403 404 405 406

[407] 407 408 409 410 411 412 413 414 415 416 417 418 419 420

[421] 421 422 423 424 425 426 427 428 429 430 431 432 433 434

[435] 435 436 437 438 439 440 441 442 443 444 445 446 447 448

[449] 449 450 451 452 453 454 455 456 457 458 459 460 461 462

[463] 463 464 465 466 467 468 469 470 471 472 473 474 475 476

[477] 477 478 479 480 481 482 483 484 485 486 487 488 489 490

[491] 491 492 493 494 495 496 497 498 499 500 501 502 503 504

[505] 505 506 507 508 509 510 511 512 513 514 515 516 517 518

[519] 519 520 521 522 523 524 525 526 527 528 529 530 531 532

[533] 533 534 535 536 537 538 539 540 541 542 543 544 545 546

[547] 547 548 549 550 551 552 553 554 555 556 557 558 559 560

[561] 561 562 563 564 565 566 567 568 569 570 571 572 573 574

[575] 575 576 577 578 579 580 581 582 583 584 585 586 587 588

[589] 589 590 591 592 593 594 595 596 597 598 599 600 601 602

[603] 603 604 605 606 607 608 609 610 611 612 613 614 615 616

[617] 617 618 619 620 621 622 623 624 625 626 627 628 629 630

[631] 631 632 633 634 635 636 637 638 639 640 641 642 643 644

[645] 645 646 647 648 649 650 651 652 653 654 655 656 657 658

[659] 659 660 661 662 663 664 665 666 667 668 669 670 671 672

[673] 673 674 675 676 677 678 679 680 681 682 683 684 685 686

[687] 687 688 689 690 691 692 693 694 695 696 697 698 699 700

[701] 701 702 703 704 705 706 707 708 709 710 711 712 713 714

[715] 715 716 717 718 719 720 721 722 723 724 725 726 727 728

[729] 729 730 731 732 733 734 735 736 737 738 739 740 741 742

[743] 743 744 745 746 747 748 749 750 751 752 753 754 755 756

[757] 757 758 759 760 761 762 763 764 765 766 767 768 769 770

[771] 771 772 773 774 775 776 777 778 779 780 781 782 783 784

[785] 785 786 787 788 789 790 791 792 793 794 795 796 797 798

[799] 799 800 801 802 803 804 805 806 807 808 809 810 811 812

[813] 813 814 815 816 817 818 819 820 821 822 823 824 825 826

[827] 827 828 829 830 831 832 833 834 835 836 837 838 839 840

[841] 841 842 843 844 845 846 847 848 849 850 851 852 853 854

[855] 855 856 857 858 859 860 861 862 863 864 865 866 867 868

[869] 869 870 871 872 873 874 875 876 877 878 879 880 881 882

[883] 883 884 885 886 887 888 889 890 891 892 893 894 895 896

[897] 897 898 899 900 901 902 903 904 905 906 907 908 909 910 [911] 911 912 913 914 915 916 917 918 919 920 921 922 923 924

[925] 925 926 927 928 929 930 931 932 933 934 935 936 937 938 [939] 939 940 941 942 943 944 945 946 947 948 949 950 951 952

[953] 953 954 955 956 957 958 959 960 961 962 963 964 965 966

[967] 967 968 969 970 971 972 973 974 975 976 977 978 979 980

[981] 981 982 983 984 985 986 987 988 989 990 991 992 993 994 [995] 995 996 997 998 999 1000 [ reached getOption("max.print") omitted 6092 entries ]

> library(dplyr)

> > ##Question 1

>

> ## Income Level

> LCD$IncomeGroup <- with(LCD,

+ ifelse(TTLHHINC %in% 1:3, "Below $30,000",

+ ifelse(TTLHHINC %in% 5:12, "Above $30,000", NA)

+ ) + )

>

> ## Remove NA

> LCD_clean <- subset(LCD, !is.na(IncomeGroup))

> > ##Percentage Table

> income_table <- prop.table(table(LCD_clean$IncomeGroup)) * 100

> > ##Round

> round(income_table, 1)

Above $30,000 Below $30,000

81.9 18.1

> > ##Question 2

>

> ##Percent from each income group who visited the library

> library_summary <- LCD_clean %>%

+ group_by(IncomeGroup) %>%

+ summarise(

+ Library_Visit_Percent = mean(FOLIBRAY == 1, na.rm = TRUE) * 100

+ )

> ##Display

> print(library_summary)

# A tibble: 2 × 2

IncomeGroup Library_Visit_Percent

<chr> <dbl>

1 Above $30,000 34.3

2 Below $30,000 25.1

>

> ##Percent from each income group who visited a bookstore

> bookstore_summary <- LCD_clean %>%

+ group_by(IncomeGroup) %>%

+ summarise(

+ Bookstore_Visit_Percent = mean(FOBOOKST == 1, na.rm = TRUE) * 100 + )

> ##Display

> print(bookstore_summary)

# A tibble: 2 × 2

IncomeGroup Bookstore_Visit_Percent

<chr> <dbl>

1 Above $30,000 26.8

2 Below $30,000 19.8

>

> # Number of participants by income group

> total_by_income <- LCD_clean %>%

+ group_by(IncomeGroup) %>%

+ summarise(Total_Participants = n())

>

> # Number who visited BOTH library and bookstore

> visit_both <- LCD_clean %>%

+ filter(FOLIBRAY == 1 & FOBOOKST == 1) %>%

+ group_by(IncomeGroup) %>%

+ summarise(Dual_Visit_Count = n())

>

> # Merge and calculate percentage

> visit_both_percent <- left_join(visit_both, total_by_income, by = "IncomeGroup") %>% + mutate(Visit_Both_Percent = (Dual_Visit_Count / Total_Participants) * 100)

>

> # Format and display as percentage

> visit_both_percent %>%

+ mutate(Visit_Both_Percent = sprintf("%.1f%%", Visit_Both_Percent)) %>%

+ print()

# A tibble: 2 × 4

IncomeGroup Dual_Visit_Count Total_Participants Visit_Both_Percent

<chr> <int> <int> <chr>

1 Above $30,000 710 5393 13.2%

2 Below $30,000 114 1193 9.6%

> ##Question 3

> ##Summary Statistics

> book_summary <- LCD_clean %>%

+ group_by(IncomeGroup) %>%

+ summarise(

+ Mean_Books = mean(HABOOKS, na.rm = TRUE),

+ Q1_Books = quantile(HABOOKS, 0.25, na.rm = TRUE),

+ Median_Books = median(HABOOKS, na.rm = TRUE),

+ Q3_Books = quantile(HABOOKS, 0.75, na.rm = TRUE),

+ Min_Books = min(HABOOKS, na.rm = TRUE),

+ Max_Books = max(HABOOKS, na.rm = TRUE),

+ Range_Books = max(HABOOKS, na.rm = TRUE) - min(HABOOKS, na.rm = TRUE)

+ )

> > ## Results

> as.data.frame(book_summary)

IncomeGroup Mean_Books Q1_Books Median_Books Q3_Books Min_Books Max_Books

1 Above $30,000 75.61228 25 50 100 0 999

2 Below $30,000 35.97402 7 20 50 0 999

Range_Books

1 999 2 999 >

> #Remove NA

> LCD_clean <- subset(LCD, !is.na(IncomeGroup) & !is.na(HABOOKS))

> > #Boxplot

> boxplot(HABOOKS ~ IncomeGroup, data = LCD_clean, + main = "Book Ownership by Income Group", + xlab = "Income Group", ylab = "Number of Books Owned", + col = c("#ADD8E6", "#d3d3d3"))

> > ## T-test Book ownership by income group

> t_test_books <- t.test(HABOOKS ~ IncomeGroup, data = LCD_clean)

>

> ## View results

> print(t_test_books)

Welch Two Sample t-test

data: HABOOKS by IncomeGroup t = 18.758, df = 2566.2, p-value < 2.2e-16 alternative hypothesis: true difference in means between group Above $30,000 and group Below $30,000 is not equal to 0 95 percent confidence interval:

35.49460 43.78192

sample estimates:

mean in group Above $30,000 mean in group Below $30,000 75.61228 35.97402

> > ##Question 4

>

> ## Minutes Spent Reading

> ##Summary Statistics >

> reading_summary <- LCD_clean %>%

+ group_by(IncomeGroup) %>%

+ summarise(

+ Median_Reading = median(FORDDAYX, na.rm = TRUE),

+ Mean_Reading = mean(FORDDAYX, na.rm = TRUE),

+ Q1_Reading = quantile(FORDDAYX, 0.25, na.rm = TRUE),

+ Q3_Reading = quantile(FORDDAYX, 0.75, na.rm = TRUE),

+ Min_Reading = min(FORDDAYX, na.rm = TRUE),

+ Max_Reading = max(FORDDAYX, na.rm = TRUE),

+ Range_Reading = Max_Reading - Min_Reading

)

> # Results

> as.data.frame(reading_summary)

IncomeGroup Median_Reading Mean_Reading Q1_Reading Q3_Reading Min_Reading

Max_Reading Range_Reading

1 99 98

2 90 89

> > #Remove NA

> LCD_clean <- subset(LCD, !is.na(IncomeGroup) & !is.na(FORDDAYX))

>

> #Boxplot

> boxplot(FORDDAYX ~ IncomeGroup, data = LCD_clean, + main = "Minutes Spent Reading to the Child by Income Group", + xlab = "Income Group", ylab = "Minutes Spent Reading to the Child", + col = c("#ADD8E6", "#d3d3d3"))

> > ## T-test Minutes Spent Reading to the Child

> t_test_reading<- t.test( FORDDAYX~ IncomeGroup, data = LCD_clean)

>

> ## View results

> print(t_test_reading)

Welch Two Sample t-test

data: FORDDAYX by IncomeGroup

t = -6.4116, df = 1348.9, p-value = 1.987e-10

alternative hypothesis: true difference in means between group Above $30,000 and group Below $30,000 is not equal to 0 95 percent confidence interval: -3.610532 -1.918755 sample estimates:

mean in group Above $30,000 mean in group Below $30,000 15.24877 18.01341

Turn static files into dynamic content formats.

Create a flipbook
LA_a by KBallengeeID - Issuu