1. Define an ordinal or multinomial outcome variable of your choosing and define how you will recode the original variable.
The ordinal variable that I have choosen is labled AllEducLevels. This variable is recoded from educ into 4 different categories. 1 being less than high school. 2 being high school education. 3 being undergraduate education (4 years or less). Finally 4 being graduate level education (17-20 years).
2. State a research question about what factors you believe will affect your outcome variable.
My research question is the differential educational outcomes between Hispanics and Non-Hispanic Whites. The factors that I believe will influence this relationship is the respondents sex, parental factors, and percieved discrimination. Controlling for age.
3. Fit the ordinal or the multinomial logistic regression models to your outcome.
A ordinal model was fitted because those three categories for the outcome variable is in order from lowest education to highest educaiton. I used the non-proportional assumptions for this data
4. If you use the ordinal model, are the assumptions of the proportional odds model met?
While using the non-proportional odds assumptions looking at my key predictor variable Hispanics it found statistical significance in each model regarding Hispanics and educational attainment. The statistical significance lessens when looking at graduate level education in model 3 decreasing from a .001 level to a .05 measure as well as lessening odds overall as you increase each educational grade. This is significant because even when including all predictors such as parental factors and percieved discrimination Non-Hispanic Whites tend to have greater odds of recieving a higher education than Hispanics at every level of educational attainment. As you observe the odds for Hispanics it actually decreases each model showing a weakening of this effect but overall Non-Hispanic whites tend to recieve a greater educational attainment compared to their Hispanic counterparts.
A interesting find is a possible interaction effect in model 2. When looking at the income16 variable outputs its statistically significant at the .001 level showing that those who grew up with percieved good economic resources had better educational outcomes. This predictor is significant at the .05 level for each model but at its strongest in model 2. Another interesting interaction is the Born predictor variable showing that those who were not born in the US had higher odds of attending graduate school than those who were born in the US at the .05 level. This predictor was not significant in models 1 and 2. Non of the predictors were statistically significant nor was the sex variable in any of the models. Interstinly the age intervals found statistical significance in each interval for model 3 at the .001 level showing that as age increases so does ones educational attainment. This is treated as a true control variable because of that relationship age has with educational attainment.
When observing the AIC of the two models created it is seen that the model being explained, the non-proportional odds assumption model, had a lower AIC output than the model its compred to which is a standard proportional odds model. This meaning that the non-proportional odds model is a better fit for the data being used.
library(haven)
library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(scales)
library(sur)
library(plyr)
## ------------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## ------------------------------------------------------------------------------
##
## Attaching package: 'plyr'
## The following objects are masked from 'package:dplyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
library(summarytools)
library(Rmisc)
## Loading required package: lattice
library(car)
## Loading required package: carData
##
## Attaching package: 'carData'
## The following objects are masked from 'package:sur':
##
## Anscombe, States
##
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
##
## recode
library(forcats)
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v tibble 3.1.6 v purrr 0.3.4
## v tidyr 1.1.4 v stringr 1.4.0
## v readr 2.1.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x plyr::arrange() masks dplyr::arrange()
## x readr::col_factor() masks scales::col_factor()
## x purrr::compact() masks plyr::compact()
## x plyr::count() masks dplyr::count()
## x purrr::discard() masks scales::discard()
## x plyr::failwith() masks dplyr::failwith()
## x dplyr::filter() masks stats::filter()
## x plyr::id() masks dplyr::id()
## x dplyr::lag() masks stats::lag()
## x plyr::mutate() masks dplyr::mutate()
## x car::recode() masks dplyr::recode()
## x plyr::rename() masks dplyr::rename()
## x purrr::some() masks car::some()
## x plyr::summarise() masks dplyr::summarise()
## x plyr::summarize() masks dplyr::summarize()
## x tibble::view() masks summarytools::view()
library(survey)
## Loading required package: grid
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
## Loading required package: survival
##
## Attaching package: 'survey'
## The following object is masked from 'package:graphics':
##
## dotchart
library(stargazer)
##
## Please cite as:
## Hlavac, Marek (2018). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2.2. https://CRAN.R-project.org/package=stargazer
library(grid)
library(Matrix)
library(caret)
##
## Attaching package: 'caret'
## The following object is masked from 'package:survival':
##
## cluster
## The following object is masked from 'package:purrr':
##
## lift
gss2021_ZERODraft<-read_dta("C:\\Users\\BTP\\Desktop\\STATS 2 FOLDER\\2021_sas\\gss2021.dta")
## Key Predictor
gss2021_ZERODraft %>%
tabyl(hispanic)
## hispanic n percent valid_percent
## 1 3544 0.8789682540 0.8864432216
## 2 245 0.0607638889 0.0612806403
## 3 51 0.0126488095 0.0127563782
## 4 21 0.0052083333 0.0052526263
## 5 9 0.0022321429 0.0022511256
## 6 2 0.0004960317 0.0005002501
## 7 4 0.0009920635 0.0010005003
## 8 2 0.0004960317 0.0005002501
## 9 4 0.0009920635 0.0010005003
## 10 5 0.0012400794 0.0012506253
## 11 3 0.0007440476 0.0007503752
## 15 17 0.0042162698 0.0042521261
## 20 4 0.0009920635 0.0010005003
## 21 8 0.0019841270 0.0020010005
## 22 10 0.0024801587 0.0025012506
## 23 5 0.0012400794 0.0012506253
## 24 1 0.0002480159 0.0002501251
## 25 1 0.0002480159 0.0002501251
## 30 46 0.0114087302 0.0115057529
## 35 1 0.0002480159 0.0002501251
## 41 3 0.0007440476 0.0007503752
## 46 2 0.0004960317 0.0005002501
## 47 7 0.0017361111 0.0017508754
## 50 3 0.0007440476 0.0007503752
## NA 34 0.0084325397 NA
## Key dependent
gss2021_ZERODraft %>%
tabyl(educ)
## educ n percent valid_percent
## 0 9 0.0022321429 0.0022692890
## 1 1 0.0002480159 0.0002521432
## 2 2 0.0004960317 0.0005042864
## 3 3 0.0007440476 0.0007564297
## 4 1 0.0002480159 0.0002521432
## 5 2 0.0004960317 0.0005042864
## 6 15 0.0037202381 0.0037821483
## 7 5 0.0012400794 0.0012607161
## 8 25 0.0062003968 0.0063035804
## 9 32 0.0079365079 0.0080685830
## 10 52 0.0128968254 0.0131114473
## 11 83 0.0205853175 0.0209278870
## 12 829 0.2056051587 0.2090267272
## 13 277 0.0687003968 0.0698436712
## 14 542 0.1344246032 0.1366616238
## 15 208 0.0515873016 0.0524457892
## 16 942 0.2336309524 0.2375189107
## 17 258 0.0639880952 0.0650529501
## 18 351 0.0870535714 0.0885022693
## 19 113 0.0280257937 0.0284921836
## 20 216 0.0535714286 0.0544629349
## NA 66 0.0163690476 NA
## Key Control(startified variable)
gss2021_ZERODraft %>%
tabyl(sex)
## sex n percent valid_percent
## 1 1736 0.43055556 0.4406091
## 2 2204 0.54662698 0.5593909
## NA 92 0.02281746 NA
## Parental Factors
gss2021_ZERODraft %>%
tabyl(incom16)
## incom16 n percent valid_percent
## 1 421 0.10441468 0.11003659
## 2 1013 0.25124008 0.26476738
## 3 1625 0.40302579 0.42472556
## 4 679 0.16840278 0.17746994
## 5 88 0.02182540 0.02300052
## NA 206 0.05109127 NA
gss2021_ZERODraft %>%
tabyl(born)
## born n percent valid_percent
## 1 3516 0.87202381 0.8878788
## 2 444 0.11011905 0.1121212
## NA 72 0.01785714 NA
## Racialization Factors
gss2021_ZERODraft %>%
tabyl(disrspct)
## disrspct n percent valid_percent
## 1 136 0.03373016 0.05228758
## 2 231 0.05729167 0.08881200
## 3 327 0.08110119 0.12572088
## 4 801 0.19866071 0.30795848
## 5 552 0.13690476 0.21222607
## 6 554 0.13740079 0.21299500
## NA 1431 0.35491071 NA
gss2021_ZERODraft %>%
tabyl(notsmart)
## notsmart n percent valid_percent
## 1 101 0.02504960 0.03881630
## 2 129 0.03199405 0.04957725
## 3 202 0.05009921 0.07763259
## 4 684 0.16964286 0.26287471
## 5 619 0.15352183 0.23789393
## 6 867 0.21502976 0.33320523
## NA 1430 0.35466270 NA
## Other Control Variables
gss2021_ZERODraft %>%
tabyl(age)
## age n percent valid_percent
## 18 4 0.0009920635 0.001081373
## 19 14 0.0034722222 0.003784807
## 20 18 0.0044642857 0.004866180
## 21 24 0.0059523810 0.006488240
## 22 31 0.0076884921 0.008380643
## 23 30 0.0074404762 0.008110300
## 24 38 0.0094246032 0.010273047
## 25 46 0.0114087302 0.012435793
## 26 44 0.0109126984 0.011895107
## 27 35 0.0086805556 0.009462017
## 28 59 0.0146329365 0.015950257
## 29 63 0.0156250000 0.017031630
## 30 61 0.0151289683 0.016490943
## 31 56 0.0138888889 0.015139227
## 32 59 0.0146329365 0.015950257
## 33 82 0.0203373016 0.022168154
## 34 69 0.0171130952 0.018653690
## 35 62 0.0153769841 0.016761287
## 36 61 0.0151289683 0.016490943
## 37 74 0.0183531746 0.020005407
## 38 59 0.0146329365 0.015950257
## 39 65 0.0161210317 0.017572317
## 40 63 0.0156250000 0.017031630
## 41 76 0.0188492063 0.020546094
## 42 77 0.0190972222 0.020816437
## 43 56 0.0138888889 0.015139227
## 44 60 0.0148809524 0.016220600
## 45 52 0.0128968254 0.014057853
## 46 61 0.0151289683 0.016490943
## 47 54 0.0133928571 0.014598540
## 48 47 0.0116567460 0.012706137
## 49 54 0.0133928571 0.014598540
## 50 51 0.0126488095 0.013787510
## 51 69 0.0171130952 0.018653690
## 52 53 0.0131448413 0.014328197
## 53 65 0.0161210317 0.017572317
## 54 53 0.0131448413 0.014328197
## 55 65 0.0161210317 0.017572317
## 56 63 0.0156250000 0.017031630
## 57 79 0.0195932540 0.021357124
## 58 60 0.0148809524 0.016220600
## 59 81 0.0200892857 0.021897810
## 60 70 0.0173611111 0.018924034
## 61 76 0.0188492063 0.020546094
## 62 77 0.0190972222 0.020816437
## 63 77 0.0190972222 0.020816437
## 64 68 0.0168650794 0.018383347
## 65 68 0.0168650794 0.018383347
## 66 58 0.0143849206 0.015679913
## 67 89 0.0220734127 0.024060557
## 68 72 0.0178571429 0.019464720
## 69 73 0.0181051587 0.019735064
## 70 71 0.0176091270 0.019194377
## 71 55 0.0136408730 0.014868883
## 72 52 0.0128968254 0.014057853
## 73 48 0.0119047619 0.012976480
## 74 69 0.0171130952 0.018653690
## 75 57 0.0141369048 0.015409570
## 76 34 0.0084325397 0.009191673
## 77 37 0.0091765873 0.010002703
## 78 32 0.0079365079 0.008650987
## 79 40 0.0099206349 0.010813733
## 80 30 0.0074404762 0.008110300
## 81 31 0.0076884921 0.008380643
## 82 18 0.0044642857 0.004866180
## 83 17 0.0042162698 0.004595837
## 84 21 0.0052083333 0.005677210
## 85 16 0.0039682540 0.004325493
## 86 14 0.0034722222 0.003784807
## 87 5 0.0012400794 0.001351717
## 88 5 0.0012400794 0.001351717
## 89 26 0.0064484127 0.007028927
## NA 333 0.0825892857 NA
gss2021_ZERODraft %>%
tabyl(hispanic)
## hispanic n percent valid_percent
## 1 3544 0.8789682540 0.8864432216
## 2 245 0.0607638889 0.0612806403
## 3 51 0.0126488095 0.0127563782
## 4 21 0.0052083333 0.0052526263
## 5 9 0.0022321429 0.0022511256
## 6 2 0.0004960317 0.0005002501
## 7 4 0.0009920635 0.0010005003
## 8 2 0.0004960317 0.0005002501
## 9 4 0.0009920635 0.0010005003
## 10 5 0.0012400794 0.0012506253
## 11 3 0.0007440476 0.0007503752
## 15 17 0.0042162698 0.0042521261
## 20 4 0.0009920635 0.0010005003
## 21 8 0.0019841270 0.0020010005
## 22 10 0.0024801587 0.0025012506
## 23 5 0.0012400794 0.0012506253
## 24 1 0.0002480159 0.0002501251
## 25 1 0.0002480159 0.0002501251
## 30 46 0.0114087302 0.0115057529
## 35 1 0.0002480159 0.0002501251
## 41 3 0.0007440476 0.0007503752
## 46 2 0.0004960317 0.0005002501
## 47 7 0.0017361111 0.0017508754
## 50 3 0.0007440476 0.0007503752
## NA 34 0.0084325397 NA
gss2021_ZERODraft$subgrouphis <-Recode(gss2021_ZERODraft$hispanic, recodes="1 = 0; 2:50 = 1; else=NA", as.factor=T)
gss2021_ZERODraft %>%
tabyl(subgrouphis)
## subgrouphis n percent valid_percent
## 0 3544 0.87896825 0.8864432
## 1 454 0.11259921 0.1135568
## <NA> 34 0.00843254 NA
subgrouphis_1<-as.factor(ifelse(gss2021_ZERODraft$subgrouphis==1, "Hispanic", "Non Hispanic"))
tabyl(subgrouphis_1)
## subgrouphis_1 n percent valid_percent
## Hispanic 454 0.11259921 0.1135568
## Non Hispanic 3544 0.87896825 0.8864432
## <NA> 34 0.00843254 NA
gss2021_ZERODraft %>%
tabyl(educ)
## educ n percent valid_percent
## 0 9 0.0022321429 0.0022692890
## 1 1 0.0002480159 0.0002521432
## 2 2 0.0004960317 0.0005042864
## 3 3 0.0007440476 0.0007564297
## 4 1 0.0002480159 0.0002521432
## 5 2 0.0004960317 0.0005042864
## 6 15 0.0037202381 0.0037821483
## 7 5 0.0012400794 0.0012607161
## 8 25 0.0062003968 0.0063035804
## 9 32 0.0079365079 0.0080685830
## 10 52 0.0128968254 0.0131114473
## 11 83 0.0205853175 0.0209278870
## 12 829 0.2056051587 0.2090267272
## 13 277 0.0687003968 0.0698436712
## 14 542 0.1344246032 0.1366616238
## 15 208 0.0515873016 0.0524457892
## 16 942 0.2336309524 0.2375189107
## 17 258 0.0639880952 0.0650529501
## 18 351 0.0870535714 0.0885022693
## 19 113 0.0280257937 0.0284921836
## 20 216 0.0535714286 0.0544629349
## NA 66 0.0163690476 NA
gss2021_ZERODraft$AllEducLevels <-Recode(gss2021_ZERODraft$educ, recodes="0:11 = 1; 12 = 2; 13:16 = 3; 17:20 = 4; else=NA", as.factor=T)
gss2021_ZERODraft$AllEducLevels<-relevel(gss2021_ZERODraft$AllEducLevels, ref = "1")
gss2021_ZERODraft %>%
tabyl(AllEducLevels)
## AllEducLevels n percent valid_percent
## 1 230 0.05704365 0.05799294
## 2 829 0.20560516 0.20902673
## 3 1969 0.48834325 0.49646999
## 4 938 0.23263889 0.23651034
## <NA> 66 0.01636905 NA
gss2021_ZERODraft %>%
tabyl(sex)
## sex n percent valid_percent
## 1 1736 0.43055556 0.4406091
## 2 2204 0.54662698 0.5593909
## NA 92 0.02281746 NA
gss2021_ZERODraft$subgroupsex <-Recode(gss2021_ZERODraft$sex, recodes="1:1 = 0; 2:2 = 1; else=NA", as.factor=T)
gss2021_ZERODraft %>%
tabyl(subgroupsex)
## subgroupsex n percent valid_percent
## 0 1736 0.43055556 0.4406091
## 1 2204 0.54662698 0.5593909
## <NA> 92 0.02281746 NA
subgroupsex_1<-as.factor(ifelse(gss2021_ZERODraft$subgroupsex==1, "Women", "Men"))
tabyl(subgroupsex_1)
## subgroupsex_1 n percent valid_percent
## Men 1736 0.43055556 0.4406091
## Women 2204 0.54662698 0.5593909
## <NA> 92 0.02281746 NA
gss2021_ZERODraft %>%
tabyl(incom16)
## incom16 n percent valid_percent
## 1 421 0.10441468 0.11003659
## 2 1013 0.25124008 0.26476738
## 3 1625 0.40302579 0.42472556
## 4 679 0.16840278 0.17746994
## 5 88 0.02182540 0.02300052
## NA 206 0.05109127 NA
gss2021_ZERODraft$subgroupincom16 <-Recode(gss2021_ZERODraft$incom16, recodes="1:2 = 0; 3:5 = 1; else=NA", as.factor=T)
gss2021_ZERODraft %>%
tabyl(subgroupincom16)
## subgroupincom16 n percent valid_percent
## 0 1434 0.35565476 0.374804
## 1 2392 0.59325397 0.625196
## <NA> 206 0.05109127 NA
subgroupincom16_1<-as.factor(ifelse(gss2021_ZERODraft$subgroupincom16==1, "secure economic resources at 16", "insecure economic resources"))
tabyl(subgroupincom16_1)
## subgroupincom16_1 n percent valid_percent
## insecure economic resources 1434 0.35565476 0.374804
## secure economic resources at 16 2392 0.59325397 0.625196
## <NA> 206 0.05109127 NA
gss2021_ZERODraft %>%
tabyl(born)
## born n percent valid_percent
## 1 3516 0.87202381 0.8878788
## 2 444 0.11011905 0.1121212
## NA 72 0.01785714 NA
gss2021_ZERODraft$subgroupBorn <-Recode(gss2021_ZERODraft$born, recodes="1:1 = 1; 2:2 = 0; else=NA", as.factor=T)
gss2021_ZERODraft %>%
tabyl(subgroupBorn)
## subgroupBorn n percent valid_percent
## 0 444 0.11011905 0.1121212
## 1 3516 0.87202381 0.8878788
## <NA> 72 0.01785714 NA
subgroupborn_1<-as.factor(ifelse(gss2021_ZERODraft$subgroupBorn==1, "Born in US", "Not born in US"))
tabyl(subgroupborn_1)
## subgroupborn_1 n percent valid_percent
## Born in US 3516 0.87202381 0.8878788
## Not born in US 444 0.11011905 0.1121212
## <NA> 72 0.01785714 NA
gss2021_ZERODraft %>%
tabyl(disrspct)
## disrspct n percent valid_percent
## 1 136 0.03373016 0.05228758
## 2 231 0.05729167 0.08881200
## 3 327 0.08110119 0.12572088
## 4 801 0.19866071 0.30795848
## 5 552 0.13690476 0.21222607
## 6 554 0.13740079 0.21299500
## NA 1431 0.35491071 NA
gss2021_ZERODraft$subgroupdisrspct <-Recode(gss2021_ZERODraft$disrspct, recodes="1:5 = 1; 6:6 = 0; else=NA", as.factor=T)
gss2021_ZERODraft %>%
tabyl(subgroupdisrspct)
## subgroupdisrspct n percent valid_percent
## 0 554 0.1374008 0.212995
## 1 2047 0.5076885 0.787005
## <NA> 1431 0.3549107 NA
subgroupdisrspct_1<-as.factor(ifelse(gss2021_ZERODraft$subgroupdisrspct==1, "respondent has been disrespected", "Not being disrespected"))
tabyl(subgroupdisrspct_1)
## subgroupdisrspct_1 n percent valid_percent
## Not being disrespected 554 0.1374008 0.212995
## respondent has been disrespected 2047 0.5076885 0.787005
## <NA> 1431 0.3549107 NA
gss2021_ZERODraft %>%
tabyl(notsmart)
## notsmart n percent valid_percent
## 1 101 0.02504960 0.03881630
## 2 129 0.03199405 0.04957725
## 3 202 0.05009921 0.07763259
## 4 684 0.16964286 0.26287471
## 5 619 0.15352183 0.23789393
## 6 867 0.21502976 0.33320523
## NA 1430 0.35466270 NA
gss2021_ZERODraft$subgroupnotsmart <-Recode(gss2021_ZERODraft$notsmart, recodes="1:5 = 1; 6:6 = 0; else=NA", as.factor=T)
gss2021_ZERODraft %>%
tabyl(subgroupnotsmart)
## subgroupnotsmart n percent valid_percent
## 0 867 0.2150298 0.3332052
## 1 1735 0.4303075 0.6667948
## <NA> 1430 0.3546627 NA
subgroupnotsmart_1<-as.factor(ifelse(gss2021_ZERODraft$subgroupnotsmart==1, "respondent was told or treated as if they are not smart", "Never experienced that sort of treatment of not being smart"))
tabyl(subgroupnotsmart_1)
## subgroupnotsmart_1 n percent
## Never experienced that sort of treatment of not being smart 867 0.2150298
## respondent was told or treated as if they are not smart 1735 0.4303075
## <NA> 1430 0.3546627
## valid_percent
## 0.3332052
## 0.6667948
## NA
age1<-cut(gss2021_ZERODraft$age,
breaks = c(0,24,39,59,79,99))
sub <- gss2021_ZERODraft %>%
select(AllEducLevels,subgrouphis,subgroupBorn,subgroupsex,subgroupincom16,subgroupdisrspct,subgroupnotsmart,age,vstrat,wtssnrps) %>%
filter(complete.cases(.))
library(srvyr)
##
## Attaching package: 'srvyr'
## The following objects are masked from 'package:plyr':
##
## mutate, rename, summarise, summarize
## The following object is masked from 'package:stats':
##
## filter
options(survey.lonely.psu = "adjust")
des<-svydesign(ids=~1, strata=~vstrat, weights=~wtssnrps, data=gss2021_ZERODraft)
library(VGAM)
## Loading required package: stats4
## Loading required package: splines
##
## Attaching package: 'VGAM'
## The following object is masked from 'package:caret':
##
## predictors
## The following object is masked from 'package:survey':
##
## calibrate
## The following object is masked from 'package:tidyr':
##
## fill
## The following object is masked from 'package:car':
##
## logit
library(svyVGAM)
library(gtsummary)
##
## Attaching package: 'gtsummary'
## The following object is masked from 'package:plyr':
##
## mutate
#Proportional odds
fit.vgam<-svy_vglm(as.ordered(AllEducLevels)~subgrouphis_1+subgroupsex_1+subgroupincom16_1+subgroupborn_1+subgroupnotsmart_1+subgroupdisrspct_1+age1,
design = des,
family=cumulative(parallel = T,
reverse = T))
m1 <- fit.vgam %>%
tbl_regression()
## ! `broom::tidy()` failed to tidy the model.
## x No tidy method for objects of class svy_vglm
## v `tidy_parameters()` used instead.
## i Add `tidy_fun = broom.helpers::tidy_parameters` to quiet these messages.
## x Unable to identify the list of variables.
##
## This is usually due to an error calling `stats::model.frame(x)`or `stats::model.matrix(x)`.
## It could be the case if that type of model does not implement these methods.
## Rarely, this error may occur if the model object was created within
## a functional programming framework (e.g. using `lappy()`, `purrr::map()`, etc.).
m1
| Characteristic | Beta | 95% CI1 | p-value |
|---|---|---|---|
| (Intercept):1 | 0.88 | 0.54, 1.2 | <0.001 |
| (Intercept):2 | -0.76 | -1.1, -0.47 | <0.001 |
| (Intercept):3 | -3.2 | -3.5, -2.9 | <0.001 |
| subgrouphis_1Non Hispanic | 0.75 | 0.56, 0.93 | <0.001 |
| subgroupsex_1Women | -0.11 | -0.21, -0.01 | 0.039 |
| subgroupincom16_1secure economic resources at 16 | 0.38 | 0.27, 0.48 | <0.001 |
| subgroupborn_1Not born in US | 0.30 | 0.12, 0.48 | 0.001 |
| subgroupnotsmart_1respondent was told or treated as if they are not smart | -0.04 | -0.17, 0.09 | 0.5 |
| subgroupdisrspct_1respondent has been disrespected | 0.18 | 0.04, 0.32 | 0.012 |
| age1(24,39] | 0.77 | 0.53, 1.0 | <0.001 |
| age1(39,59] | 0.56 | 0.33, 0.79 | <0.001 |
| age1(59,79] | 0.47 | 0.24, 0.70 | <0.001 |
| age1(79,99] | 0.34 | 0.03, 0.66 | 0.031 |
|
1
CI = Confidence Interval
|
|||
summary(fit.vgam)
## svy_vglm.survey.design(as.ordered(AllEducLevels) ~ subgrouphis_1 +
## subgroupsex_1 + subgroupincom16_1 + subgroupborn_1 + subgroupnotsmart_1 +
## subgroupdisrspct_1 + age1, design = des, family = cumulative(parallel = T,
## reverse = T))
## Stratified Independent Sampling design (with replacement)
## svydesign(ids = ~1, strata = ~vstrat, weights = ~wtssnrps, data = gss2021_ZERODraft)
## Coef
## (Intercept):1 0.883761
## (Intercept):2 -0.764026
## (Intercept):3 -3.157445
## subgrouphis_1Non Hispanic 0.746612
## subgroupsex_1Women -0.105714
## subgroupincom16_1secure economic resources at 16 0.377572
## subgroupborn_1Not born in US 0.299640
## subgroupnotsmart_1respondent was told or treated as if they are not smart -0.038905
## subgroupdisrspct_1respondent has been disrespected 0.182104
## age1(24,39] 0.772137
## age1(39,59] 0.558905
## age1(59,79] 0.471147
## age1(79,99] 0.344759
## SE
## (Intercept):1 0.174842
## (Intercept):2 0.148850
## (Intercept):3 0.155245
## subgrouphis_1Non Hispanic 0.093246
## subgroupsex_1Women 0.051335
## subgroupincom16_1secure economic resources at 16 0.053272
## subgroupborn_1Not born in US 0.091903
## subgroupnotsmart_1respondent was told or treated as if they are not smart 0.064705
## subgroupdisrspct_1respondent has been disrespected 0.072429
## age1(24,39] 0.121630
## age1(39,59] 0.115944
## age1(59,79] 0.116805
## age1(79,99] 0.160067
## z
## (Intercept):1 5.0546
## (Intercept):2 -5.1329
## (Intercept):3 -20.3385
## subgrouphis_1Non Hispanic 8.0069
## subgroupsex_1Women -2.0593
## subgroupincom16_1secure economic resources at 16 7.0876
## subgroupborn_1Not born in US 3.2604
## subgroupnotsmart_1respondent was told or treated as if they are not smart -0.6013
## subgroupdisrspct_1respondent has been disrespected 2.5142
## age1(24,39] 6.3483
## age1(39,59] 4.8205
## age1(59,79] 4.0336
## age1(79,99] 2.1538
## p
## (Intercept):1 4.312e-07
## (Intercept):2 2.854e-07
## (Intercept):3 < 2.2e-16
## subgrouphis_1Non Hispanic 1.176e-15
## subgroupsex_1Women 0.039467
## subgroupincom16_1secure economic resources at 16 1.364e-12
## subgroupborn_1Not born in US 0.001113
## subgroupnotsmart_1respondent was told or treated as if they are not smart 0.547660
## subgroupdisrspct_1respondent has been disrespected 0.011929
## age1(24,39] 2.178e-10
## age1(39,59] 1.432e-06
## age1(59,79] 5.492e-05
## age1(79,99] 0.031253
#Non-proportional odds
fit.vgam2<-svy_vglm(as.ordered(AllEducLevels)~subgrouphis_1+subgroupsex_1+subgroupincom16_1+subgroupborn_1+subgroupnotsmart_1+subgroupdisrspct_1+age1,
design = des,
family=cumulative(parallel = F, reverse = T)) #<-parallel = F == Nonproportional odds
m2 <- fit.vgam2 %>%
tbl_regression()
## ! `broom::tidy()` failed to tidy the model.
## x No tidy method for objects of class svy_vglm
## v `tidy_parameters()` used instead.
## i Add `tidy_fun = broom.helpers::tidy_parameters` to quiet these messages.
## x Unable to identify the list of variables.
##
## This is usually due to an error calling `stats::model.frame(x)`or `stats::model.matrix(x)`.
## It could be the case if that type of model does not implement these methods.
## Rarely, this error may occur if the model object was created within
## a functional programming framework (e.g. using `lappy()`, `purrr::map()`, etc.).
m2
| Characteristic | Beta | 95% CI1 | p-value |
|---|---|---|---|
| (Intercept):1 | 0.93 | 0.09, 1.8 | 0.030 |
| (Intercept):2 | -0.58 | -1.1, -0.04 | 0.036 |
| (Intercept):3 | -4.5 | -5.6, -3.5 | <0.001 |
| subgrouphis_1Non Hispanic:1 | 0.94 | 0.42, 1.4 | <0.001 |
| subgrouphis_1Non Hispanic:2 | 0.77 | 0.44, 1.1 | <0.001 |
| subgrouphis_1Non Hispanic:3 | 0.49 | 0.04, 0.93 | 0.034 |
| subgroupsex_1Women:1 | 0.09 | -0.28, 0.47 | 0.6 |
| subgroupsex_1Women:2 | -0.08 | -0.28, 0.11 | 0.4 |
| subgroupsex_1Women:3 | -0.20 | -0.41, 0.01 | 0.061 |
| subgroupincom16_1secure economic resources at 16:1 | 0.40 | 0.01, 0.79 | 0.045 |
| subgroupincom16_1secure economic resources at 16:2 | 0.41 | 0.21, 0.61 | <0.001 |
| subgroupincom16_1secure economic resources at 16:3 | 0.34 | 0.12, 0.57 | 0.003 |
| subgroupborn_1Not born in US:1 | 0.23 | -0.41, 0.87 | 0.5 |
| subgroupborn_1Not born in US:2 | 0.22 | -0.15, 0.60 | 0.2 |
| subgroupborn_1Not born in US:3 | 0.43 | 0.08, 0.77 | 0.016 |
| subgroupnotsmart_1respondent was told or treated as if they are not smart:1 | -0.27 | -0.82, 0.28 | 0.3 |
| subgroupnotsmart_1respondent was told or treated as if they are not smart:2 | -0.02 | -0.25, 0.22 | 0.9 |
| subgroupnotsmart_1respondent was told or treated as if they are not smart:3 | 0.01 | -0.24, 0.26 | >0.9 |
| subgroupdisrspct_1respondent has been disrespected:1 | 0.03 | -0.58, 0.63 | >0.9 |
| subgroupdisrspct_1respondent has been disrespected:2 | 0.24 | -0.02, 0.50 | 0.066 |
| subgroupdisrspct_1respondent has been disrespected:3 | 0.12 | -0.17, 0.41 | 0.4 |
| age1(24,39]:1 | 0.62 | -0.12, 1.4 | 0.10 |
| age1(24,39]:2 | 0.47 | 0.01, 0.94 | 0.046 |
| age1(24,39]:3 | 2.5 | 1.5, 3.4 | <0.001 |
| age1(39,59]:1 | 0.64 | -0.07, 1.4 | 0.079 |
| age1(39,59]:2 | 0.29 | -0.16, 0.75 | 0.2 |
| age1(39,59]:3 | 2.1 | 1.2, 3.1 | <0.001 |
| age1(59,79]:1 | 0.54 | -0.19, 1.3 | 0.14 |
| age1(59,79]:2 | 0.07 | -0.38, 0.52 | 0.8 |
| age1(59,79]:3 | 2.3 | 1.3, 3.2 | <0.001 |
| age1(79,99]:1 | 0.09 | -0.88, 1.1 | 0.9 |
| age1(79,99]:2 | -0.12 | -0.69, 0.46 | 0.7 |
| age1(79,99]:3 | 2.4 | 1.4, 3.4 | <0.001 |
|
1
CI = Confidence Interval
|
|||
summary(fit.vgam2)
## svy_vglm.survey.design(as.ordered(AllEducLevels) ~ subgrouphis_1 +
## subgroupsex_1 + subgroupincom16_1 + subgroupborn_1 + subgroupnotsmart_1 +
## subgroupdisrspct_1 + age1, design = des, family = cumulative(parallel = F,
## reverse = T))
## Stratified Independent Sampling design (with replacement)
## svydesign(ids = ~1, strata = ~vstrat, weights = ~wtssnrps, data = gss2021_ZERODraft)
## Coef
## (Intercept):1 0.9343258
## (Intercept):2 -0.5784617
## (Intercept):3 -4.5057088
## subgrouphis_1Non Hispanic:1 0.9350170
## subgrouphis_1Non Hispanic:2 0.7733581
## subgrouphis_1Non Hispanic:3 0.4855402
## subgroupsex_1Women:1 0.0935240
## subgroupsex_1Women:2 -0.0819374
## subgroupsex_1Women:3 -0.1988551
## subgroupincom16_1secure economic resources at 16:1 0.4017130
## subgroupincom16_1secure economic resources at 16:2 0.4065278
## subgroupincom16_1secure economic resources at 16:3 0.3423570
## subgroupborn_1Not born in US:1 0.2285011
## subgroupborn_1Not born in US:2 0.2239336
## subgroupborn_1Not born in US:3 0.4263945
## subgroupnotsmart_1respondent was told or treated as if they are not smart:1 -0.2698159
## subgroupnotsmart_1respondent was told or treated as if they are not smart:2 -0.0163870
## subgroupnotsmart_1respondent was told or treated as if they are not smart:3 0.0096849
## subgroupdisrspct_1respondent has been disrespected:1 0.0273337
## subgroupdisrspct_1respondent has been disrespected:2 0.2438589
## subgroupdisrspct_1respondent has been disrespected:3 0.1194329
## age1(24,39]:1 0.6154665
## age1(24,39]:2 0.4730716
## age1(24,39]:3 2.4683476
## age1(39,59]:1 0.6411555
## age1(39,59]:2 0.2948268
## age1(39,59]:3 2.1391108
## age1(59,79]:1 0.5430693
## age1(59,79]:2 0.0683005
## age1(59,79]:3 2.2897996
## age1(79,99]:1 0.0881946
## age1(79,99]:2 -0.1159957
## age1(79,99]:3 2.4160660
## SE
## (Intercept):1 0.4310182
## (Intercept):2 0.2752018
## (Intercept):3 0.5337251
## subgrouphis_1Non Hispanic:1 0.2607338
## subgrouphis_1Non Hispanic:2 0.1680686
## subgrouphis_1Non Hispanic:3 0.2289665
## subgroupsex_1Women:1 0.1922000
## subgroupsex_1Women:2 0.0988023
## subgroupsex_1Women:3 0.1063120
## subgroupincom16_1secure economic resources at 16:1 0.2001693
## subgroupincom16_1secure economic resources at 16:2 0.1020903
## subgroupincom16_1secure economic resources at 16:3 0.1137320
## subgroupborn_1Not born in US:1 0.3250940
## subgroupborn_1Not born in US:2 0.1931003
## subgroupborn_1Not born in US:3 0.1777986
## subgroupnotsmart_1respondent was told or treated as if they are not smart:1 0.2805300
## subgroupnotsmart_1respondent was told or treated as if they are not smart:2 0.1205554
## subgroupnotsmart_1respondent was told or treated as if they are not smart:3 0.1291574
## subgroupdisrspct_1respondent has been disrespected:1 0.3087924
## subgroupdisrspct_1respondent has been disrespected:2 0.1325071
## subgroupdisrspct_1respondent has been disrespected:3 0.1483404
## age1(24,39]:1 0.3754966
## age1(24,39]:2 0.2373113
## age1(24,39]:3 0.4804805
## age1(39,59]:1 0.3647360
## age1(39,59]:2 0.2299310
## age1(39,59]:3 0.4799254
## age1(59,79]:1 0.3718621
## age1(59,79]:2 0.2301180
## age1(59,79]:3 0.4820338
## age1(79,99]:1 0.4956352
## age1(79,99]:2 0.2949985
## age1(79,99]:3 0.5231528
## z
## (Intercept):1 2.1677
## (Intercept):2 -2.1020
## (Intercept):3 -8.4420
## subgrouphis_1Non Hispanic:1 3.5861
## subgrouphis_1Non Hispanic:2 4.6014
## subgrouphis_1Non Hispanic:3 2.1206
## subgroupsex_1Women:1 0.4866
## subgroupsex_1Women:2 -0.8293
## subgroupsex_1Women:3 -1.8705
## subgroupincom16_1secure economic resources at 16:1 2.0069
## subgroupincom16_1secure economic resources at 16:2 3.9820
## subgroupincom16_1secure economic resources at 16:3 3.0102
## subgroupborn_1Not born in US:1 0.7029
## subgroupborn_1Not born in US:2 1.1597
## subgroupborn_1Not born in US:3 2.3982
## subgroupnotsmart_1respondent was told or treated as if they are not smart:1 -0.9618
## subgroupnotsmart_1respondent was told or treated as if they are not smart:2 -0.1359
## subgroupnotsmart_1respondent was told or treated as if they are not smart:3 0.0750
## subgroupdisrspct_1respondent has been disrespected:1 0.0885
## subgroupdisrspct_1respondent has been disrespected:2 1.8403
## subgroupdisrspct_1respondent has been disrespected:3 0.8051
## age1(24,39]:1 1.6391
## age1(24,39]:2 1.9935
## age1(24,39]:3 5.1372
## age1(39,59]:1 1.7579
## age1(39,59]:2 1.2822
## age1(39,59]:3 4.4572
## age1(59,79]:1 1.4604
## age1(59,79]:2 0.2968
## age1(59,79]:3 4.7503
## age1(79,99]:1 0.1779
## age1(79,99]:2 -0.3932
## age1(79,99]:3 4.6183
## p
## (Intercept):1 0.0301802
## (Intercept):2 0.0355572
## (Intercept):3 < 2.2e-16
## subgrouphis_1Non Hispanic:1 0.0003357
## subgrouphis_1Non Hispanic:2 4.196e-06
## subgrouphis_1Non Hispanic:3 0.0339578
## subgroupsex_1Women:1 0.6265437
## subgroupsex_1Women:2 0.4069310
## subgroupsex_1Women:3 0.0614162
## subgroupincom16_1secure economic resources at 16:1 0.0447639
## subgroupincom16_1secure economic resources at 16:2 6.833e-05
## subgroupincom16_1secure economic resources at 16:3 0.0026107
## subgroupborn_1Not born in US:1 0.4821324
## subgroupborn_1Not born in US:2 0.2461812
## subgroupborn_1Not born in US:3 0.0164764
## subgroupnotsmart_1respondent was told or treated as if they are not smart:1 0.3361463
## subgroupnotsmart_1respondent was told or treated as if they are not smart:2 0.8918773
## subgroupnotsmart_1respondent was told or treated as if they are not smart:3 0.9402266
## subgroupdisrspct_1respondent has been disrespected:1 0.9294648
## subgroupdisrspct_1respondent has been disrespected:2 0.0657175
## subgroupdisrspct_1respondent has been disrespected:3 0.4207462
## age1(24,39]:1 0.1011979
## age1(24,39]:2 0.0462106
## age1(24,39]:3 2.788e-07
## age1(39,59]:1 0.0787710
## age1(39,59]:2 0.1997584
## age1(39,59]:3 8.305e-06
## age1(59,79]:1 0.1441788
## age1(59,79]:2 0.7666142
## age1(59,79]:3 2.031e-06
## age1(79,99]:1 0.8587681
## age1(79,99]:2 0.6941661
## age1(79,99]:3 3.869e-06
-2*fit.vgam$fit@criterion$loglikelihood + 2*length(fit.vgam$coef)
## [1] 5402.184
-2*fit.vgam2$fit@criterion$loglikelihood + 2*length(fit.vgam2$coef)
## [1] 5377.354