Survey Data Source: National Household Education Surveys (NHES) Program 2019: Parent and Family Involvement in Education (PFI)
Outcome Variable: enjoy_school; Item 50: SEENJOY “How much do you agree or disagree with ‘This child enjoys school’?”
Variable 1: overall_grades; Item 51: SEGRADES “Overall, across all subjects, what grades does this child get?”
Variable 2: time_absent; Item 54: SEABSNT “Since the beginning of this school year, how many days has this child been absent from school?” (Recoded - higher value means less time absent, lower value means more time absent)
Variable 3: times_participated; Item 61: FSFREQ “During this school year, how many times has any adult in the household gone to meetings or participated in activities at this child’s school?”
Variable 4: hours_hw_perweek; Item 66: FHWKHRS “In an average week, how many hours does this child spend on homework outside of school?”
Variable 5: parent_interaction; Item 64E: FCSUPPRT “How satisfied or dissatisfied are you with the way that school staff interacts with parents?”
hw8data_imputed <- pfi19 %>%
select (enjoy_school, overall_grades, time_absent, times_participated, hours_hw_perweek, parent_interaction, PPSU, PSTRATUM, FPWT)
hw8data_complete <- pfi19 %>%
select (enjoy_school, overall_grades, time_absent, times_participated, hours_hw_perweek, parent_interaction, PPSU, PSTRATUM, FPWT) %>%
filter (complete.cases(.))
## enjoy_school overall_grades time_absent
## 0 : 1868 1 Mostly As :7866 1 0 to 5 Days :13055
## 1 :14122 2 Mostly Bs :4528 2 6 to 10 Days : 2250
## NA's: 456 3 Mostly Cs :1345 3 11 to 20 Days : 512
## 4 Mostly Ds or Lower: 263 4 20 or More Days: 173
## NA's :2444 NA's : 456
##
##
## times_participated hours_hw_perweek parent_interaction
## Min. : 0.000 Min. : 0.00 1 Very Satisfied :8680
## 1st Qu.: 3.000 1st Qu.: 2.00 2 Somewhat Satisfied :5512
## Median : 4.000 Median : 5.00 3 Somewhat Dissatisfied:1367
## Mean : 7.023 Mean : 5.88 4 Very Dissatisfied : 461
## 3rd Qu.: 8.000 3rd Qu.: 8.00 NA's : 426
## Max. :99.000 Max. :75.00
## NA's :663 NA's :1513
## 0 1 NA's
## 0.11358385 0.85868904 0.02772711
## 1 Mostly As 2 Mostly Bs 3 Mostly Cs
## 0.47829259 0.27532531 0.08178280
## 4 Mostly Ds or Lower NA's
## 0.01599173 0.14860756
## 1 0 to 5 Days 2 6 to 10 Days 3 11 to 20 Days 4 20 or More Days
## 0.79381004 0.13681138 0.03113219 0.01051928
## NA's
## 0.02772711
## 1 Very Satisfied 2 Somewhat Satisfied 3 Somewhat Dissatisfied
## 0.52778791 0.33515749 0.08312052
## 4 Very Dissatisfied NA's
## 0.02803113 0.02590296
md.pattern(hw8data_imputed[, c("enjoy_school", "overall_grades", "time_absent", "times_participated", "hours_hw_perweek", "parent_interaction")])
## parent_interaction enjoy_school time_absent times_participated
## 13045 1 1 1 1
## 1632 1 1 1 1
## 669 1 1 1 1
## 341 1 1 1 1
## 160 1 1 1 0
## 6 1 1 1 0
## 57 1 1 1 0
## 2 1 1 1 0
## 84 1 0 0 1
## 12 1 0 0 1
## 6 1 0 0 0
## 6 1 0 0 0
## 71 0 1 1 0
## 7 0 1 1 0
## 348 0 0 0 0
## 426 456 456 663
## hours_hw_perweek overall_grades
## 13045 1 1 0
## 1632 1 0 1
## 669 0 1 1
## 341 0 0 2
## 160 1 1 1
## 6 1 0 2
## 57 0 1 2
## 2 0 0 3
## 84 1 0 3
## 12 0 0 4
## 6 1 0 4
## 6 0 0 5
## 71 0 1 3
## 7 0 0 4
## 348 0 0 6
## 1513 2444 5958
md.pairs(hw8data_imputed[, c("enjoy_school", "overall_grades", "time_absent", "times_participated", "hours_hw_perweek", "parent_interaction")])
## $rr
## enjoy_school overall_grades time_absent times_participated
## enjoy_school 15990 14002 15990 15687
## overall_grades 14002 14002 14002 13714
## time_absent 15990 14002 15990 15687
## times_participated 15687 13714 15687 15783
## hours_hw_perweek 14843 13205 14843 14761
## parent_interaction 15912 13931 15912 15783
## hours_hw_perweek parent_interaction
## enjoy_school 14843 15912
## overall_grades 13205 13931
## time_absent 14843 15912
## times_participated 14761 15783
## hours_hw_perweek 14933 14933
## parent_interaction 14933 16020
##
## $rm
## enjoy_school overall_grades time_absent times_participated
## enjoy_school 0 1988 0 303
## overall_grades 0 0 0 288
## time_absent 0 1988 0 303
## times_participated 96 2069 96 0
## hours_hw_perweek 90 1728 90 172
## parent_interaction 108 2089 108 237
## hours_hw_perweek parent_interaction
## enjoy_school 1147 78
## overall_grades 797 71
## time_absent 1147 78
## times_participated 1022 0
## hours_hw_perweek 0 0
## parent_interaction 1087 0
##
## $mr
## enjoy_school overall_grades time_absent times_participated
## enjoy_school 0 0 0 96
## overall_grades 1988 0 1988 2069
## time_absent 0 0 0 96
## times_participated 303 288 303 0
## hours_hw_perweek 1147 797 1147 1022
## parent_interaction 78 71 78 0
## hours_hw_perweek parent_interaction
## enjoy_school 90 108
## overall_grades 1728 2089
## time_absent 90 108
## times_participated 172 237
## hours_hw_perweek 0 1087
## parent_interaction 0 0
##
## $mm
## enjoy_school overall_grades time_absent times_participated
## enjoy_school 456 456 456 360
## overall_grades 456 2444 456 375
## time_absent 456 456 456 360
## times_participated 360 375 360 663
## hours_hw_perweek 366 716 366 491
## parent_interaction 348 355 348 426
## hours_hw_perweek parent_interaction
## enjoy_school 366 348
## overall_grades 716 355
## time_absent 366 348
## times_participated 491 426
## hours_hw_perweek 1513 426
## parent_interaction 426 426
mcv.enjoy_school
## [1] 1
## Levels: 0 1
summary(hw8data_imputed$enjoy_school)
## 0 1 NA's
## 1868 14122 456
prop.table(table(hw8data_imputed$enjoy_school))
##
## 0 1
## 0.116823 0.883177
table(hw8data_imputed$enjoy_school.imp)
##
## 0 1
## 1868 14578
prop.table(table(hw8data_imputed$enjoy_school.imp))
##
## 0 1
## 0.1135839 0.8864161
mcv.overall_grades
## [1] 1 Mostly As
## Levels: 1 Mostly As 2 Mostly Bs 3 Mostly Cs 4 Mostly Ds or Lower
summary(hw8data_imputed$overall_grades)
## 1 Mostly As 2 Mostly Bs 3 Mostly Cs
## 7866 4528 1345
## 4 Mostly Ds or Lower NA's
## 263 2444
prop.table(table(hw8data_imputed$overall_grades))
##
## 1 Mostly As 2 Mostly Bs 3 Mostly Cs
## 0.56177689 0.32338237 0.09605771
## 4 Mostly Ds or Lower
## 0.01878303
table(hw8data_imputed$overall_grades.imp)
##
## 1 Mostly As 2 Mostly Bs 3 Mostly Cs
## 10310 4528 1345
## 4 Mostly Ds or Lower
## 263
prop.table(table(hw8data_imputed$overall_grades.imp))
##
## 1 Mostly As 2 Mostly Bs 3 Mostly Cs
## 0.62690016 0.27532531 0.08178280
## 4 Mostly Ds or Lower
## 0.01599173
mcv.time_absent <- factor(names(which.max(table(hw8data_imputed$time_absent))), levels=levels(hw8data_imputed$time_absent))
hw8data_imputed$time_absent.imp <-
as.factor(ifelse(is.na(hw8data_imputed$time_absent)==T,
mcv.time_absent,
hw8data_imputed$time_absent))
levels(hw8data_imputed$time_absent.imp)<-levels(hw8data_imputed$time_absent)
mcv.time_absent
## [1] 1 0 to 5 Days
## Levels: 1 0 to 5 Days 2 6 to 10 Days 3 11 to 20 Days 4 20 or More Days
summary(hw8data_imputed$time_absent)
## 1 0 to 5 Days 2 6 to 10 Days 3 11 to 20 Days 4 20 or More Days
## 13055 2250 512 173
## NA's
## 456
prop.table(table(hw8data_imputed$time_absent))
##
## 1 0 to 5 Days 2 6 to 10 Days 3 11 to 20 Days 4 20 or More Days
## 0.81644778 0.14071295 0.03202001 0.01081926
table(hw8data_imputed$time_absent.imp)
##
## 1 0 to 5 Days 2 6 to 10 Days 3 11 to 20 Days 4 20 or More Days
## 13511 2250 512 173
prop.table(table(hw8data_imputed$time_absent.imp))
##
## 1 0 to 5 Days 2 6 to 10 Days 3 11 to 20 Days 4 20 or More Days
## 0.82153715 0.13681138 0.03113219 0.01051928
summary(hw8data_imputed$times_participated)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.000 3.000 4.000 7.023 8.000 99.000 663
mean(hw8data_imputed$times_participated, na.rm=T)
## [1] 7.023253
summary(hw8data_imputed$times_participated.imp.mean)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.000 3.000 5.000 7.023 8.000 99.000
mean(hw8data_imputed$times_participated.imp.mean)
## [1] 7.023253
summary(hw8data_imputed$hours_hw_perweek)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.00 2.00 5.00 5.88 8.00 75.00 1513
mean(hw8data_imputed$hours_hw_perweek, na.rm=T)
## [1] 5.87993
summary(hw8data_imputed$hours_hw_perweek.imp.mean)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 2.00 5.00 5.88 7.00 75.00
mean(hw8data_imputed$hours_hw_perweek.imp.mean)
## [1] 5.87993
mcv.parent_interaction
## [1] 1 Very Satisfied
## 4 Levels: 1 Very Satisfied 2 Somewhat Satisfied ... 4 Very Dissatisfied
summary(hw8data_imputed$parent_interaction)
## 1 Very Satisfied 2 Somewhat Satisfied 3 Somewhat Dissatisfied
## 8680 5512 1367
## 4 Very Dissatisfied NA's
## 461 426
prop.table(table(hw8data_imputed$parent_interaction))
##
## 1 Very Satisfied 2 Somewhat Satisfied 3 Somewhat Dissatisfied
## 0.54182272 0.34406991 0.08533084
## 4 Very Dissatisfied
## 0.02877653
table(hw8data_imputed$parent_interaction.imp)
##
## 1 Very Satisfied 2 Somewhat Satisfied 3 Somewhat Dissatisfied
## 9106 5512 1367
## 4 Very Dissatisfied
## 461
prop.table(table(hw8data_imputed$parent_interaction.imp))
##
## 1 Very Satisfied 2 Somewhat Satisfied 3 Somewhat Dissatisfied
## 0.55369087 0.33515749 0.08312052
## 4 Very Dissatisfied
## 0.02803113
hw8imp <- mice(data = hw8data_imputed[, c("enjoy_school", "overall_grades", "time_absent", "times_participated", "hours_hw_perweek", "parent_interaction", "PPSU", "PSTRATUM", "FPWT")], seed = 13, m = 10)
print(hw8imp)
## Class: mids
## Number of multiple imputations: 10
## Imputation methods:
## enjoy_school overall_grades time_absent times_participated
## "logreg" "polyreg" "polyreg" "pmm"
## hours_hw_perweek parent_interaction PPSU PSTRATUM
## "pmm" "polyreg" "" ""
## FPWT
## ""
## PredictorMatrix:
## enjoy_school overall_grades time_absent times_participated
## enjoy_school 0 1 1 1
## overall_grades 1 0 1 1
## time_absent 1 1 0 1
## times_participated 1 1 1 0
## hours_hw_perweek 1 1 1 1
## parent_interaction 1 1 1 1
## hours_hw_perweek parent_interaction PPSU PSTRATUM FPWT
## enjoy_school 1 1 1 1 1
## overall_grades 1 1 1 1 1
## time_absent 1 1 1 1 1
## times_participated 1 1 1 1 1
## hours_hw_perweek 0 1 1 1 1
## parent_interaction 1 0 1 1 1
plot(hw8imp)
summary(hw8imp)
## Class: mids
## Number of multiple imputations: 10
## Imputation methods:
## enjoy_school overall_grades time_absent times_participated
## "logreg" "polyreg" "polyreg" "pmm"
## hours_hw_perweek parent_interaction PPSU PSTRATUM
## "pmm" "polyreg" "" ""
## FPWT
## ""
## PredictorMatrix:
## enjoy_school overall_grades time_absent times_participated
## enjoy_school 0 1 1 1
## overall_grades 1 0 1 1
## time_absent 1 1 0 1
## times_participated 1 1 1 0
## hours_hw_perweek 1 1 1 1
## parent_interaction 1 1 1 1
## hours_hw_perweek parent_interaction PPSU PSTRATUM FPWT
## enjoy_school 1 1 1 1 1
## overall_grades 1 1 1 1 1
## time_absent 1 1 1 1 1
## times_participated 1 1 1 1 1
## hours_hw_perweek 0 1 1 1 1
## parent_interaction 1 0 1 1 1
hw8dataimp <- complete (hw8imp, action = 1)
head(hw8dataimp)
options(survey.lonely.psu = "adjust")
hw8design_imp <- svydesign(ids = ~PPSU,
strata = ~PSTRATUM,
weights = ~FPWT,
data = hw8dataimp,
nest = TRUE)
fit.imp <- svyglm (enjoy_school ~ overall_grades + time_absent + times_participated + hours_hw_perweek + parent_interaction,
hw8design_imp,
family = quasibinomial(link="logit"))
summary(fit.imp)
##
## Call:
## svyglm(formula = enjoy_school ~ overall_grades + time_absent +
## times_participated + hours_hw_perweek + parent_interaction,
## design = hw8design_imp, family = quasibinomial(link = "logit"))
##
## Survey design:
## svydesign(ids = ~PPSU, strata = ~PSTRATUM, weights = ~FPWT, data = hw8dataimp,
## nest = TRUE)
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.557835 0.103649 34.326 < 2e-16
## overall_grades2 Mostly Bs -0.661366 0.087901 -7.524 5.59e-14
## overall_grades3 Mostly Cs -1.623166 0.115428 -14.062 < 2e-16
## overall_grades4 Mostly Ds or Lower -2.369951 0.179528 -13.201 < 2e-16
## time_absent2 6 to 10 Days -0.332130 0.099566 -3.336 0.000852
## time_absent3 11 to 20 Days -1.050156 0.153051 -6.861 7.06e-12
## time_absent4 20 or More Days -1.474559 0.292230 -5.046 4.56e-07
## times_participated 0.010521 0.005279 1.993 0.046292
## hours_hw_perweek -0.006896 0.007808 -0.883 0.377136
## parent_interaction2 Somewhat Satisfied -1.002062 0.089885 -11.148 < 2e-16
## parent_interaction3 Somewhat Dissatisfied -1.449428 0.118566 -12.225 < 2e-16
## parent_interaction4 Very Dissatisfied -1.962881 0.167206 -11.739 < 2e-16
##
## (Intercept) ***
## overall_grades2 Mostly Bs ***
## overall_grades3 Mostly Cs ***
## overall_grades4 Mostly Ds or Lower ***
## time_absent2 6 to 10 Days ***
## time_absent3 11 to 20 Days ***
## time_absent4 20 or More Days ***
## times_participated *
## hours_hw_perweek
## parent_interaction2 Somewhat Satisfied ***
## parent_interaction3 Somewhat Dissatisfied ***
## parent_interaction4 Very Dissatisfied ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for quasibinomial family taken to be 0.9872161)
##
## Number of Fisher Scoring iterations: 5
options(survey.lonely.psu = "adjust")
hw8design <- svydesign(ids = ~PPSU,
strata = ~PSTRATUM,
weights = ~FPWT,
data = hw8data_complete,
nest = TRUE)
fit.complete <- svyglm (enjoy_school ~ overall_grades + time_absent + times_participated + hours_hw_perweek + parent_interaction,
hw8design,
family = quasibinomial(link="logit"))
summary(fit.complete)
##
## Call:
## svyglm(formula = enjoy_school ~ overall_grades + time_absent +
## times_participated + hours_hw_perweek + parent_interaction,
## design = hw8design, family = quasibinomial(link = "logit"))
##
## Survey design:
## svydesign(ids = ~PPSU, strata = ~PSTRATUM, weights = ~FPWT, data = hw8data_complete,
## nest = TRUE)
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.580259 0.117353 30.508 < 2e-16
## overall_grades2 Mostly Bs -0.619664 0.098709 -6.278 3.55e-10
## overall_grades3 Mostly Cs -1.565636 0.134529 -11.638 < 2e-16
## overall_grades4 Mostly Ds or Lower -2.240160 0.213224 -10.506 < 2e-16
## time_absent2 6 to 10 Days -0.463999 0.110187 -4.211 2.56e-05
## time_absent3 11 to 20 Days -1.099713 0.172853 -6.362 2.06e-10
## time_absent4 20 or More Days -1.589897 0.350769 -4.533 5.88e-06
## times_participated 0.008948 0.005407 1.655 0.098
## hours_hw_perweek -0.006207 0.008970 -0.692 0.489
## parent_interaction2 Somewhat Satisfied -1.005494 0.105476 -9.533 < 2e-16
## parent_interaction3 Somewhat Dissatisfied -1.484003 0.134410 -11.041 < 2e-16
## parent_interaction4 Very Dissatisfied -2.284021 0.171042 -13.354 < 2e-16
##
## (Intercept) ***
## overall_grades2 Mostly Bs ***
## overall_grades3 Mostly Cs ***
## overall_grades4 Mostly Ds or Lower ***
## time_absent2 6 to 10 Days ***
## time_absent3 11 to 20 Days ***
## time_absent4 20 or More Days ***
## times_participated .
## hours_hw_perweek
## parent_interaction2 Somewhat Satisfied ***
## parent_interaction3 Somewhat Dissatisfied ***
## parent_interaction4 Very Dissatisfied ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for quasibinomial family taken to be 0.975302)
##
## Number of Fisher Scoring iterations: 5