Loading in Data

#all crosswalks

ddi <- read_ipums_ddi("usa_00013.xml")
all_indicator_data <- read_ipums_micro(ddi)
## Use of data from IPUMS USA is subject to conditions including that users should cite the data appropriately. Use command `ipums_conditions()` for more details.
#2022
poverty_2022 <- read.csv("../ACS_DATA/2022/ACSDT5Y2022.B16009-Data.csv")
language_2022 <- read.csv("../ACS_DATA/2022/ACSST5Y2022.S1601-Data.csv")
social_2022 <- read.csv("../ACS_DATA/2022/ACSCP5Y2022.CP02-Data.csv")
characteristics_2022 <- read.csv("../ACS_DATA/2022/ACSST5Y2022.S1603-Data.csv")
limited_eng_2022 <- read.csv("../ACS_DATA/2022/ACSST5Y2022.S1602-Data.csv")
household_2022 <- read.csv("../ACS_DATA/2022/ACSDT5Y2022.B16002-Data.csv")
education_2022 <- read.csv("../ACS_DATA/2022/ACSDT5Y2022.B16010-Data.csv")

#location data
regions <- read.csv("../location_data/County_12_Regions.csv")
rural_urban <-read.csv("../location_data/rural_urban.csv")

POVERTY

Used ACS 5 Year 2022 Data to calculate regional percent point change of children below poverty line by primary langauge spoken at home. First cleaned 2022 data, merged with region data which has label for each county’s region then aggregated for each region.

children_poverty_2022 <- poverty_2022 |>
  #grabbing all relevant variables below poverty line
  select(Geographic.Area.Name,Estimate..Total., 
         Estimate..Total...Income.in.the.past.12.months.below.poverty.level., 
         Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years.,
         Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.only.English, 
         Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.Spanish, 
         Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.Asian.and.Pacific.Island.languages, 
         Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.other.Indo.European.languages, 
         Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.other.languages
         )|>
  
  #renaming for ease and clarity 
  rename(Total_Pop = Estimate..Total., 
         Total_Below_Line = Estimate..Total...Income.in.the.past.12.months.below.poverty.level., 
         Total_Children_Below_Line = Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years.,
         Only_English = Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.only.English, 
         Spanish = Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.Spanish, 
         Asian_Pacific_Lang = Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.Asian.and.Pacific.Island.languages, 
         Other_IndoEuro_Lang = Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.other.Indo.European.languages, 
         Other_Lang = Estimate..Total...Income.in.the.past.12.months.below.poverty.level...5.to.17.years...Speak.other.languages, 
         County = Geographic.Area.Name)|>

#fixing county names 
  
  mutate(County = sub(" County, Texas", "", County))
children_poverty_2022_regions <- left_join(children_poverty_2022, regions, by = "County")
write.csv(file = "Poverty_Children_Languages_2022.csv", children_poverty_2022_regions)
region_total <- function(bilangual_data) {
  region_totals <- bilangual_data |>
  group_by(Region)|>
  summarise(Region_Total = sum(Total_Children_Below_Line, na.rm = TRUE))

aggregated_precursor <- bilangual_data|>
  left_join(region_totals, by = "Region") |>
  mutate(Weight = Total_Children_Below_Line / Region_Total)

aggregated_data <- aggregated_precursor |>
  group_by(Region) |>
  summarise(
    Total_English = sum(Only_English * Weight, na.rm = TRUE),
    Total_Spanish = sum(Spanish * Weight, na.rm = TRUE),
    Total_Asian_Pacific = sum(Asian_Pacific_Lang * Weight, na.rm = TRUE),
    Total_IndoEuro = sum(Other_IndoEuro_Lang * Weight, na.rm = TRUE),
    Total_Other = sum(Other_Lang * Weight, na.rm = TRUE), 
    Total_Children_Below_Line = sum(Total_Children_Below_Line * Weight, na.rm = TRUE)
  ) |>
  mutate(
    Percent_English = round(Total_English / Total_Children_Below_Line, 3),
    Percent_Spanish = round(Total_Spanish / Total_Children_Below_Line, 3),
    Percent_Asian_Pacific = round(Total_Asian_Pacific / Total_Children_Below_Line, 3),
    Percent_IndoEuro = round(Total_IndoEuro / Total_Children_Below_Line, 3),
    Percent_Other = round(Total_Other / Total_Children_Below_Line, 3)
  )
  
return(aggregated_data)
}
region_children_poverty_2022 <- region_total(children_poverty_2022_regions)
write.csv(file = "Poverty_Children_Languages_Regions.csv", region_children_poverty_2022)

MICRODATA

Microdata was taken from IPUMS:

Steven Ruggles, Sarah Flood, Matthew Sobek, Daniel Backman, Annie Chen, Grace Cooper, Stephanie Richards, Renae Rodgers, and Megan Schouweiler. IPUMS USA: Version 15.0 [dataset]. Minneapolis, MN: IPUMS, 2024. https://doi.org/10.18128/D010.V15.0

The following data analysis used the same dataset which has harmonized data for various variables taken in the ACS. The specific documentation for the variables can be seen here.

A dataset was created by filtering out N/A values and “Bilingual” was added as a variable based on meeting criteria of speaking another language other than English as well as speaking English “well” or “very well” and “Not Bilingual” was dtermiend by speaking only English.

A version of the previously described data was also created with a more detailed variable named “Bilingual Status” which contains “English Monolingual”, “Bilingual” and “NE Monolingual” (Non-English Monolingual). The following parameters were taken:

  • English Monolingual: Only speaks English

  • Bilingual: Speaks a language other than English as well as speaks English “well” or “very well”

  • NE Monolingual: Speaks a language other than English as well as speaks English “not at all” or “less than well”

indicators_2022 <- all_indicator_data |>
  filter(YEAR == 2022) |>
  distinct(SERIAL, PERNUM, .keep_all = TRUE) 

LANUGUAGE CODES

Language Code
N/A 0, 95, 96, 99
English 1
Spanish 12
Asian/Pacific Islander Languages 43-56
Other Indo-European Langauges 2-8, 10-11, 13-31, 33-34, 36-37, 38, 40, 41
Other Languages 9, 32, 35, 39, 42, 57-64, 70-93, 94
Native Languages 70-94
microdat_bilingual <- indicators_2022 |> 
  filter(LANGUAGE != 1 & LANGUAGE != 0 & LANGUAGE != 95 & LANGUAGE != 96) |> #doesn't speak english at home and gets rid of invalid entries
  filter(SPEAKENG == 4 | SPEAKENG == 5) |> #speaks english well or very well 
  mutate(Bilingual = "Bilingual")

set.seed(123)
microdat_speaks_english <- indicators_2022 |>
  filter(LANGUAGE == 1 & LANGUAGE != 0 & LANGUAGE != 95 & LANGUAGE != 96) |> #speaks english at home and gets rid of invalid entries
  filter(SPEAKENG == 3) |> #speaks only english at home
  mutate(Bilingual = "Not Bilingual") |>
  sample_n(nrow(microdat_bilingual))

table(microdat_bilingual$LANGUAGE)
## 
##      2      3      4      5      6      7     10     11     12     13     14 
##   3111     15    489    137     61     70    578   3162 230457   1452    332 
##     15     16     17     18     19     20     21     22     23     25     26 
##     45    344    153   1230    126    302    450     29    343     42    109 
##     28     29     30     31     33     34     36     37     40     43     44 
##     69   1441    272  11201     79    130    499      8   7005   7533     73 
##     45     47     48     49     50     51     52     53     54     55     56 
##    379    863    942   2537   6820    371    497     72   4182    199     20 
##     57     58     59     60     61     62     63     71     72     74     75 
##   3508     16    372    760    185     98   3438      2     52      3     35 
##     81     82     84     89     94 
##      7    132     31     15    117
table(microdat_bilingual$SPEAKENG)
## 
##      4      5 
## 230792  66208
table(microdat_bilingual$AGE) #age ranges from 5 to 92
## 
##    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20 
## 3231 3606 3864 3968 3921 4333 4445 4581 4662 4733 4921 4990 5118 5510 5353 4827 
##   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36 
## 4864 4572 4568 4483 4525 4592 4495 4468 4674 4812 4571 4631 4468 4562 4765 4675 
##   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52 
## 4447 4713 4558 4845 4463 4533 4518 4436 4601 4314 4512 4279 4165 4345 4069 4030 
##   53   54   55   56   57   58   59   60   61   62   63   64   65   66   67   68 
## 3885 3803 3872 3755 3648 3686 3555 3450 3267 3330 3112 3018 3016 2937 2719 2630 
##   69   70   71   72   73   74   75   76   77   78   79   80   81   82   83   84 
## 2455 2422 2260 2082 1891 1831 1623 1465 1326 1192 1008  941  860  762  706  625 
##   85   86   87   88   92 
##  581  437  426  368 1440
table(microdat_speaks_english$LANGUAGE)
## 
##      1 
## 297000
table(microdat_speaks_english$SPEAKENG)
## 
##      3 
## 297000
table(microdat_speaks_english$AGE) #age ranges from 5 to 92
## 
##    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20 
## 3699 3823 3912 3877 3919 3980 4187 4218 4172 4147 4131 4114 4163 4396 4309 3748 
##   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36 
## 3391 3416 3359 3407 3490 3507 3649 3653 3678 3941 3801 3866 3858 3745 3783 3762 
##   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52 
## 3842 3687 3870 3829 3511 3489 3445 3429 3180 3389 3518 3610 3673 3848 3833 3705 
##   53   54   55   56   57   58   59   60   61   62   63   64   65   66   67   68 
## 3804 3778 3951 4172 4304 4507 4494 4524 4661 4537 4559 4525 4419 4354 4062 3985 
##   69   70   71   72   73   74   75   76   77   78   79   80   81   82   83   84 
## 3861 3789 3719 3498 3199 3056 2766 2523 2338 2215 2022 1779 1671 1536 1335 1217 
##   85   86   87   88   92 
## 1089 1007  835  773 3177
#english data set almost three times as large as bilingual dataset 

language_micro_data <- rbind(microdat_bilingual, microdat_speaks_english)
microdat_languages <- indicators_2022 |>
  filter(LANGUAGE != 1 & LANGUAGE != 0 & LANGUAGE != 95 & LANGUAGE != 96) |>  #doesn't speak English at home and removes invalid entries
  filter(SPEAKENG %in% c(1, 4, 5, 6)) |>  #considers only relevant SPEAKENG values
  mutate(Language_Group = case_when(
    LANGUAGE == 12 ~ "Spanish",
    LANGUAGE %in% 43:56 ~ "Asian/Pacific Islander Languages",
    LANGUAGE %in% c(2:8, 10:11, 13:31, 33:34, 36:37, 38, 40, 41) ~ "Other Indo-European Languages",
    LANGUAGE %in% c(9, 32, 35, 39, 42, 57:64, 70:93, 94) ~ "Other Languages",
    TRUE ~ "Other Languages"
  ),
  Bilingual_Status = case_when(
    SPEAKENG %in% c(4, 5) ~ "Bilingual",
    SPEAKENG %in% c(1, 6) ~ "NE Monolingual"
  ))


microdat_speaks_english <- indicators_2022 |>
  filter(LANGUAGE == 1 & LANGUAGE != 0 & LANGUAGE != 95 & LANGUAGE != 96) |> #speaks english at home and gets rid of invalid entries
  filter(SPEAKENG == 3) |> #speaks only english at home
  mutate(Language_Group = "English", 
         Bilingual_Status = "English Monolingual") 


language_micro_data_full <- rbind(microdat_languages, microdat_speaks_english)
table(language_micro_data_full$Language_Group)
## 
## Asian/Pacific Islander Languages                          English 
##                            30226                           842925 
##    Other Indo-European Languages                  Other Languages 
##                            35613                             9527 
##                          Spanish 
##                           287048
table(language_micro_data_full$Bilingual_Status)
## 
##           Bilingual English Monolingual      NE Monolingual 
##              297000              842925               65414
write.csv(file = "Extensive_Microdata_Bilingualism.csv", language_micro_data_full)
write.csv(file = "Microdata_Bilingualism.csv", language_micro_data)

OVERVIEW OF LANGUAGE ANF BILINGUAL STATUS POPUALTION COUNTS

survey_design <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  data = language_micro_data_full  
)

#calculating the total weighted counts for each language group
bilingual_stat_dist <- svytotal(~Bilingual_Status, survey_design)

print(bilingual_stat_dist)
##                                        total    SE
## Bilingual_StatusBilingual            7761055 31787
## Bilingual_StatusEnglish Monolingual 17695085 41195
## Bilingual_StatusNE Monolingual       1859404 13352
language_group_dist <- svytotal(~Language_Group, survey_design)
print(language_group_dist)
##                                                   total      SE
## Language_GroupAsian/Pacific Islander Languages   668626  9090.9
## Language_GroupEnglish                          17695085 41195.4
## Language_GroupOther Indo-European Languages      831164 10233.6
## Language_GroupOther Languages                    293443  7647.2
## Language_GroupSpanish                           7827226 35124.3
bilingual_stat_df <- as.data.frame(bilingual_stat_dist)
language_group_df <- as.data.frame(language_group_dist)

EMPLOYMENT IN MINORS

Finding average age of minors for each Bilingual Status group through survey design.

bilingual_employed_minors <- language_micro_data_full |>
  filter(AGE > 13 & AGE < 18) |>
  filter(EMPSTAT == 1) #means they are employed 

survey_design_minors <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  data = bilingual_employed_minors  
)

avg_working_age_by_status <- svyby(
  ~AGE,  
  ~Language_Group,  
  survey_design_minors,
  svymean,  
  vartype = "ci"  
)

print(avg_working_age_by_status)
##                                                    Language_Group      AGE
## Asian/Pacific Islander Languages Asian/Pacific Islander Languages 16.53576
## English                                                   English 16.62641
## Other Indo-European Languages       Other Indo-European Languages 16.60639
## Other Languages                                   Other Languages 16.67224
## Spanish                                                   Spanish 16.67545
##                                      ci_l     ci_u
## Asian/Pacific Islander Languages 16.39453 16.67698
## English                          16.60735 16.64547
## Other Indo-European Languages    16.48785 16.72493
## Other Languages                  16.46134 16.88314
## Spanish                          16.64305 16.70784

HEALTHCARE COVERAGE

Finding percentage of healthcare coverage for each Bilingual_Status group.

language_micro_data_health <- language_micro_data_full |>
  mutate(HCOVANY = ifelse(HCOVANY == 2, 1, 0))

healthcare_des <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  data = language_micro_data_health
)

healthcare_coverage_by_language <- svyby(
  ~HCOVANY,  
  ~Bilingual_Status,  
  healthcare_des, 
  svymean
)

#subtracting to find no coverage values 
healthcare_coverage_by_language <- healthcare_coverage_by_language |>
  mutate(NoCoverage = 1-HCOVANY)
write.csv(file = "HealthcareCoverage_By_Language.csv", healthcare_coverage_by_language)

POVERTY

With micro data for each bilingual status group

language_micro_data_pov <- language_micro_data_full |>
  filter(POVERTY != 0) |>
  mutate(below_poverty_line = if_else(POVERTY < 100, 1, 0))

poverty_des <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  strata = ~STRATA,
  data = language_micro_data_pov
)

poverty_by_biling_stat <- svyby(
  ~below_poverty_line,  
  ~Bilingual_Status,  
  poverty_des, 
  svymean,  
)

print(poverty_by_biling_stat)
##                        Bilingual_Status below_poverty_line           se
## Bilingual                     Bilingual         0.14605305 0.0015646012
## English Monolingual English Monolingual         0.09975716 0.0008041401
## NE Monolingual           NE Monolingual         0.23037262 0.0031004821
write.csv(file = "Poverty_Rate_BilingStat.csv", poverty_by_biling_stat)

HOME OWNERSHIP

language_micro_data_home <- language_micro_data_full |>
  select(CLUSTER, STRATA, PERWT, OWNERSHP, Bilingual_Status, Language_Group) |>
  filter(OWNERSHP != 0) |>
  mutate(OWNERSHP = if_else(OWNERSHP == 2, 0, 1))

poverty_des <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  strata = ~STRATA,
  data = language_micro_data_home
)

homeownership_by_biling_stat <- svyby(
  ~OWNERSHP,  
  ~Bilingual_Status,  
  poverty_des, 
  svymean,  
)

print(homeownership_by_biling_stat)
##                        Bilingual_Status  OWNERSHP          se
## Bilingual                     Bilingual 0.6646292 0.002031540
## English Monolingual English Monolingual 0.6789625 0.001306859
## NE Monolingual           NE Monolingual 0.5516144 0.003705897
write.csv(file = "HomeOwnership_By_BilingStat.csv", homeownership_by_biling_stat)

FAMILY SIZE

Finding proportion of Bilingual_Status for each number of children in a household. First was done as just a simple overview to see if there is a remarkable difference in distribution and then when difference was seen a survey design was done.

household_data <- language_micro_data_full |>
  select(SERIAL, NCHILD, HHWT, Bilingual_Status, STRATA, PERWT) |>
  distinct(SERIAL, .keep_all = TRUE)

household_data <- household_data |>
  mutate(Child_Category = case_when(
    NCHILD == 0 ~ "0 Children",
    NCHILD == 1 ~ "1 Child",
    NCHILD == 2 ~ "2 Children",
    NCHILD >= 3 ~ "More than 3 Children"
  ))

household_summary <- household_data |>
  group_by(Bilingual_Status, Child_Category) |>
  summarize(
    Count = n(),
    Total_Weight = sum(HHWT, na.rm = TRUE),
    .groups = 'drop'
  ) |>
  group_by(Bilingual_Status) |>
  mutate(
    Total_Households = sum(Total_Weight),
    Percentage = Total_Weight / Total_Households * 100
  )

print(household_summary)
## # A tibble: 12 × 6
## # Groups:   Bilingual_Status [3]
##    Bilingual_Status    Child_Category        Count Total_Weight Total_Households
##    <chr>               <chr>                 <int>        <dbl>            <dbl>
##  1 Bilingual           0 Children            73918      1573350          3253211
##  2 Bilingual           1 Child               27073       656272          3253211
##  3 Bilingual           2 Children            22420       594798          3253211
##  4 Bilingual           More than 3 Children  14772       428791          3253211
##  5 English Monolingual 0 Children           264844      4688190          7048317
##  6 English Monolingual 1 Child               53439      1126204          7048317
##  7 English Monolingual 2 Children            34742       794271          7048317
##  8 English Monolingual More than 3 Children  18084       439652          7048317
##  9 NE Monolingual      0 Children            13650       324519           795889
## 10 NE Monolingual      1 Child                6106       175213           795889
## 11 NE Monolingual      2 Children             4843       146405           795889
## 12 NE Monolingual      More than 3 Children   4499       149752           795889
## # ℹ 1 more variable: Percentage <dbl>
library(ggplot2)

ggplot(household_summary, aes(x = Child_Category, y = Percentage, fill = Bilingual_Status)) +
  geom_bar(stat = "identity", position = "dodge") +
  ggtitle("Percentage of Households by Number of Children and Bilingual Status") +
  xlab("Number of Children") +
  ylab("Percentage of Households") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

Survey Design

#creating the survey object
des_number_of_children <- svydesign(ids = ~1, 
                 strata = ~STRATA, 
                 weights = ~HHWT, 
                 data = household_data)

household_data_at_least_one_kid <- household_data |>
  filter(NCHILD > 0)

des_at_least_one_kid <- svydesign(ids = ~1, 
                 strata = ~STRATA, 
                 weights = ~HHWT, 
                 data = household_data_at_least_one_kid)
mean_by_bilingual <- svyby(~NCHILD, ~Bilingual_Status, des_number_of_children, svymean, na.rm = TRUE)

print(mean_by_bilingual)
##                        Bilingual_Status    NCHILD          se
## Bilingual                     Bilingual 1.0183680 0.004989489
## English Monolingual English Monolingual 0.5973837 0.002646491
## NE Monolingual           NE Monolingual 1.2481464 0.010952123
options(scipen = 999)
tab <- svytable(~Bilingual_Status + NCHILD, des_number_of_children)

proportion_table <- prop.table(tab, margin = 2) 

print(proportion_table)
##                      NCHILD
## Bilingual_Status               0          1          2          3          4
##   Bilingual           0.23889097 0.33522791 0.38737094 0.42292651 0.41720879
##   English Monolingual 0.71183541 0.57527217 0.51728066 0.44208910 0.41008893
##   NE Monolingual      0.04927362 0.08949992 0.09534841 0.13498439 0.17270228
##                      NCHILD
## Bilingual_Status               5          6          7          8          9
##   Bilingual           0.42167388 0.38825633 0.43330778 0.51245387 0.31194472
##   English Monolingual 0.39854910 0.42456036 0.45477194 0.24308118 0.49062192
##   NE Monolingual      0.17977702 0.18718331 0.11192028 0.24446494 0.19743337
bilingual_number_of_children <- as.data.frame(proportion_table)

num_children_by_language_cat <- bilingual_number_of_children |>
  pivot_wider(names_from = NCHILD, values_from = Freq)
write.csv(file = "Number_of_Children_AllLanguageCats.csv", num_children_by_language_cat)

INCOME

Finding different distributions of income by education and diffrent bilingual groups and languages.

income_data_2022 <- language_micro_data |>
  select(AGE, INCTOT, Bilingual, PERWT, SEX, EDUCD, AGE, CLUSTER, STRATA, YEAR) |>
  filter(INCTOT != 9999999 & INCTOT > 0) |>
  filter(AGE > 18 & AGE < 65)

Using Survey Design for Overview Analysis of Simple Bilingual vs. Not Bilingual

#setting it up
options(survey.lonely.psu = "adjust")

#creating the survey object
income_des <- svydesign(ids = ~CLUSTER, 
                 strata = ~STRATA, 
                 weights = ~PERWT, 
                 data = income_data_2022)

#calculatng median by setting quantile to %50
median_income <- svyby(~INCTOT,
                       ~Bilingual,
                       income_des,
                       svyquantile,
                       quantiles = 0.5,
                       ci = TRUE)
## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available
print(median_income)
##                   Bilingual INCTOT       se
## Bilingual         Bilingual  36475 130.1030
## Not Bilingual Not Bilingual  45000 202.0427
#splitting into proper quintiles 
income_data <- income_data_2022 |>
  group_by(Bilingual)|>
  mutate(quintile = ntile(INCTOT, 5)) |>
  ungroup()

#creating a survey design with modified income data
des <- svydesign(ids = ~CLUSTER, 
                 strata = ~STRATA, 
                 weights = ~PERWT, 
                 data = income_data)

#median for each quintile in income group
median_by_quintile <- svyby(~INCTOT, ~interaction(Bilingual, quintile), des, svyquantile, quantiles = 0.5, ci = TRUE)
## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available
print(median_by_quintile)
##                 interaction(Bilingual, quintile)     INCTOT        se
## Bilingual.1                          Bilingual.1   7584.811  81.88591
## Not Bilingual.1                  Not Bilingual.1   7599.000 112.49741
## Bilingual.2                          Bilingual.2  21900.000  62.24347
## Not Bilingual.2                  Not Bilingual.2  24861.000  96.68145
## Bilingual.3                          Bilingual.3  36400.000 122.95643
## Not Bilingual.3                  Not Bilingual.3  45360.000  57.65174
## Bilingual.4                          Bilingual.4  58453.000 106.23887
## Not Bilingual.4                  Not Bilingual.4  71189.000 168.11449
## Bilingual.5                          Bilingual.5 110000.000 565.80342
## Not Bilingual.5                  Not Bilingual.5 135977.000 424.99025
#changing the names of columns for clarity and separating interaction
final_median_by_quintile <- median_by_quintile |> 
  separate(`interaction(Bilingual, quintile)`, into = c("Bilingual", "Quintile"), sep = "\\.") |>
  rename(median_income = INCTOT) 

Income Medians by Education

CODES:

CODE Educational Level
001 & 999 N/a & missing
002 no schooling completed
10-61 grade school
062 high school or GED
65-100 one or more years of college, no degree
101 bachelors
114 masters
115 professional degree beyond bachelors
116 doctoral
library(dplyr)
income_data_education <- income_data_2022 |>
  mutate(Educational_Level = case_when(
    EDUCD %in% c(1, 999) ~ "N/A or Missing",
    EDUCD == 2 ~ "No Schooling Completed",
    EDUCD >= 10 & EDUCD < 62 ~ "No High School Degree or GED",
    EDUCD >= 62 & EDUCD < 65 ~ "High School or GED",
    EDUCD >= 65 & EDUCD <= 100 ~ "Some College, No Degree",
    EDUCD == 101 ~ "Bachelor's",
    EDUCD == 114 ~ "Master's",
    EDUCD == 115 ~ "Professional Degree Beyond Bachelor's",
    EDUCD == 116 ~ "Doctoral",
    TRUE ~ NA_character_  
  ))

print(income_data_education)
## # A tibble: 319,848 × 10
##    AGE       INCTOT    Bilingual PERWT SEX        EDUCD     CLUSTER STRATA  YEAR
##    <int+lbl> <dbl+lbl> <chr>     <dbl> <int+lbl>  <int+lbl>   <dbl>  <dbl> <int>
##  1 34        75989     Bilingual    20 1 [Male]   63 [Regu… 2.02e12  70048  2022
##  2 23         1169     Bilingual     8 1 [Male]   71 [1 or… 2.02e12 510048  2022
##  3 19        11691     Bilingual     8 1 [Male]   65 [Some… 2.02e12 400048  2022
##  4 19          701     Bilingual    11 1 [Male]   71 [1 or… 2.02e12 460348  2022
##  5 20        11691     Bilingual    10 1 [Male]   71 [1 or… 2.02e12 690048  2022
##  6 22         4676     Bilingual    16 2 [Female] 71 [1 or… 2.02e12 590248  2022
##  7 58        30863     Bilingual    17 1 [Male]   63 [Regu… 2.02e12 380148  2022
##  8 52        35072     Bilingual    18 1 [Male]   71 [1 or… 2.02e12 680748  2022
##  9 42         2104     Bilingual     6 1 [Male]   81 [Asso… 2.02e12 690048  2022
## 10 31         9352     Bilingual    16 1 [Male]   40 [Grad… 2.02e12 462548  2022
## # ℹ 319,838 more rows
## # ℹ 1 more variable: Educational_Level <chr>
income_data_education |>
  filter(is.na(Educational_Level))
## # A tibble: 0 × 10
## # ℹ 10 variables: AGE <int+lbl>, INCTOT <dbl+lbl>, Bilingual <chr>,
## #   PERWT <dbl>, SEX <int+lbl>, EDUCD <int+lbl>, CLUSTER <dbl>, STRATA <dbl>,
## #   YEAR <int>, Educational_Level <chr>
#creating survey design for education dataset
des_edu <- svydesign(ids = ~CLUSTER, 
                     strata = ~STRATA, 
                     weights = ~PERWT, 
                     data = income_data_education)

#calculating the median income for each education level within each bilingual group
median_by_education <- svyby(~INCTOT, ~interaction(Bilingual, Educational_Level), des_edu, svyquantile, quantiles = 0.5, ci = TRUE)
## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available
#for clarity
median_by_education <- median_by_education |>
  separate(`interaction(Bilingual, Educational_Level)`, into = c("Bilingual", "Educational_Level"), sep = "\\.")|>
  rename(median_income = INCTOT) |>
  rename(se_median_income = se) |>
  select(Bilingual, Educational_Level, median_income, se_median_income)

print(median_by_education)
##                                                         Bilingual
## Bilingual.Bachelor's                                    Bilingual
## Not Bilingual.Bachelor's                            Not Bilingual
## Bilingual.Doctoral                                      Bilingual
## Not Bilingual.Doctoral                              Not Bilingual
## Bilingual.High School or GED                            Bilingual
## Not Bilingual.High School or GED                    Not Bilingual
## Bilingual.Master's                                      Bilingual
## Not Bilingual.Master's                              Not Bilingual
## Bilingual.No High School Degree or GED                  Bilingual
## Not Bilingual.No High School Degree or GED          Not Bilingual
## Bilingual.No Schooling Completed                        Bilingual
## Not Bilingual.No Schooling Completed                Not Bilingual
## Bilingual.Professional Degree Beyond Bachelor's         Bilingual
## Not Bilingual.Professional Degree Beyond Bachelor's Not Bilingual
## Bilingual.Some College, No Degree                       Bilingual
## Not Bilingual.Some College, No Degree               Not Bilingual
##                                                                         Educational_Level
## Bilingual.Bachelor's                                                           Bachelor's
## Not Bilingual.Bachelor's                                                       Bachelor's
## Bilingual.Doctoral                                                               Doctoral
## Not Bilingual.Doctoral                                                           Doctoral
## Bilingual.High School or GED                                           High School or GED
## Not Bilingual.High School or GED                                       High School or GED
## Bilingual.Master's                                                               Master's
## Not Bilingual.Master's                                                           Master's
## Bilingual.No High School Degree or GED                       No High School Degree or GED
## Not Bilingual.No High School Degree or GED                   No High School Degree or GED
## Bilingual.No Schooling Completed                                   No Schooling Completed
## Not Bilingual.No Schooling Completed                               No Schooling Completed
## Bilingual.Professional Degree Beyond Bachelor's     Professional Degree Beyond Bachelor's
## Not Bilingual.Professional Degree Beyond Bachelor's Professional Degree Beyond Bachelor's
## Bilingual.Some College, No Degree                                 Some College, No Degree
## Not Bilingual.Some College, No Degree                             Some College, No Degree
##                                                     median_income
## Bilingual.Bachelor's                                        56207
## Not Bilingual.Bachelor's                                    65000
## Bilingual.Doctoral                                          93525
## Not Bilingual.Doctoral                                     100000
## Bilingual.High School or GED                                29854
## Not Bilingual.High School or GED                            30000
## Bilingual.Master's                                          80375
## Not Bilingual.Master's                                      76745
## Bilingual.No High School Degree or GED                      28329
## Not Bilingual.No High School Degree or GED                  20898
## Bilingual.No Schooling Completed                            30266
## Not Bilingual.No Schooling Completed                        21618
## Bilingual.Professional Degree Beyond Bachelor's             95000
## Not Bilingual.Professional Degree Beyond Bachelor's        120000
## Bilingual.Some College, No Degree                           32427
## Not Bilingual.Some College, No Degree                       38000
##                                                     se_median_income
## Bilingual.Bachelor's                                        445.4339
## Not Bilingual.Bachelor's                                    221.1701
## Bilingual.Doctoral                                         2383.8568
## Not Bilingual.Doctoral                                     2598.1888
## Bilingual.High School or GED                                197.4458
## Not Bilingual.High School or GED                            235.4551
## Bilingual.Master's                                          613.4615
## Not Bilingual.Master's                                      996.9706
## Bilingual.No High School Degree or GED                      179.8377
## Not Bilingual.No High School Degree or GED                  514.2023
## Bilingual.No Schooling Completed                            756.1098
## Not Bilingual.No Schooling Completed                       1343.5167
## Bilingual.Professional Degree Beyond Bachelor's            4296.4547
## Not Bilingual.Professional Degree Beyond Bachelor's        3897.1960
## Bilingual.Some College, No Degree                           187.2428
## Not Bilingual.Some College, No Degree                       383.4156
median_by_education_wide <- median_by_education |>
  pivot_wider(names_from = Educational_Level, 
              values_from = c(median_income, se_median_income))

print(median_by_education_wide)
## # A tibble: 2 × 17
##   Bilingual median_income_Bachel…¹ median_income_Doctoral median_income_High S…²
##   <chr>                      <dbl>                  <dbl>                  <dbl>
## 1 Bilingual                  56207                  93525                  29854
## 2 Not Bili…                  65000                 100000                  30000
## # ℹ abbreviated names: ¹​`median_income_Bachelor's`,
## #   ²​`median_income_High School or GED`
## # ℹ 13 more variables: `median_income_Master's` <dbl>,
## #   `median_income_No High School Degree or GED` <dbl>,
## #   `median_income_No Schooling Completed` <dbl>,
## #   `median_income_Professional Degree Beyond Bachelor's` <dbl>,
## #   `median_income_Some College, No Degree` <dbl>, …

EXTENSIVE BILINGUAL

income_data_full <- language_micro_data_full |>
  select(AGE, INCTOT, Language_Group, PERWT, SEX, EDUCD, AGE, CLUSTER, STRATA, YEAR, Bilingual_Status) |>
  filter(INCTOT != 9999999 & INCTOT > 0) |>
  filter(AGE > 18 & AGE < 65) |>
  filter(Bilingual_Status %in% c("English Monolingual", "Bilingual"))

#recalibrating weights similar to the previous dataset
sum_weights_filtered_full <- sum(income_data_full$PERWT, na.rm = TRUE)
sum_weights_original_full <- sum(language_micro_data_full$PERWT, na.rm = TRUE)

income_data_full <- income_data_full |>
  mutate(recalibrated_weight = PERWT * (sum_weights_filtered_full / sum_weights_original_full))

#applying the educational level mapping function
income_data_full <- income_data_full |>
  mutate(Educational_Level = case_when(
    EDUCD %in% c(1, 999) ~ "N/A or Missing",
    EDUCD == 2 ~ "No Schooling Completed",
    EDUCD >= 10 & EDUCD < 62 ~ "No High School Degree or GED",
    EDUCD >= 62 & EDUCD < 65 ~ "High School or GED",
    EDUCD >= 65 & EDUCD <= 100 ~ "Some College, No Degree",
    EDUCD == 101 ~ "Bachelor's",
    EDUCD == 114 ~ "Master's",
    EDUCD == 115 ~ "Professional Degree Beyond Bachelor's",
    EDUCD == 116 ~ "Doctoral",
    TRUE ~ NA_character_
  )) |>
  filter(!is.na(INCTOT), !is.na(PERWT), !is.na(EDUCD))
#survey design object
des_full <- svydesign(ids = ~CLUSTER, 
                      strata = ~STRATA, 
                      weights = ~PERWT, 
                      data = income_data_full)

#calculating the median income for each education level within each language group
median_by_education_full <- svyby(~INCTOT, ~interaction(Language_Group, Educational_Level), des_full, svyquantile, quantiles = 0.5, ci = TRUE)
## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available
#formatting the results for clarity
median_by_education_full <- median_by_education_full |>
  separate(`interaction(Language_Group, Educational_Level)`, into = c("Language_Group", "Educational_Level"), sep = "\\.") |>
  rename(median_income = INCTOT) |>
  rename(se_median_income = se) |>
  select(Language_Group, Educational_Level, median_income, se_median_income)

print(median_by_education_full)
##                                                                                          Language_Group
## Asian/Pacific Islander Languages.Bachelor's                            Asian/Pacific Islander Languages
## English.Bachelor's                                                                              English
## Other Indo-European Languages.Bachelor's                                  Other Indo-European Languages
## Other Languages.Bachelor's                                                              Other Languages
## Spanish.Bachelor's                                                                              Spanish
## Asian/Pacific Islander Languages.Doctoral                              Asian/Pacific Islander Languages
## English.Doctoral                                                                                English
## Other Indo-European Languages.Doctoral                                    Other Indo-European Languages
## Other Languages.Doctoral                                                                Other Languages
## Spanish.Doctoral                                                                                Spanish
## Asian/Pacific Islander Languages.High School or GED                    Asian/Pacific Islander Languages
## English.High School or GED                                                                      English
## Other Indo-European Languages.High School or GED                          Other Indo-European Languages
## Other Languages.High School or GED                                                      Other Languages
## Spanish.High School or GED                                                                      Spanish
## Asian/Pacific Islander Languages.Master's                              Asian/Pacific Islander Languages
## English.Master's                                                                                English
## Other Indo-European Languages.Master's                                    Other Indo-European Languages
## Other Languages.Master's                                                                Other Languages
## Spanish.Master's                                                                                Spanish
## Asian/Pacific Islander Languages.No High School Degree or GED          Asian/Pacific Islander Languages
## English.No High School Degree or GED                                                            English
## Other Indo-European Languages.No High School Degree or GED                Other Indo-European Languages
## Other Languages.No High School Degree or GED                                            Other Languages
## Spanish.No High School Degree or GED                                                            Spanish
## Asian/Pacific Islander Languages.No Schooling Completed                Asian/Pacific Islander Languages
## English.No Schooling Completed                                                                  English
## Other Indo-European Languages.No Schooling Completed                      Other Indo-European Languages
## Other Languages.No Schooling Completed                                                  Other Languages
## Spanish.No Schooling Completed                                                                  Spanish
## Asian/Pacific Islander Languages.Professional Degree Beyond Bachelor's Asian/Pacific Islander Languages
## English.Professional Degree Beyond Bachelor's                                                   English
## Other Indo-European Languages.Professional Degree Beyond Bachelor's       Other Indo-European Languages
## Other Languages.Professional Degree Beyond Bachelor's                                   Other Languages
## Spanish.Professional Degree Beyond Bachelor's                                                   Spanish
## Asian/Pacific Islander Languages.Some College, No Degree               Asian/Pacific Islander Languages
## English.Some College, No Degree                                                                 English
## Other Indo-European Languages.Some College, No Degree                     Other Indo-European Languages
## Other Languages.Some College, No Degree                                                 Other Languages
## Spanish.Some College, No Degree                                                                 Spanish
##                                                                                            Educational_Level
## Asian/Pacific Islander Languages.Bachelor's                                                       Bachelor's
## English.Bachelor's                                                                                Bachelor's
## Other Indo-European Languages.Bachelor's                                                          Bachelor's
## Other Languages.Bachelor's                                                                        Bachelor's
## Spanish.Bachelor's                                                                                Bachelor's
## Asian/Pacific Islander Languages.Doctoral                                                           Doctoral
## English.Doctoral                                                                                    Doctoral
## Other Indo-European Languages.Doctoral                                                              Doctoral
## Other Languages.Doctoral                                                                            Doctoral
## Spanish.Doctoral                                                                                    Doctoral
## Asian/Pacific Islander Languages.High School or GED                                       High School or GED
## English.High School or GED                                                                High School or GED
## Other Indo-European Languages.High School or GED                                          High School or GED
## Other Languages.High School or GED                                                        High School or GED
## Spanish.High School or GED                                                                High School or GED
## Asian/Pacific Islander Languages.Master's                                                           Master's
## English.Master's                                                                                    Master's
## Other Indo-European Languages.Master's                                                              Master's
## Other Languages.Master's                                                                            Master's
## Spanish.Master's                                                                                    Master's
## Asian/Pacific Islander Languages.No High School Degree or GED                   No High School Degree or GED
## English.No High School Degree or GED                                            No High School Degree or GED
## Other Indo-European Languages.No High School Degree or GED                      No High School Degree or GED
## Other Languages.No High School Degree or GED                                    No High School Degree or GED
## Spanish.No High School Degree or GED                                            No High School Degree or GED
## Asian/Pacific Islander Languages.No Schooling Completed                               No Schooling Completed
## English.No Schooling Completed                                                        No Schooling Completed
## Other Indo-European Languages.No Schooling Completed                                  No Schooling Completed
## Other Languages.No Schooling Completed                                                No Schooling Completed
## Spanish.No Schooling Completed                                                        No Schooling Completed
## Asian/Pacific Islander Languages.Professional Degree Beyond Bachelor's Professional Degree Beyond Bachelor's
## English.Professional Degree Beyond Bachelor's                          Professional Degree Beyond Bachelor's
## Other Indo-European Languages.Professional Degree Beyond Bachelor's    Professional Degree Beyond Bachelor's
## Other Languages.Professional Degree Beyond Bachelor's                  Professional Degree Beyond Bachelor's
## Spanish.Professional Degree Beyond Bachelor's                          Professional Degree Beyond Bachelor's
## Asian/Pacific Islander Languages.Some College, No Degree                             Some College, No Degree
## English.Some College, No Degree                                                      Some College, No Degree
## Other Indo-European Languages.Some College, No Degree                                Some College, No Degree
## Other Languages.Some College, No Degree                                              Some College, No Degree
## Spanish.Some College, No Degree                                                      Some College, No Degree
##                                                                        median_income
## Asian/Pacific Islander Languages.Bachelor's                                 59450.00
## English.Bachelor's                                                          64855.00
## Other Indo-European Languages.Bachelor's                                    70000.00
## Other Languages.Bachelor's                                                  47230.70
## Spanish.Bachelor's                                                          54046.00
## Asian/Pacific Islander Languages.Doctoral                                  102239.00
## English.Doctoral                                                           100000.00
## Other Indo-European Languages.Doctoral                                     101154.62
## Other Languages.Doctoral                                                    81973.90
## Spanish.Doctoral                                                            81068.00
## Asian/Pacific Islander Languages.High School or GED                         28074.30
## English.High School or GED                                                  30000.00
## Other Indo-European Languages.High School or GED                            28705.00
## Other Languages.High School or GED                                          28057.00
## Spanish.High School or GED                                                  30000.00
## Asian/Pacific Islander Languages.Master's                                   82850.08
## English.Master's                                                            77826.00
## Other Indo-European Languages.Master's                                     103116.00
## Other Languages.Master's                                                    74634.00
## Spanish.Master's                                                            68893.00
## Asian/Pacific Islander Languages.No High School Degree or GED               31698.52
## English.No High School Degree or GED                                        20963.00
## Other Indo-European Languages.No High School Degree or GED                  29904.83
## Other Languages.No High School Degree or GED                                25000.00
## Spanish.No High School Degree or GED                                        28329.00
## Asian/Pacific Islander Languages.No Schooling Completed                     30018.14
## English.No Schooling Completed                                              21618.00
## Other Indo-European Languages.No Schooling Completed                        30419.41
## Other Languages.No Schooling Completed                                      33795.24
## Spanish.No Schooling Completed                                              30255.00
## Asian/Pacific Islander Languages.Professional Degree Beyond Bachelor's      91102.28
## English.Professional Degree Beyond Bachelor's                              120000.00
## Other Indo-European Languages.Professional Degree Beyond Bachelor's        114617.83
## Other Languages.Professional Degree Beyond Bachelor's                      124490.23
## Spanish.Professional Degree Beyond Bachelor's                               78325.10
## Asian/Pacific Islander Languages.Some College, No Degree                    30000.00
## English.Some College, No Degree                                             38000.00
## Other Indo-European Languages.Some College, No Degree                       34447.00
## Other Languages.Some College, No Degree                                     30000.00
## Spanish.Some College, No Degree                                             32427.00
##                                                                        se_median_income
## Asian/Pacific Islander Languages.Bachelor's                                   1362.4182
## English.Bachelor's                                                             104.8475
## Other Indo-European Languages.Bachelor's                                      1141.4951
## Other Languages.Bachelor's                                                    1723.9317
## Spanish.Bachelor's                                                             519.1036
## Asian/Pacific Islander Languages.Doctoral                                     4196.6798
## English.Doctoral                                                              1492.3125
## Other Indo-European Languages.Doctoral                                        4620.7485
## Other Languages.Doctoral                                                      6719.6196
## Spanish.Doctoral                                                              4290.6418
## Asian/Pacific Islander Languages.High School or GED                            793.1265
## English.High School or GED                                                     137.2455
## Other Indo-European Languages.High School or GED                               652.8833
## Other Languages.High School or GED                                            1161.2904
## Spanish.High School or GED                                                     197.4450
## Asian/Pacific Islander Languages.Master's                                     2017.9180
## English.Master's                                                               826.0083
## Other Indo-European Languages.Master's                                        1434.2437
## Other Languages.Master's                                                      4306.6470
## Spanish.Master's                                                               513.1665
## Asian/Pacific Islander Languages.No High School Degree or GED                 1638.2313
## English.No High School Degree or GED                                           311.4651
## Other Indo-European Languages.No High School Degree or GED                    1637.4436
## Other Languages.No High School Degree or GED                                  2468.7922
## Spanish.No High School Degree or GED                                           179.8369
## Asian/Pacific Islander Languages.No Schooling Completed                       1540.7231
## English.No Schooling Completed                                                 649.7737
## Other Indo-European Languages.No Schooling Completed                          2668.1416
## Other Languages.No Schooling Completed                                        5119.0325
## Spanish.No Schooling Completed                                                 834.3075
## Asian/Pacific Islander Languages.Professional Degree Beyond Bachelor's       10855.4245
## English.Professional Degree Beyond Bachelor's                                 2635.8749
## Other Indo-European Languages.Professional Degree Beyond Bachelor's           4638.1206
## Other Languages.Professional Degree Beyond Bachelor's                        17327.0681
## Spanish.Professional Degree Beyond Bachelor's                                 3580.6549
## Asian/Pacific Islander Languages.Some College, No Degree                      1123.2330
## English.Some College, No Degree                                                190.5628
## Other Indo-European Languages.Some College, No Degree                         1191.4365
## Other Languages.Some College, No Degree                                       1639.9328
## Spanish.Some College, No Degree                                                190.8130
#pivoting the data wider to have one row per Educational_Level
income_data_wide <- median_by_education_full |>
  pivot_wider(names_from = Language_Group, 
              values_from = c(median_income, se_median_income))

print(income_data_wide)
## # A tibble: 8 × 11
##   Educational_Level                 median_income_Asian/…¹ median_income_English
##   <chr>                                              <dbl>                 <dbl>
## 1 Bachelor's                                        59450                  64855
## 2 Doctoral                                         102239                 100000
## 3 High School or GED                                28074.                 30000
## 4 Master's                                          82850.                 77826
## 5 No High School Degree or GED                      31699.                 20963
## 6 No Schooling Completed                            30018.                 21618
## 7 Professional Degree Beyond Bache…                 91102.                120000
## 8 Some College, No Degree                           30000                  38000
## # ℹ abbreviated name: ¹​`median_income_Asian/Pacific Islander Languages`
## # ℹ 8 more variables: `median_income_Other Indo-European Languages` <dbl>,
## #   `median_income_Other Languages` <dbl>, median_income_Spanish <dbl>,
## #   `se_median_income_Asian/Pacific Islander Languages` <dbl>,
## #   se_median_income_English <dbl>,
## #   `se_median_income_Other Indo-European Languages` <dbl>,
## #   `se_median_income_Other Languages` <dbl>, se_median_income_Spanish <dbl>

Bilingual and Non-English Monolingual

#filtering and setting up the data
income_data_full_NE <- language_micro_data_full |>
  select(AGE, INCTOT, Language_Group, Bilingual_Status, PERWT, SEX, EDUCD, CLUSTER, STRATA, YEAR) |>
  filter(INCTOT != 9999999 & INCTOT > 0) |>
  filter(AGE > 18 & AGE < 65) |>
  filter(Bilingual_Status %in% c("Bilingual", "NE Monolingual")) |>
  mutate(Educational_Level = case_when(
    EDUCD %in% c(1, 999) ~ "N/A or Missing",
    EDUCD == 2 ~ "No Schooling Completed",
    EDUCD >= 10 & EDUCD < 62 ~ "No High School Degree or GED",
    EDUCD >= 62 & EDUCD < 65 ~ "High School or GED",
    EDUCD >= 65 & EDUCD <= 100 ~ "Some College, No Degree",
    EDUCD == 101 ~ "Bachelor's",
    EDUCD == 114 ~ "Master's & Professional Degree Beyond Bachelor's",
    EDUCD == 115 ~ "Master's & Professional Degree Beyond Bachelor's",
    EDUCD == 116 ~ "Doctoral",
    TRUE ~ NA_character_
  )) |>
  filter(!is.na(INCTOT), !is.na(PERWT), !is.na(EDUCD))

table(income_data_full_NE$Educational_Level)
## 
##                                       Bachelor's 
##                                            33554 
##                                         Doctoral 
##                                             3131 
##                               High School or GED 
##                                            49626 
## Master's & Professional Degree Beyond Bachelor's 
##                                            19321 
##                     No High School Degree or GED 
##                                            35302 
##                           No Schooling Completed 
##                                             7551 
##                          Some College, No Degree 
##                                            51295
des_full_NE <- svydesign(ids = ~CLUSTER, 
                      strata = ~STRATA, 
                      weights = ~PERWT, 
                      data = income_data_full_NE)

#calculating the median income by education level for each language group and bilingual status
median_by_education_full_NE <- svyby(~INCTOT, 
                                  ~interaction(Language_Group, Educational_Level, Bilingual_Status), 
                                  des_full_NE, 
                                  svyquantile, 
                                  quantiles = 0.5, 
                                  ci = TRUE)
## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available
#formatting the results for clarity
median_by_education_full_NE <- median_by_education_full_NE |>
  separate(`interaction(Language_Group, Educational_Level, Bilingual_Status)`, 
           into = c("Language_Group", "Educational_Level", "Bilingual_Status"), sep = "\\.") |>
  rename(median_income = INCTOT) |>
  rename(se_median_income = se) |>
  select(Language_Group, Educational_Level, Bilingual_Status, median_income, se_median_income)

print(median_by_education_full_NE)
##                                                                                                                    Language_Group
## Asian/Pacific Islander Languages.Bachelor's.Bilingual                                            Asian/Pacific Islander Languages
## Other Indo-European Languages.Bachelor's.Bilingual                                                  Other Indo-European Languages
## Other Languages.Bachelor's.Bilingual                                                                              Other Languages
## Spanish.Bachelor's.Bilingual                                                                                              Spanish
## Asian/Pacific Islander Languages.Doctoral.Bilingual                                              Asian/Pacific Islander Languages
## Other Indo-European Languages.Doctoral.Bilingual                                                    Other Indo-European Languages
## Other Languages.Doctoral.Bilingual                                                                                Other Languages
## Spanish.Doctoral.Bilingual                                                                                                Spanish
## Asian/Pacific Islander Languages.High School or GED.Bilingual                                    Asian/Pacific Islander Languages
## Other Indo-European Languages.High School or GED.Bilingual                                          Other Indo-European Languages
## Other Languages.High School or GED.Bilingual                                                                      Other Languages
## Spanish.High School or GED.Bilingual                                                                                      Spanish
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual      Asian/Pacific Islander Languages
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual            Other Indo-European Languages
## Other Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual                                        Other Languages
## Spanish.Master's & Professional Degree Beyond Bachelor's.Bilingual                                                        Spanish
## Asian/Pacific Islander Languages.No High School Degree or GED.Bilingual                          Asian/Pacific Islander Languages
## Other Indo-European Languages.No High School Degree or GED.Bilingual                                Other Indo-European Languages
## Other Languages.No High School Degree or GED.Bilingual                                                            Other Languages
## Spanish.No High School Degree or GED.Bilingual                                                                            Spanish
## Asian/Pacific Islander Languages.No Schooling Completed.Bilingual                                Asian/Pacific Islander Languages
## Other Indo-European Languages.No Schooling Completed.Bilingual                                      Other Indo-European Languages
## Other Languages.No Schooling Completed.Bilingual                                                                  Other Languages
## Spanish.No Schooling Completed.Bilingual                                                                                  Spanish
## Asian/Pacific Islander Languages.Some College, No Degree.Bilingual                               Asian/Pacific Islander Languages
## Other Indo-European Languages.Some College, No Degree.Bilingual                                     Other Indo-European Languages
## Other Languages.Some College, No Degree.Bilingual                                                                 Other Languages
## Spanish.Some College, No Degree.Bilingual                                                                                 Spanish
## Asian/Pacific Islander Languages.Bachelor's.NE Monolingual                                       Asian/Pacific Islander Languages
## Other Indo-European Languages.Bachelor's.NE Monolingual                                             Other Indo-European Languages
## Other Languages.Bachelor's.NE Monolingual                                                                         Other Languages
## Spanish.Bachelor's.NE Monolingual                                                                                         Spanish
## Asian/Pacific Islander Languages.Doctoral.NE Monolingual                                         Asian/Pacific Islander Languages
## Other Indo-European Languages.Doctoral.NE Monolingual                                               Other Indo-European Languages
## Spanish.Doctoral.NE Monolingual                                                                                           Spanish
## Asian/Pacific Islander Languages.High School or GED.NE Monolingual                               Asian/Pacific Islander Languages
## Other Indo-European Languages.High School or GED.NE Monolingual                                     Other Indo-European Languages
## Other Languages.High School or GED.NE Monolingual                                                                 Other Languages
## Spanish.High School or GED.NE Monolingual                                                                                 Spanish
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual Asian/Pacific Islander Languages
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual       Other Indo-European Languages
## Other Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                                   Other Languages
## Spanish.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                                                   Spanish
## Asian/Pacific Islander Languages.No High School Degree or GED.NE Monolingual                     Asian/Pacific Islander Languages
## Other Indo-European Languages.No High School Degree or GED.NE Monolingual                           Other Indo-European Languages
## Other Languages.No High School Degree or GED.NE Monolingual                                                       Other Languages
## Spanish.No High School Degree or GED.NE Monolingual                                                                       Spanish
## Asian/Pacific Islander Languages.No Schooling Completed.NE Monolingual                           Asian/Pacific Islander Languages
## Other Indo-European Languages.No Schooling Completed.NE Monolingual                                 Other Indo-European Languages
## Other Languages.No Schooling Completed.NE Monolingual                                                             Other Languages
## Spanish.No Schooling Completed.NE Monolingual                                                                             Spanish
## Asian/Pacific Islander Languages.Some College, No Degree.NE Monolingual                          Asian/Pacific Islander Languages
## Other Indo-European Languages.Some College, No Degree.NE Monolingual                                Other Indo-European Languages
## Other Languages.Some College, No Degree.NE Monolingual                                                            Other Languages
## Spanish.Some College, No Degree.NE Monolingual                                                                            Spanish
##                                                                                                                                 Educational_Level
## Asian/Pacific Islander Languages.Bachelor's.Bilingual                                                                                  Bachelor's
## Other Indo-European Languages.Bachelor's.Bilingual                                                                                     Bachelor's
## Other Languages.Bachelor's.Bilingual                                                                                                   Bachelor's
## Spanish.Bachelor's.Bilingual                                                                                                           Bachelor's
## Asian/Pacific Islander Languages.Doctoral.Bilingual                                                                                      Doctoral
## Other Indo-European Languages.Doctoral.Bilingual                                                                                         Doctoral
## Other Languages.Doctoral.Bilingual                                                                                                       Doctoral
## Spanish.Doctoral.Bilingual                                                                                                               Doctoral
## Asian/Pacific Islander Languages.High School or GED.Bilingual                                                                  High School or GED
## Other Indo-European Languages.High School or GED.Bilingual                                                                     High School or GED
## Other Languages.High School or GED.Bilingual                                                                                   High School or GED
## Spanish.High School or GED.Bilingual                                                                                           High School or GED
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual      Master's & Professional Degree Beyond Bachelor's
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual         Master's & Professional Degree Beyond Bachelor's
## Other Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual                       Master's & Professional Degree Beyond Bachelor's
## Spanish.Master's & Professional Degree Beyond Bachelor's.Bilingual                               Master's & Professional Degree Beyond Bachelor's
## Asian/Pacific Islander Languages.No High School Degree or GED.Bilingual                                              No High School Degree or GED
## Other Indo-European Languages.No High School Degree or GED.Bilingual                                                 No High School Degree or GED
## Other Languages.No High School Degree or GED.Bilingual                                                               No High School Degree or GED
## Spanish.No High School Degree or GED.Bilingual                                                                       No High School Degree or GED
## Asian/Pacific Islander Languages.No Schooling Completed.Bilingual                                                          No Schooling Completed
## Other Indo-European Languages.No Schooling Completed.Bilingual                                                             No Schooling Completed
## Other Languages.No Schooling Completed.Bilingual                                                                           No Schooling Completed
## Spanish.No Schooling Completed.Bilingual                                                                                   No Schooling Completed
## Asian/Pacific Islander Languages.Some College, No Degree.Bilingual                                                        Some College, No Degree
## Other Indo-European Languages.Some College, No Degree.Bilingual                                                           Some College, No Degree
## Other Languages.Some College, No Degree.Bilingual                                                                         Some College, No Degree
## Spanish.Some College, No Degree.Bilingual                                                                                 Some College, No Degree
## Asian/Pacific Islander Languages.Bachelor's.NE Monolingual                                                                             Bachelor's
## Other Indo-European Languages.Bachelor's.NE Monolingual                                                                                Bachelor's
## Other Languages.Bachelor's.NE Monolingual                                                                                              Bachelor's
## Spanish.Bachelor's.NE Monolingual                                                                                                      Bachelor's
## Asian/Pacific Islander Languages.Doctoral.NE Monolingual                                                                                 Doctoral
## Other Indo-European Languages.Doctoral.NE Monolingual                                                                                    Doctoral
## Spanish.Doctoral.NE Monolingual                                                                                                          Doctoral
## Asian/Pacific Islander Languages.High School or GED.NE Monolingual                                                             High School or GED
## Other Indo-European Languages.High School or GED.NE Monolingual                                                                High School or GED
## Other Languages.High School or GED.NE Monolingual                                                                              High School or GED
## Spanish.High School or GED.NE Monolingual                                                                                      High School or GED
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual Master's & Professional Degree Beyond Bachelor's
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual    Master's & Professional Degree Beyond Bachelor's
## Other Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                  Master's & Professional Degree Beyond Bachelor's
## Spanish.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                          Master's & Professional Degree Beyond Bachelor's
## Asian/Pacific Islander Languages.No High School Degree or GED.NE Monolingual                                         No High School Degree or GED
## Other Indo-European Languages.No High School Degree or GED.NE Monolingual                                            No High School Degree or GED
## Other Languages.No High School Degree or GED.NE Monolingual                                                          No High School Degree or GED
## Spanish.No High School Degree or GED.NE Monolingual                                                                  No High School Degree or GED
## Asian/Pacific Islander Languages.No Schooling Completed.NE Monolingual                                                     No Schooling Completed
## Other Indo-European Languages.No Schooling Completed.NE Monolingual                                                        No Schooling Completed
## Other Languages.No Schooling Completed.NE Monolingual                                                                      No Schooling Completed
## Spanish.No Schooling Completed.NE Monolingual                                                                              No Schooling Completed
## Asian/Pacific Islander Languages.Some College, No Degree.NE Monolingual                                                   Some College, No Degree
## Other Indo-European Languages.Some College, No Degree.NE Monolingual                                                      Some College, No Degree
## Other Languages.Some College, No Degree.NE Monolingual                                                                    Some College, No Degree
## Spanish.Some College, No Degree.NE Monolingual                                                                            Some College, No Degree
##                                                                                                  Bilingual_Status
## Asian/Pacific Islander Languages.Bachelor's.Bilingual                                                   Bilingual
## Other Indo-European Languages.Bachelor's.Bilingual                                                      Bilingual
## Other Languages.Bachelor's.Bilingual                                                                    Bilingual
## Spanish.Bachelor's.Bilingual                                                                            Bilingual
## Asian/Pacific Islander Languages.Doctoral.Bilingual                                                     Bilingual
## Other Indo-European Languages.Doctoral.Bilingual                                                        Bilingual
## Other Languages.Doctoral.Bilingual                                                                      Bilingual
## Spanish.Doctoral.Bilingual                                                                              Bilingual
## Asian/Pacific Islander Languages.High School or GED.Bilingual                                           Bilingual
## Other Indo-European Languages.High School or GED.Bilingual                                              Bilingual
## Other Languages.High School or GED.Bilingual                                                            Bilingual
## Spanish.High School or GED.Bilingual                                                                    Bilingual
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual             Bilingual
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual                Bilingual
## Other Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual                              Bilingual
## Spanish.Master's & Professional Degree Beyond Bachelor's.Bilingual                                      Bilingual
## Asian/Pacific Islander Languages.No High School Degree or GED.Bilingual                                 Bilingual
## Other Indo-European Languages.No High School Degree or GED.Bilingual                                    Bilingual
## Other Languages.No High School Degree or GED.Bilingual                                                  Bilingual
## Spanish.No High School Degree or GED.Bilingual                                                          Bilingual
## Asian/Pacific Islander Languages.No Schooling Completed.Bilingual                                       Bilingual
## Other Indo-European Languages.No Schooling Completed.Bilingual                                          Bilingual
## Other Languages.No Schooling Completed.Bilingual                                                        Bilingual
## Spanish.No Schooling Completed.Bilingual                                                                Bilingual
## Asian/Pacific Islander Languages.Some College, No Degree.Bilingual                                      Bilingual
## Other Indo-European Languages.Some College, No Degree.Bilingual                                         Bilingual
## Other Languages.Some College, No Degree.Bilingual                                                       Bilingual
## Spanish.Some College, No Degree.Bilingual                                                               Bilingual
## Asian/Pacific Islander Languages.Bachelor's.NE Monolingual                                         NE Monolingual
## Other Indo-European Languages.Bachelor's.NE Monolingual                                            NE Monolingual
## Other Languages.Bachelor's.NE Monolingual                                                          NE Monolingual
## Spanish.Bachelor's.NE Monolingual                                                                  NE Monolingual
## Asian/Pacific Islander Languages.Doctoral.NE Monolingual                                           NE Monolingual
## Other Indo-European Languages.Doctoral.NE Monolingual                                              NE Monolingual
## Spanish.Doctoral.NE Monolingual                                                                    NE Monolingual
## Asian/Pacific Islander Languages.High School or GED.NE Monolingual                                 NE Monolingual
## Other Indo-European Languages.High School or GED.NE Monolingual                                    NE Monolingual
## Other Languages.High School or GED.NE Monolingual                                                  NE Monolingual
## Spanish.High School or GED.NE Monolingual                                                          NE Monolingual
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual   NE Monolingual
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual      NE Monolingual
## Other Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                    NE Monolingual
## Spanish.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                            NE Monolingual
## Asian/Pacific Islander Languages.No High School Degree or GED.NE Monolingual                       NE Monolingual
## Other Indo-European Languages.No High School Degree or GED.NE Monolingual                          NE Monolingual
## Other Languages.No High School Degree or GED.NE Monolingual                                        NE Monolingual
## Spanish.No High School Degree or GED.NE Monolingual                                                NE Monolingual
## Asian/Pacific Islander Languages.No Schooling Completed.NE Monolingual                             NE Monolingual
## Other Indo-European Languages.No Schooling Completed.NE Monolingual                                NE Monolingual
## Other Languages.No Schooling Completed.NE Monolingual                                              NE Monolingual
## Spanish.No Schooling Completed.NE Monolingual                                                      NE Monolingual
## Asian/Pacific Islander Languages.Some College, No Degree.NE Monolingual                            NE Monolingual
## Other Indo-European Languages.Some College, No Degree.NE Monolingual                               NE Monolingual
## Other Languages.Some College, No Degree.NE Monolingual                                             NE Monolingual
## Spanish.Some College, No Degree.NE Monolingual                                                     NE Monolingual
##                                                                                                  median_income
## Asian/Pacific Islander Languages.Bachelor's.Bilingual                                                 59450.00
## Other Indo-European Languages.Bachelor's.Bilingual                                                    70000.00
## Other Languages.Bachelor's.Bilingual                                                                  47230.70
## Spanish.Bachelor's.Bilingual                                                                          54046.00
## Asian/Pacific Islander Languages.Doctoral.Bilingual                                                  102239.00
## Other Indo-European Languages.Doctoral.Bilingual                                                     101154.62
## Other Languages.Doctoral.Bilingual                                                                    81973.90
## Spanish.Doctoral.Bilingual                                                                            81068.00
## Asian/Pacific Islander Languages.High School or GED.Bilingual                                         28074.30
## Other Indo-European Languages.High School or GED.Bilingual                                            28705.00
## Other Languages.High School or GED.Bilingual                                                          28057.00
## Spanish.High School or GED.Bilingual                                                                  30000.00
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual           84172.00
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual             104652.53
## Other Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual                            78961.25
## Spanish.Master's & Professional Degree Beyond Bachelor's.Bilingual                                    69400.51
## Asian/Pacific Islander Languages.No High School Degree or GED.Bilingual                               31698.52
## Other Indo-European Languages.No High School Degree or GED.Bilingual                                  29904.83
## Other Languages.No High School Degree or GED.Bilingual                                                25000.00
## Spanish.No High School Degree or GED.Bilingual                                                        28329.00
## Asian/Pacific Islander Languages.No Schooling Completed.Bilingual                                     30018.14
## Other Indo-European Languages.No Schooling Completed.Bilingual                                        30419.41
## Other Languages.No Schooling Completed.Bilingual                                                      33795.24
## Spanish.No Schooling Completed.Bilingual                                                              30255.00
## Asian/Pacific Islander Languages.Some College, No Degree.Bilingual                                    30000.00
## Other Indo-European Languages.Some College, No Degree.Bilingual                                       34447.00
## Other Languages.Some College, No Degree.Bilingual                                                     30000.00
## Spanish.Some College, No Degree.Bilingual                                                             32427.00
## Asian/Pacific Islander Languages.Bachelor's.NE Monolingual                                            35186.67
## Other Indo-European Languages.Bachelor's.NE Monolingual                                               27509.32
## Other Languages.Bachelor's.NE Monolingual                                                             29785.71
## Spanish.Bachelor's.NE Monolingual                                                                     28817.47
## Asian/Pacific Islander Languages.Doctoral.NE Monolingual                                              55956.17
## Other Indo-European Languages.Doctoral.NE Monolingual                                                 66093.05
## Spanish.Doctoral.NE Monolingual                                                                       44053.50
## Asian/Pacific Islander Languages.High School or GED.NE Monolingual                                    24113.00
## Other Indo-European Languages.High School or GED.NE Monolingual                                       22643.14
## Other Languages.High School or GED.NE Monolingual                                                     21388.50
## Spanish.High School or GED.NE Monolingual                                                             27023.00
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual      35967.38
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual         49720.18
## Other Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                       64088.28
## Spanish.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                               37803.87
## Asian/Pacific Islander Languages.No High School Degree or GED.NE Monolingual                          24929.00
## Other Indo-European Languages.No High School Degree or GED.NE Monolingual                             21043.00
## Other Languages.No High School Degree or GED.NE Monolingual                                           24113.00
## Spanish.No High School Degree or GED.NE Monolingual                                                   24753.00
## Asian/Pacific Islander Languages.No Schooling Completed.NE Monolingual                                26891.29
## Other Indo-European Languages.No Schooling Completed.NE Monolingual                                   24153.85
## Other Languages.No Schooling Completed.NE Monolingual                                                 17616.67
## Spanish.No Schooling Completed.NE Monolingual                                                         25000.00
## Asian/Pacific Islander Languages.Some College, No Degree.NE Monolingual                               23941.93
## Other Indo-European Languages.Some College, No Degree.NE Monolingual                                  29887.33
## Other Languages.Some College, No Degree.NE Monolingual                                                26995.39
## Spanish.Some College, No Degree.NE Monolingual                                                        28104.00
##                                                                                                  se_median_income
## Asian/Pacific Islander Languages.Bachelor's.Bilingual                                                   1360.5046
## Other Indo-European Languages.Bachelor's.Bilingual                                                      1137.4522
## Other Languages.Bachelor's.Bilingual                                                                    1723.9317
## Spanish.Bachelor's.Bilingual                                                                             519.1036
## Asian/Pacific Islander Languages.Doctoral.Bilingual                                                     4196.6798
## Other Indo-European Languages.Doctoral.Bilingual                                                        4620.7485
## Other Languages.Doctoral.Bilingual                                                                      6719.6758
## Spanish.Doctoral.Bilingual                                                                              4290.6418
## Asian/Pacific Islander Languages.High School or GED.Bilingual                                            793.1265
## Other Indo-European Languages.High School or GED.Bilingual                                               652.8854
## Other Languages.High School or GED.Bilingual                                                            1161.5210
## Spanish.High School or GED.Bilingual                                                                     197.4450
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual             2549.8312
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual                1557.8390
## Other Languages.Master's & Professional Degree Beyond Bachelor's.Bilingual                              4069.0191
## Spanish.Master's & Professional Degree Beyond Bachelor's.Bilingual                                       551.4440
## Asian/Pacific Islander Languages.No High School Degree or GED.Bilingual                                 1638.2313
## Other Indo-European Languages.No High School Degree or GED.Bilingual                                    1637.3483
## Other Languages.No High School Degree or GED.Bilingual                                                  2468.8177
## Spanish.No High School Degree or GED.Bilingual                                                           179.8369
## Asian/Pacific Islander Languages.No Schooling Completed.Bilingual                                       1540.6815
## Other Indo-European Languages.No Schooling Completed.Bilingual                                          2667.9823
## Other Languages.No Schooling Completed.Bilingual                                                        5119.1897
## Spanish.No Schooling Completed.Bilingual                                                                 834.2558
## Asian/Pacific Islander Languages.Some College, No Degree.Bilingual                                      1123.2330
## Other Indo-European Languages.Some College, No Degree.Bilingual                                         1190.4512
## Other Languages.Some College, No Degree.Bilingual                                                       1639.9343
## Spanish.Some College, No Degree.Bilingual                                                                190.8130
## Asian/Pacific Islander Languages.Bachelor's.NE Monolingual                                              3683.4568
## Other Indo-European Languages.Bachelor's.NE Monolingual                                                 3352.4401
## Other Languages.Bachelor's.NE Monolingual                                                               5400.1358
## Spanish.Bachelor's.NE Monolingual                                                                       1021.4365
## Asian/Pacific Islander Languages.Doctoral.NE Monolingual                                               18131.4416
## Other Indo-European Languages.Doctoral.NE Monolingual                                                   8180.6096
## Spanish.Doctoral.NE Monolingual                                                                        21015.4020
## Asian/Pacific Islander Languages.High School or GED.NE Monolingual                                      1261.4210
## Other Indo-European Languages.High School or GED.NE Monolingual                                         2586.8476
## Other Languages.High School or GED.NE Monolingual                                                       3238.7775
## Spanish.High School or GED.NE Monolingual                                                                360.6477
## Asian/Pacific Islander Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual        8282.6804
## Other Indo-European Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual          11724.5220
## Other Languages.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                         8860.4349
## Spanish.Master's & Professional Degree Beyond Bachelor's.NE Monolingual                                 2294.7966
## Asian/Pacific Islander Languages.No High School Degree or GED.NE Monolingual                            1117.6683
## Other Indo-European Languages.No High School Degree or GED.NE Monolingual                               2963.4282
## Other Languages.No High School Degree or GED.NE Monolingual                                             2824.6095
## Spanish.No High School Degree or GED.NE Monolingual                                                      255.0814
## Asian/Pacific Islander Languages.No Schooling Completed.NE Monolingual                                  1579.7710
## Other Indo-European Languages.No Schooling Completed.NE Monolingual                                     4249.3332
## Other Languages.No Schooling Completed.NE Monolingual                                                   3209.0684
## Spanish.No Schooling Completed.NE Monolingual                                                            731.3002
## Asian/Pacific Islander Languages.Some College, No Degree.NE Monolingual                                 1745.5763
## Other Indo-European Languages.Some College, No Degree.NE Monolingual                                    2377.5266
## Other Languages.Some College, No Degree.NE Monolingual                                                  9977.1124
## Spanish.Some College, No Degree.NE Monolingual                                                           517.8771
income_data_wide_NE <- median_by_education_full_NE |>
  pivot_wider(names_from = Language_Group, 
              values_from = c(median_income, se_median_income))

print(income_data_wide_NE)
## # A tibble: 14 × 10
##    Educational_Level                     Bilingual_Status median_income_Asian/…¹
##    <chr>                                 <chr>                             <dbl>
##  1 Bachelor's                            Bilingual                        59450 
##  2 Doctoral                              Bilingual                       102239 
##  3 High School or GED                    Bilingual                        28074.
##  4 Master's & Professional Degree Beyon… Bilingual                        84172 
##  5 No High School Degree or GED          Bilingual                        31699.
##  6 No Schooling Completed                Bilingual                        30018.
##  7 Some College, No Degree               Bilingual                        30000 
##  8 Bachelor's                            NE Monolingual                   35187.
##  9 Doctoral                              NE Monolingual                   55956.
## 10 High School or GED                    NE Monolingual                   24113 
## 11 Master's & Professional Degree Beyon… NE Monolingual                   35967.
## 12 No High School Degree or GED          NE Monolingual                   24929 
## 13 No Schooling Completed                NE Monolingual                   26891.
## 14 Some College, No Degree               NE Monolingual                   23942.
## # ℹ abbreviated name: ¹​`median_income_Asian/Pacific Islander Languages`
## # ℹ 7 more variables: `median_income_Other Indo-European Languages` <dbl>,
## #   `median_income_Other Languages` <dbl>, median_income_Spanish <dbl>,
## #   `se_median_income_Asian/Pacific Islander Languages` <dbl>,
## #   `se_median_income_Other Indo-European Languages` <dbl>,
## #   `se_median_income_Other Languages` <dbl>, se_median_income_Spanish <dbl>
#filtering and setting up the data
income_data_all_stat <- language_micro_data_full |>
  select(AGE, INCTOT, Bilingual_Status, PERWT, SEX, CLUSTER, STRATA, YEAR) |>
  filter(INCTOT != 9999999 & INCTOT > 0) |>
  filter(AGE > 18 & AGE < 65) 
des_all_stat <- svydesign(ids = ~CLUSTER, 
                          strata = ~STRATA, 
                          weights = ~PERWT, 
                          data = income_data_all_stat)

bilingual_median <- as.numeric(svyquantile(~INCTOT, subset(des_all_stat, Bilingual_Status == "Bilingual"), quantiles = 0.5, ci = FALSE))
english_mono_median <- as.numeric(svyquantile(~INCTOT, subset(des_all_stat, Bilingual_Status == "English Monolingual"), quantiles = 0.5, ci = FALSE))
non_english_mono_median <- as.numeric(svyquantile(~INCTOT, subset(des_all_stat, Bilingual_Status == "NE Monolingual"), quantiles = 0.5, ci = FALSE))

#combining results into a single data frame
median_by_bilingual_stat <- data.frame(
  Bilingual_Status = c("Bilingual", "English Monolingual", "NE Monolingual"),
  median_income = c(bilingual_median, english_mono_median, non_english_mono_median)
)

print(median_by_bilingual_stat)
##      Bilingual_Status median_income
## 1           Bilingual         36475
## 2 English Monolingual         44966
## 3      NE Monolingual         25942

Linear Regression

lin_reg_income <- language_micro_data_full |>
  select(AGE, RACE, INCTOT, Language_Group, Bilingual_Status, PERWT, SEX, EDUCD, CLUSTER, STRATA, YEAR) |>
  filter(INCTOT != 9999999 & INCTOT > 0) |>
  filter(AGE > 18 & AGE < 65) |>
  filter(SEX != 9) |>
  filter(Bilingual_Status %in% c("Bilingual", "English Monolingual")) |>
  mutate(Educational_Level = case_when(
    EDUCD %in% c(1, 999) ~ "N/A or Missing",
    EDUCD == 2 ~ "No Schooling Completed",
    EDUCD >= 10 & EDUCD < 62 ~ "No High School Degree or GED",
    EDUCD >= 62 & EDUCD < 65 ~ "High School or GED",
    EDUCD >= 65 & EDUCD <= 100 ~ "Some College, No Degree",
    EDUCD == 101 ~ "Bachelor's",
    EDUCD == 114 ~ "Master's & Professional Degree Beyond Bachelor's",
    EDUCD == 115 ~ "Master's & Professional Degree Beyond Bachelor's",
    EDUCD == 116 ~ "Doctoral",
    TRUE ~ NA_character_
  )) |>
  filter(!is.na(INCTOT), !is.na(PERWT), !is.na(EDUCD))
  
des_edu_lin_reg <- svydesign(
  ids = ~CLUSTER, 
  strata = ~STRATA, 
  weights = ~PERWT, 
  data = lin_reg_income
)

biling_model <- svyglm(
  INCTOT ~ Educational_Level * Bilingual_Status, 
  design = des_edu_lin_reg
)

# summary(biling_model)

language_model <- svyglm(
  INCTOT ~ Educational_Level * Language_Group, 
  design = des_edu_lin_reg
)

summary(language_model)
## 
## Call:
## svyglm(formula = INCTOT ~ Educational_Level * Language_Group, 
##     design = des_edu_lin_reg)
## 
## Survey design:
## svydesign(ids = ~CLUSTER, strata = ~STRATA, weights = ~PERWT, 
##     data = lin_reg_income)
## 
## Coefficients:
##                                                                                                               Estimate
## (Intercept)                                                                                                    72412.2
## Educational_LevelDoctoral                                                                                      54566.3
## Educational_LevelHigh School or GED                                                                           -35387.3
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's                                              37536.7
## Educational_LevelNo High School Degree or GED                                                                 -32303.6
## Educational_LevelNo Schooling Completed                                                                       -31013.9
## Educational_LevelSome College, No Degree                                                                      -30592.7
## Language_GroupEnglish                                                                                          15997.6
## Language_GroupOther Indo-European Languages                                                                    13638.8
## Language_GroupOther Languages                                                                                 -11486.8
## Language_GroupSpanish                                                                                          -6887.7
## Educational_LevelDoctoral:Language_GroupEnglish                                                                -4664.2
## Educational_LevelHigh School or GED:Language_GroupEnglish                                                     -12585.4
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupEnglish                        -4151.5
## Educational_LevelNo High School Degree or GED:Language_GroupEnglish                                           -24664.4
## Educational_LevelNo Schooling Completed:Language_GroupEnglish                                                 -24204.3
## Educational_LevelSome College, No Degree:Language_GroupEnglish                                                 -7204.5
## Educational_LevelDoctoral:Language_GroupOther Indo-European Languages                                          -7480.2
## Educational_LevelHigh School or GED:Language_GroupOther Indo-European Languages                                -7335.8
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Indo-European Languages   -661.2
## Educational_LevelNo High School Degree or GED:Language_GroupOther Indo-European Languages                      -7749.3
## Educational_LevelNo Schooling Completed:Language_GroupOther Indo-European Languages                           -13556.6
## Educational_LevelSome College, No Degree:Language_GroupOther Indo-European Languages                           -6372.2
## Educational_LevelDoctoral:Language_GroupOther Languages                                                       -21904.9
## Educational_LevelHigh School or GED:Language_GroupOther Languages                                              12097.9
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Languages                 9093.5
## Educational_LevelNo High School Degree or GED:Language_GroupOther Languages                                     6025.3
## Educational_LevelNo Schooling Completed:Language_GroupOther Languages                                          15665.9
## Educational_LevelSome College, No Degree:Language_GroupOther Languages                                         10657.9
## Educational_LevelDoctoral:Language_GroupSpanish                                                                -2317.9
## Educational_LevelHigh School or GED:Language_GroupSpanish                                                       7208.2
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupSpanish                        -7277.9
## Educational_LevelNo High School Degree or GED:Language_GroupSpanish                                             2265.3
## Educational_LevelNo Schooling Completed:Language_GroupSpanish                                                   3511.8
## Educational_LevelSome College, No Degree:Language_GroupSpanish                                                  6032.2
##                                                                                                               Std. Error
## (Intercept)                                                                                                       1237.1
## Educational_LevelDoctoral                                                                                         4764.1
## Educational_LevelHigh School or GED                                                                               1825.1
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's                                                 3654.9
## Educational_LevelNo High School Degree or GED                                                                     3653.7
## Educational_LevelNo Schooling Completed                                                                           4141.5
## Educational_LevelSome College, No Degree                                                                          1734.6
## Language_GroupEnglish                                                                                             1299.3
## Language_GroupOther Indo-European Languages                                                                       1871.6
## Language_GroupOther Languages                                                                                     2452.9
## Language_GroupSpanish                                                                                             1405.2
## Educational_LevelDoctoral:Language_GroupEnglish                                                                   5398.5
## Educational_LevelHigh School or GED:Language_GroupEnglish                                                         1879.1
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupEnglish                           3759.7
## Educational_LevelNo High School Degree or GED:Language_GroupEnglish                                               3699.2
## Educational_LevelNo Schooling Completed:Language_GroupEnglish                                                     4297.6
## Educational_LevelSome College, No Degree:Language_GroupEnglish                                                    1792.6
## Educational_LevelDoctoral:Language_GroupOther Indo-European Languages                                             7722.2
## Educational_LevelHigh School or GED:Language_GroupOther Indo-European Languages                                   2922.9
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Indo-European Languages     4247.8
## Educational_LevelNo High School Degree or GED:Language_GroupOther Indo-European Languages                         5070.3
## Educational_LevelNo Schooling Completed:Language_GroupOther Indo-European Languages                               6368.8
## Educational_LevelSome College, No Degree:Language_GroupOther Indo-European Languages                              2877.9
## Educational_LevelDoctoral:Language_GroupOther Languages                                                           8290.3
## Educational_LevelHigh School or GED:Language_GroupOther Languages                                                 3423.4
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Languages                   6412.4
## Educational_LevelNo High School Degree or GED:Language_GroupOther Languages                                       7886.6
## Educational_LevelNo Schooling Completed:Language_GroupOther Languages                                            12319.3
## Educational_LevelSome College, No Degree:Language_GroupOther Languages                                            3179.0
## Educational_LevelDoctoral:Language_GroupSpanish                                                                   7586.1
## Educational_LevelHigh School or GED:Language_GroupSpanish                                                         1964.6
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupSpanish                           4086.4
## Educational_LevelNo High School Degree or GED:Language_GroupSpanish                                               3735.5
## Educational_LevelNo Schooling Completed:Language_GroupSpanish                                                     4312.8
## Educational_LevelSome College, No Degree:Language_GroupSpanish                                                    1880.4
##                                                                                                               t value
## (Intercept)                                                                                                    58.536
## Educational_LevelDoctoral                                                                                      11.454
## Educational_LevelHigh School or GED                                                                           -19.389
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's                                              10.270
## Educational_LevelNo High School Degree or GED                                                                  -8.841
## Educational_LevelNo Schooling Completed                                                                        -7.489
## Educational_LevelSome College, No Degree                                                                      -17.637
## Language_GroupEnglish                                                                                          12.313
## Language_GroupOther Indo-European Languages                                                                     7.287
## Language_GroupOther Languages                                                                                  -4.683
## Language_GroupSpanish                                                                                          -4.902
## Educational_LevelDoctoral:Language_GroupEnglish                                                                -0.864
## Educational_LevelHigh School or GED:Language_GroupEnglish                                                      -6.698
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupEnglish                        -1.104
## Educational_LevelNo High School Degree or GED:Language_GroupEnglish                                            -6.667
## Educational_LevelNo Schooling Completed:Language_GroupEnglish                                                  -5.632
## Educational_LevelSome College, No Degree:Language_GroupEnglish                                                 -4.019
## Educational_LevelDoctoral:Language_GroupOther Indo-European Languages                                          -0.969
## Educational_LevelHigh School or GED:Language_GroupOther Indo-European Languages                                -2.510
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Indo-European Languages  -0.156
## Educational_LevelNo High School Degree or GED:Language_GroupOther Indo-European Languages                      -1.528
## Educational_LevelNo Schooling Completed:Language_GroupOther Indo-European Languages                            -2.129
## Educational_LevelSome College, No Degree:Language_GroupOther Indo-European Languages                           -2.214
## Educational_LevelDoctoral:Language_GroupOther Languages                                                        -2.642
## Educational_LevelHigh School or GED:Language_GroupOther Languages                                               3.534
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Languages                 1.418
## Educational_LevelNo High School Degree or GED:Language_GroupOther Languages                                     0.764
## Educational_LevelNo Schooling Completed:Language_GroupOther Languages                                           1.272
## Educational_LevelSome College, No Degree:Language_GroupOther Languages                                          3.353
## Educational_LevelDoctoral:Language_GroupSpanish                                                                -0.306
## Educational_LevelHigh School or GED:Language_GroupSpanish                                                       3.669
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupSpanish                        -1.781
## Educational_LevelNo High School Degree or GED:Language_GroupSpanish                                             0.606
## Educational_LevelNo Schooling Completed:Language_GroupSpanish                                                   0.814
## Educational_LevelSome College, No Degree:Language_GroupSpanish                                                  3.208
##                                                                                                                           Pr(>|t|)
## (Intercept)                                                                                                   < 0.0000000000000002
## Educational_LevelDoctoral                                                                                     < 0.0000000000000002
## Educational_LevelHigh School or GED                                                                           < 0.0000000000000002
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's                                             < 0.0000000000000002
## Educational_LevelNo High School Degree or GED                                                                 < 0.0000000000000002
## Educational_LevelNo Schooling Completed                                                                         0.0000000000000698
## Educational_LevelSome College, No Degree                                                                      < 0.0000000000000002
## Language_GroupEnglish                                                                                         < 0.0000000000000002
## Language_GroupOther Indo-European Languages                                                                     0.0000000000003172
## Language_GroupOther Languages                                                                                   0.0000028280810162
## Language_GroupSpanish                                                                                           0.0000009502625355
## Educational_LevelDoctoral:Language_GroupEnglish                                                                           0.387606
## Educational_LevelHigh School or GED:Language_GroupEnglish                                                       0.0000000000212101
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupEnglish                                   0.269501
## Educational_LevelNo High School Degree or GED:Language_GroupEnglish                                             0.0000000000260697
## Educational_LevelNo Schooling Completed:Language_GroupEnglish                                                   0.0000000178139346
## Educational_LevelSome College, No Degree:Language_GroupEnglish                                                  0.0000584801479471
## Educational_LevelDoctoral:Language_GroupOther Indo-European Languages                                                     0.332713
## Educational_LevelHigh School or GED:Language_GroupOther Indo-European Languages                                           0.012082
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Indo-European Languages             0.876306
## Educational_LevelNo High School Degree or GED:Language_GroupOther Indo-European Languages                                 0.126418
## Educational_LevelNo Schooling Completed:Language_GroupOther Indo-European Languages                                       0.033288
## Educational_LevelSome College, No Degree:Language_GroupOther Indo-European Languages                                      0.026819
## Educational_LevelDoctoral:Language_GroupOther Languages                                                                   0.008237
## Educational_LevelHigh School or GED:Language_GroupOther Languages                                                         0.000410
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Languages                           0.156159
## Educational_LevelNo High School Degree or GED:Language_GroupOther Languages                                               0.444868
## Educational_LevelNo Schooling Completed:Language_GroupOther Languages                                                     0.203497
## Educational_LevelSome College, No Degree:Language_GroupOther Languages                                                    0.000801
## Educational_LevelDoctoral:Language_GroupSpanish                                                                           0.759946
## Educational_LevelHigh School or GED:Language_GroupSpanish                                                                 0.000243
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupSpanish                                   0.074909
## Educational_LevelNo High School Degree or GED:Language_GroupSpanish                                                       0.544243
## Educational_LevelNo Schooling Completed:Language_GroupSpanish                                                             0.415484
## Educational_LevelSome College, No Degree:Language_GroupSpanish                                                            0.001337
##                                                                                                                  
## (Intercept)                                                                                                   ***
## Educational_LevelDoctoral                                                                                     ***
## Educational_LevelHigh School or GED                                                                           ***
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's                                             ***
## Educational_LevelNo High School Degree or GED                                                                 ***
## Educational_LevelNo Schooling Completed                                                                       ***
## Educational_LevelSome College, No Degree                                                                      ***
## Language_GroupEnglish                                                                                         ***
## Language_GroupOther Indo-European Languages                                                                   ***
## Language_GroupOther Languages                                                                                 ***
## Language_GroupSpanish                                                                                         ***
## Educational_LevelDoctoral:Language_GroupEnglish                                                                  
## Educational_LevelHigh School or GED:Language_GroupEnglish                                                     ***
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupEnglish                          
## Educational_LevelNo High School Degree or GED:Language_GroupEnglish                                           ***
## Educational_LevelNo Schooling Completed:Language_GroupEnglish                                                 ***
## Educational_LevelSome College, No Degree:Language_GroupEnglish                                                ***
## Educational_LevelDoctoral:Language_GroupOther Indo-European Languages                                            
## Educational_LevelHigh School or GED:Language_GroupOther Indo-European Languages                               *  
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Indo-European Languages    
## Educational_LevelNo High School Degree or GED:Language_GroupOther Indo-European Languages                        
## Educational_LevelNo Schooling Completed:Language_GroupOther Indo-European Languages                           *  
## Educational_LevelSome College, No Degree:Language_GroupOther Indo-European Languages                          *  
## Educational_LevelDoctoral:Language_GroupOther Languages                                                       ** 
## Educational_LevelHigh School or GED:Language_GroupOther Languages                                             ***
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupOther Languages                  
## Educational_LevelNo High School Degree or GED:Language_GroupOther Languages                                      
## Educational_LevelNo Schooling Completed:Language_GroupOther Languages                                            
## Educational_LevelSome College, No Degree:Language_GroupOther Languages                                        ***
## Educational_LevelDoctoral:Language_GroupSpanish                                                                  
## Educational_LevelHigh School or GED:Language_GroupSpanish                                                     ***
## Educational_LevelMaster's & Professional Degree Beyond Bachelor's:Language_GroupSpanish                       .  
## Educational_LevelNo High School Degree or GED:Language_GroupSpanish                                              
## Educational_LevelNo Schooling Completed:Language_GroupSpanish                                                    
## Educational_LevelSome College, No Degree:Language_GroupSpanish                                                ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for gaussian family taken to be 4968419129)
## 
## Number of Fisher Scoring iterations: 2

CSV FILES

write.csv(file = "Income_SD_Median_Income.csv", median_income)
write.csv(file = "Income_SD_Quintile_Medians.csv", final_median_by_quintile)
write.csv(file = "Income_SD_ByEducation_Medians.csv", median_by_education_wide)
write.csv(file = "Income_SD_ByEducation_ByLanguage_Medians.csv", income_data_wide)
write.csv(file = "Income_SD_ByEducation_Bilingual_Monolingual_Medians.csv", income_data_wide_NE)
write.csv(file = "Income_All_Biling_Stat.csv", median_by_bilingual_stat)

EMPLOYMENT

FInding unemployment rates for each bilingual groups.

Label Code
N/A or Unknown 0; 9
Employed 1
Unemployed 2
Not in labor force 3
employment_2022 <- language_micro_data_full |>
  select(EMPSTAT, AGE, CLUSTER, PERWT, STRATA, Bilingual_Status, Language_Group) |>
  filter(EMPSTAT != 0 & EMPSTAT != 9)
  

employment_2022 |>
  filter(EMPSTAT == 3) |>
  group_by(AGE) |>
  summarise(count = n())
## # A tibble: 74 × 2
##    AGE       count
##    <int+lbl> <int>
##  1 16        14213
##  2 17        12761
##  3 18        10504
##  4 19         8397
##  5 20         5701
##  6 21         4754
##  7 22         4034
##  8 23         3569
##  9 24         3239
## 10 25         3313
## # ℹ 64 more rows
employment_2022 <- employment_2022 |>
  filter(EMPSTAT != 3)
employment_2022_binary <- employment_2022 |>
  mutate(EMPSTAT = ifelse(EMPSTAT == 2, 0, 1))

survey_design <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  data = employment_2022_binary  
)

empstat_by_bilingual <- svyby(
  ~EMPSTAT,  
  ~Bilingual_Status,  
  survey_design, 
  svymean,  
  vartype = "ci"  
)

empstat_by_bilingual <- empstat_by_bilingual |>
  mutate(unemployment = 1 - EMPSTAT) |>
  rename(employment = EMPSTAT)
write.csv(file = "Employment_Rates_by_Language_Group.csv", empstat_by_bilingual)

OCCUPATIONS

Codes: https://usa.ipums.org/usa/volii/occ2018.shtml#manager

Industry Codes
Management, Business, and Financial Occupations 10-960
Computer, Engineering, and Science Occupations 1005-1980
Education, Legal, Community Service, Arts, and Media Occupations: 2001-2920
Healthcare Practitioners and Technical Occupations 3000-3550
Service Occupations 3601-4655
Sales and Office Occupations

Sales and Related Occupations (4700-4965)

Office and Administrative Support Occupations (5000-5940)

Natural Resources, Construction, and Maintenance Occupations

Farming, Fishing, and Forestry Occupations(6005-6130)

Construction and Extraction Occupations (6200-6950)

Installation, Maintenance, and Repair Occupations(7000-7640)

Production, Transportation, and Material Moving Occupations

Production Occupations (7770-8990)

Transportation and Material Moving Occupations (9005-9760)

Military Occupations: 9800-9830
Unemployed 9920
occupations_2022 <- language_micro_data_full |>
  select(PERWT, CLUSTER, STRATA, OCC,Bilingual_Status, Language_Group , AGE, EMPSTAT)|>
  filter(OCC != 9920 & OCC != 0 & AGE < 65) |>
  filter(EMPSTAT == 1)

occupations_2022_full <- occupations_2022 |>
   mutate(Occupation_Label = case_when(
    OCC >= 10 & OCC <= 960 ~ "Management, Business, and Financial Occupations",
    OCC >= 1005 & OCC <= 1980 ~ "Computer, Engineering, and Science Occupations",
    OCC >= 2001 & OCC <= 2920 ~ "Education, Legal, Community Service, Arts, and Media Occupations",
    OCC >= 3000 & OCC <= 3550 ~ "Healthcare Practitioners and Technical Occupations",
    OCC >= 3601 & OCC <= 4655 ~ "Service Occupations",
    OCC >= 4700 & OCC <= 4965 ~ "Sales and Related Occupations",
    OCC >= 5000 & OCC <= 5940 ~ "Office and Administrative Support Occupations",
    OCC >= 6005 & OCC <= 6130 ~ "Farming, Fishing, and Forestry Occupations",
    OCC >= 6200 & OCC <= 6950 ~ "Construction and Extraction Occupations",
    OCC >= 7000 & OCC <= 7640 ~ "Installation, Maintenance, and Repair Occupations",
    OCC >= 7700 & OCC <= 8990 ~ "Production Occupations",
    OCC >= 9005 & OCC <= 9760 ~ "Transportation and Material Moving Occupations",
    OCC >= 9800 & OCC <= 9830 ~ "Military Occupations"
  ))


table(occupations_2022_full$Occupation_Label)
## 
##                   Computer, Engineering, and Science Occupations 
##                                                            37776 
##                          Construction and Extraction Occupations 
##                                                            30806 
## Education, Legal, Community Service, Arts, and Media Occupations 
##                                                            61467 
##                       Farming, Fishing, and Forestry Occupations 
##                                                             2202 
##               Healthcare Practitioners and Technical Occupations 
##                                                            31792 
##                Installation, Maintenance, and Repair Occupations 
##                                                            18571 
##                  Management, Business, and Financial Occupations 
##                                                            95064 
##                                             Military Occupations 
##                                                             2561 
##                    Office and Administrative Support Occupations 
##                                                            58736 
##                                           Production Occupations 
##                                                            25404 
##                                    Sales and Related Occupations 
##                                                            53342 
##                                              Service Occupations 
##                                                            82333 
##                   Transportation and Material Moving Occupations 
##                                                            39517
survey_design <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  data = occupations_2022_full  
)

bilingual_occupation_distribution <- svyby(
  ~Bilingual_Status,  
  ~Occupation_Label,  
  survey_design,
  svytotal,  
  vartype = NULL  
)

print(bilingual_occupation_distribution)
##                                                                                                                  Occupation_Label
## Computer, Engineering, and Science Occupations                                     Computer, Engineering, and Science Occupations
## Construction and Extraction Occupations                                                   Construction and Extraction Occupations
## Education, Legal, Community Service, Arts, and Media Occupations Education, Legal, Community Service, Arts, and Media Occupations
## Farming, Fishing, and Forestry Occupations                                             Farming, Fishing, and Forestry Occupations
## Healthcare Practitioners and Technical Occupations                             Healthcare Practitioners and Technical Occupations
## Installation, Maintenance, and Repair Occupations                               Installation, Maintenance, and Repair Occupations
## Management, Business, and Financial Occupations                                   Management, Business, and Financial Occupations
## Military Occupations                                                                                         Military Occupations
## Office and Administrative Support Occupations                                       Office and Administrative Support Occupations
## Production Occupations                                                                                     Production Occupations
## Sales and Related Occupations                                                                       Sales and Related Occupations
## Service Occupations                                                                                           Service Occupations
## Transportation and Material Moving Occupations                                     Transportation and Material Moving Occupations
##                                                                  Bilingual_StatusBilingual
## Computer, Engineering, and Science Occupations                                      286519
## Construction and Extraction Occupations                                             330087
## Education, Legal, Community Service, Arts, and Media Occupations                    348518
## Farming, Fishing, and Forestry Occupations                                           14691
## Healthcare Practitioners and Technical Occupations                                  216669
## Installation, Maintenance, and Repair Occupations                                   149078
## Management, Business, and Financial Occupations                                     539334
## Military Occupations                                                                 10072
## Office and Administrative Support Occupations                                       416942
## Production Occupations                                                              214243
## Sales and Related Occupations                                                       397599
## Service Occupations                                                                 701085
## Transportation and Material Moving Occupations                                      343654
##                                                                  Bilingual_StatusEnglish Monolingual
## Computer, Engineering, and Science Occupations                                                574274
## Construction and Extraction Occupations                                                       332908
## Education, Legal, Community Service, Arts, and Media Occupations                              981873
## Farming, Fishing, and Forestry Occupations                                                     21677
## Healthcare Practitioners and Technical Occupations                                            503000
## Installation, Maintenance, and Repair Occupations                                             277572
## Management, Business, and Financial Occupations                                              1595743
## Military Occupations                                                                           46644
## Office and Administrative Support Occupations                                                 974287
## Production Occupations                                                                        337752
## Sales and Related Occupations                                                                 890231
## Service Occupations                                                                          1193736
## Transportation and Material Moving Occupations                                                642826
##                                                                  Bilingual_StatusNE Monolingual
## Computer, Engineering, and Science Occupations                                             8590
## Construction and Extraction Occupations                                                  230901
## Education, Legal, Community Service, Arts, and Media Occupations                          19379
## Farming, Fishing, and Forestry Occupations                                                10304
## Healthcare Practitioners and Technical Occupations                                         6908
## Installation, Maintenance, and Repair Occupations                                         38157
## Management, Business, and Financial Occupations                                           35941
## Military Occupations                                                                        351
## Office and Administrative Support Occupations                                             29375
## Production Occupations                                                                    94833
## Sales and Related Occupations                                                             43234
## Service Occupations                                                                      294366
## Transportation and Material Moving Occupations                                            89378
##                                                                  se.Bilingual_StatusBilingual
## Computer, Engineering, and Science Occupations                                      3983.2143
## Construction and Extraction Occupations                                             4598.1750
## Education, Legal, Community Service, Arts, and Media Occupations                    4298.7611
## Farming, Fishing, and Forestry Occupations                                           936.7557
## Healthcare Practitioners and Technical Occupations                                  3717.9425
## Installation, Maintenance, and Repair Occupations                                   2869.5776
## Management, Business, and Financial Occupations                                     5824.9229
## Military Occupations                                                                 690.9699
## Office and Administrative Support Occupations                                       4827.1293
## Production Occupations                                                              3432.3756
## Sales and Related Occupations                                                       4879.3959
## Service Occupations                                                                 6816.7154
## Transportation and Material Moving Occupations                                      4724.4913
##                                                                  se.Bilingual_StatusEnglish Monolingual
## Computer, Engineering, and Science Occupations                                                5254.7847
## Construction and Extraction Occupations                                                       4282.6467
## Education, Legal, Community Service, Arts, and Media Occupations                              7091.8780
## Farming, Fishing, and Forestry Occupations                                                     997.2829
## Healthcare Practitioners and Technical Occupations                                            4981.0724
## Installation, Maintenance, and Repair Occupations                                             3768.9222
## Management, Business, and Financial Occupations                                               9047.5348
## Military Occupations                                                                          1475.7345
## Office and Administrative Support Occupations                                                 7219.8145
## Production Occupations                                                                        4223.9744
## Sales and Related Occupations                                                                 6969.9454
## Service Occupations                                                                           8258.6304
## Transportation and Material Moving Occupations                                                6194.7719
##                                                                  se.Bilingual_StatusNE Monolingual
## Computer, Engineering, and Science Occupations                                            639.5010
## Construction and Extraction Occupations                                                  4162.2797
## Education, Legal, Community Service, Arts, and Media Occupations                         1072.3463
## Farming, Fishing, and Forestry Occupations                                                802.8262
## Healthcare Practitioners and Technical Occupations                                        512.9042
## Installation, Maintenance, and Repair Occupations                                        1519.4302
## Management, Business, and Financial Occupations                                          1383.6573
## Military Occupations                                                                      121.4441
## Office and Administrative Support Occupations                                            1218.4149
## Production Occupations                                                                   2334.2013
## Sales and Related Occupations                                                            1545.3696
## Service Occupations                                                                      4485.0630
## Transportation and Material Moving Occupations                                           2304.0715
sum(bilingual_occupation_distribution$Bilingual_StatusBilingual) + 
sum(bilingual_occupation_distribution$`Bilingual_StatusEnglish Monolingual`) + 
sum(bilingual_occupation_distribution$`Bilingual_StatusNE Monolingual`)
## [1] 13242731
table(occupations_2022_full$EMPSTAT)
## 
##      1 
## 539571
write.csv(file = "Occupations_by_LanguageGroup_FullSet.csv", bilingual_occupation_distribution)

LINGUISTIC ISOLATION

Looking at different indicators for linguistic isolation group in Texas.

Label Code
N/A 0
Not linguistically isolated 1
Linguistically isolated 2
linguistic_iso_2022 <- language_micro_data_full |>
  select(LANGUAGE, LANGUAGED, LINGISOL, AGE, CLUSTER, STRATA, PERWT, POVERTY, INCTOT, OCC, SEX, , HCOVANY, Language_Group, Bilingual_Status, EMPSTAT, EDUCD, YEAR) |>
  filter(LINGISOL != 0 & LANGUAGE != 1 & LANGUAGED != 100) |>
  mutate(LINGISOL = ifelse(LINGISOL == 1, "Not linguistically isolated", "Linguistically isolated")) 

OVERVIEW DEMOGRAPHICS

isolated_2022 <- linguistic_iso_2022 |>
  filter(LINGISOL == "Linguistically isolated") 

# table(isolated_2022$AGE)

survey_design <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  data = isolated_2022  
)

ling_iso_age_distribution <- svyby(~I(AGE == AGE), ~AGE, survey_design, svytotal)

print(ling_iso_age_distribution)
##    AGE I(AGE == AGE)FALSE I(AGE == AGE)TRUE se.I(AGE == AGE)FALSE
## 5    5                  0             35465                     0
## 6    6                  0             35134                     0
## 7    7                  0             35585                     0
## 8    8                  0             37001                     0
## 9    9                  0             34852                     0
## 10  10                  0             33293                     0
## 11  11                  0             37030                     0
## 12  12                  0             35053                     0
## 13  13                  0             33998                     0
## 14  14                  0             13042                     0
## 15  15                  0             14629                     0
## 16  16                  0             12045                     0
## 17  17                  0             12847                     0
## 18  18                  0             14353                     0
## 19  19                  0             12470                     0
## 20  20                  0             14705                     0
## 21  21                  0             17703                     0
## 22  22                  0             17867                     0
## 23  23                  0             20324                     0
## 24  24                  0             20247                     0
## 25  25                  0             24490                     0
## 26  26                  0             24712                     0
## 27  27                  0             27036                     0
## 28  28                  0             27520                     0
## 29  29                  0             26191                     0
## 30  30                  0             31606                     0
## 31  31                  0             30755                     0
## 32  32                  0             33166                     0
## 33  33                  0             31863                     0
## 34  34                  0             33426                     0
## 35  35                  0             34196                     0
## 36  36                  0             31523                     0
## 37  37                  0             30730                     0
## 38  38                  0             31703                     0
## 39  39                  0             25333                     0
## 40  40                  0             31213                     0
## 41  41                  0             25186                     0
## 42  42                  0             27063                     0
## 43  43                  0             21461                     0
## 44  44                  0             21777                     0
## 45  45                  0             26062                     0
## 46  46                  0             21757                     0
## 47  47                  0             24568                     0
## 48  48                  0             21061                     0
## 49  49                  0             19811                     0
## 50  50                  0             23083                     0
## 51  51                  0             19351                     0
## 52  52                  0             21501                     0
## 53  53                  0             21955                     0
## 54  54                  0             21675                     0
## 55  55                  0             23647                     0
## 56  56                  0             23189                     0
## 57  57                  0             18152                     0
## 58  58                  0             21116                     0
## 59  59                  0             21647                     0
## 60  60                  0             22874                     0
## 61  61                  0             20287                     0
## 62  62                  0             22376                     0
## 63  63                  0             19643                     0
## 64  64                  0             19989                     0
## 65  65                  0             20388                     0
## 66  66                  0             18551                     0
## 67  67                  0             17994                     0
## 68  68                  0             17036                     0
## 69  69                  0             16867                     0
## 70  70                  0             15422                     0
## 71  71                  0             13747                     0
## 72  72                  0             14158                     0
## 73  73                  0             12154                     0
## 74  74                  0             12946                     0
## 75  75                  0             11685                     0
## 76  76                  0             10695                     0
## 77  77                  0              8904                     0
## 78  78                  0              8080                     0
## 79  79                  0              8197                     0
## 80  80                  0              6303                     0
## 81  81                  0              6516                     0
## 82  82                  0              6160                     0
## 83  83                  0              5609                     0
## 84  84                  0              4915                     0
## 85  85                  0              4915                     0
## 86  86                  0              4036                     0
## 87  87                  0              3256                     0
## 88  88                  0              2904                     0
## 92  92                  0             12527                     0
##    se.I(AGE == AGE)TRUE
## 5             1497.2114
## 6             1386.5306
## 7             1410.3080
## 8             1487.9484
## 9             1344.2221
## 10            1330.9944
## 11            1472.0148
## 12            1407.1724
## 13            1386.6957
## 14             817.6877
## 15            1002.5848
## 16             781.6413
## 17             804.5655
## 18             942.3409
## 19             876.3682
## 20             896.7930
## 21            1062.6265
## 22            1029.7246
## 23            1118.8209
## 24            1085.4929
## 25            1266.4312
## 26            1163.0431
## 27            1257.7198
## 28            1327.9242
## 29            1179.9470
## 30            1259.8250
## 31            1331.1592
## 32            1339.4248
## 33            1459.0824
## 34            1431.1780
## 35            1389.1017
## 36            1404.6109
## 37            1419.0920
## 38            1400.9528
## 39            1140.4415
## 40            1342.2515
## 41            1239.8676
## 42            1276.8795
## 43            1014.6390
## 44            1090.9687
## 45            1189.6438
## 46            1117.9478
## 47            1209.6322
## 48            1020.0673
## 49            1030.1544
## 50            1078.2160
## 51            1026.1939
## 52            1059.0985
## 53            1063.9211
## 54            1028.6618
## 55            1100.4791
## 56            1214.2687
## 57             875.9257
## 58             937.7216
## 59            1065.1334
## 60            1096.6269
## 61             996.0991
## 62            1111.8114
## 63             876.6017
## 64             951.1845
## 65             936.6509
## 66             961.9264
## 67             899.4701
## 68             961.2870
## 69             943.6823
## 70             818.2443
## 71             851.1543
## 72             790.0398
## 73             709.7378
## 74             798.0683
## 75             759.5752
## 76             719.6895
## 77             585.5399
## 78             565.0736
## 79             595.7663
## 80             432.9640
## 81             486.2518
## 82             528.0461
## 83             532.1314
## 84             457.8947
## 85             530.0096
## 86             430.1223
## 87             365.4989
## 88             329.3044
## 92             769.4183
write.csv(file = "Lingustically_Isolated_Ages.csv", ling_iso_age_distribution)
ling_iso_age_sex_distribution <- svyby(
  ~I(AGE == AGE),              
  ~interaction(AGE, SEX),       
  survey_design,                
  svytotal                      
)

ling_iso_age_sex_df <- as.data.frame(ling_iso_age_sex_distribution)

ling_iso_age_sex_df <- ling_iso_age_sex_df |>
  mutate(
    AGE = as.numeric(sub("\\..*", "", rownames(ling_iso_age_sex_df))),
    SEX = as.factor(sub(".*\\.", "", rownames(ling_iso_age_sex_df)))
  )

ling_iso_age_sex_df <- ling_iso_age_sex_df |>
  select(AGE, SEX, everything())

print(ling_iso_age_sex_df)
##      AGE SEX interaction(AGE, SEX) I(AGE == AGE)FALSE I(AGE == AGE)TRUE
## 5.1    5   1                   5.1                  0             17960
## 6.1    6   1                   6.1                  0             18767
## 7.1    7   1                   7.1                  0             18261
## 8.1    8   1                   8.1                  0             19400
## 9.1    9   1                   9.1                  0             17862
## 10.1  10   1                  10.1                  0             17298
## 11.1  11   1                  11.1                  0             18649
## 12.1  12   1                  12.1                  0             16575
## 13.1  13   1                  13.1                  0             18427
## 14.1  14   1                  14.1                  0              6928
## 15.1  15   1                  15.1                  0              7195
## 16.1  16   1                  16.1                  0              6530
## 17.1  17   1                  17.1                  0              7555
## 18.1  18   1                  18.1                  0              7641
## 19.1  19   1                  19.1                  0              6679
## 20.1  20   1                  20.1                  0              7906
## 21.1  21   1                  21.1                  0             10323
## 22.1  22   1                  22.1                  0              9479
## 23.1  23   1                  23.1                  0              9956
## 24.1  24   1                  24.1                  0             10124
## 25.1  25   1                  25.1                  0             13075
## 26.1  26   1                  26.1                  0             12627
## 27.1  27   1                  27.1                  0             13383
## 28.1  28   1                  28.1                  0             13051
## 29.1  29   1                  29.1                  0             11426
## 30.1  30   1                  30.1                  0             16657
## 31.1  31   1                  31.1                  0             16746
## 32.1  32   1                  32.1                  0             17113
## 33.1  33   1                  33.1                  0             18378
## 34.1  34   1                  34.1                  0             18058
## 35.1  35   1                  35.1                  0             20591
## 36.1  36   1                  36.1                  0             17453
## 37.1  37   1                  37.1                  0             17037
## 38.1  38   1                  38.1                  0             17334
## 39.1  39   1                  39.1                  0             13889
## 40.1  40   1                  40.1                  0             18064
## 41.1  41   1                  41.1                  0             14285
## 42.1  42   1                  42.1                  0             15913
## 43.1  43   1                  43.1                  0             12617
## 44.1  44   1                  44.1                  0             12135
## 45.1  45   1                  45.1                  0             15983
## 46.1  46   1                  46.1                  0             11581
## 47.1  47   1                  47.1                  0             13763
## 48.1  48   1                  48.1                  0             10368
## 49.1  49   1                  49.1                  0             10580
## 50.1  50   1                  50.1                  0             12094
## 51.1  51   1                  51.1                  0             10432
## 52.1  52   1                  52.1                  0             11777
## 53.1  53   1                  53.1                  0             11768
## 54.1  54   1                  54.1                  0             11190
## 55.1  55   1                  55.1                  0             12424
## 56.1  56   1                  56.1                  0             12620
## 57.1  57   1                  57.1                  0              9279
## 58.1  58   1                  58.1                  0             10571
## 59.1  59   1                  59.1                  0             11893
## 60.1  60   1                  60.1                  0             12163
## 61.1  61   1                  61.1                  0             10103
## 62.1  62   1                  62.1                  0             11022
## 63.1  63   1                  63.1                  0              9029
## 64.1  64   1                  64.1                  0              9974
## 65.1  65   1                  65.1                  0              9565
## 66.1  66   1                  66.1                  0              9239
## 67.1  67   1                  67.1                  0              8508
## 68.1  68   1                  68.1                  0              8136
## 69.1  69   1                  69.1                  0              8215
## 70.1  70   1                  70.1                  0              7622
## 71.1  71   1                  71.1                  0              6616
## 72.1  72   1                  72.1                  0              6819
## 73.1  73   1                  73.1                  0              5715
## 74.1  74   1                  74.1                  0              5615
## 75.1  75   1                  75.1                  0              5827
## 76.1  76   1                  76.1                  0              4533
## 77.1  77   1                  77.1                  0              3816
## 78.1  78   1                  78.1                  0              3315
## 79.1  79   1                  79.1                  0              3859
## 80.1  80   1                  80.1                  0              2673
## 81.1  81   1                  81.1                  0              2969
## 82.1  82   1                  82.1                  0              2535
## 83.1  83   1                  83.1                  0              2271
## 84.1  84   1                  84.1                  0              2222
## 85.1  85   1                  85.1                  0              1503
## 86.1  86   1                  86.1                  0              1556
## 87.1  87   1                  87.1                  0              1390
## 88.1  88   1                  88.1                  0               838
## 92.1  92   1                  92.1                  0              4133
## 5.2    5   2                   5.2                  0             17505
## 6.2    6   2                   6.2                  0             16367
## 7.2    7   2                   7.2                  0             17324
## 8.2    8   2                   8.2                  0             17601
## 9.2    9   2                   9.2                  0             16990
## 10.2  10   2                  10.2                  0             15995
## 11.2  11   2                  11.2                  0             18381
## 12.2  12   2                  12.2                  0             18478
## 13.2  13   2                  13.2                  0             15571
## 14.2  14   2                  14.2                  0              6114
## 15.2  15   2                  15.2                  0              7434
## 16.2  16   2                  16.2                  0              5515
## 17.2  17   2                  17.2                  0              5292
## 18.2  18   2                  18.2                  0              6712
## 19.2  19   2                  19.2                  0              5791
## 20.2  20   2                  20.2                  0              6799
## 21.2  21   2                  21.2                  0              7380
## 22.2  22   2                  22.2                  0              8388
## 23.2  23   2                  23.2                  0             10368
## 24.2  24   2                  24.2                  0             10123
## 25.2  25   2                  25.2                  0             11415
## 26.2  26   2                  26.2                  0             12085
## 27.2  27   2                  27.2                  0             13653
## 28.2  28   2                  28.2                  0             14469
## 29.2  29   2                  29.2                  0             14765
## 30.2  30   2                  30.2                  0             14949
## 31.2  31   2                  31.2                  0             14009
## 32.2  32   2                  32.2                  0             16053
## 33.2  33   2                  33.2                  0             13485
## 34.2  34   2                  34.2                  0             15368
## 35.2  35   2                  35.2                  0             13605
## 36.2  36   2                  36.2                  0             14070
## 37.2  37   2                  37.2                  0             13693
## 38.2  38   2                  38.2                  0             14369
## 39.2  39   2                  39.2                  0             11444
## 40.2  40   2                  40.2                  0             13149
## 41.2  41   2                  41.2                  0             10901
## 42.2  42   2                  42.2                  0             11150
## 43.2  43   2                  43.2                  0              8844
## 44.2  44   2                  44.2                  0              9642
## 45.2  45   2                  45.2                  0             10079
## 46.2  46   2                  46.2                  0             10176
## 47.2  47   2                  47.2                  0             10805
## 48.2  48   2                  48.2                  0             10693
## 49.2  49   2                  49.2                  0              9231
## 50.2  50   2                  50.2                  0             10989
## 51.2  51   2                  51.2                  0              8919
## 52.2  52   2                  52.2                  0              9724
## 53.2  53   2                  53.2                  0             10187
## 54.2  54   2                  54.2                  0             10485
## 55.2  55   2                  55.2                  0             11223
## 56.2  56   2                  56.2                  0             10569
## 57.2  57   2                  57.2                  0              8873
## 58.2  58   2                  58.2                  0             10545
## 59.2  59   2                  59.2                  0              9754
## 60.2  60   2                  60.2                  0             10711
## 61.2  61   2                  61.2                  0             10184
## 62.2  62   2                  62.2                  0             11354
## 63.2  63   2                  63.2                  0             10614
## 64.2  64   2                  64.2                  0             10015
## 65.2  65   2                  65.2                  0             10823
## 66.2  66   2                  66.2                  0              9312
## 67.2  67   2                  67.2                  0              9486
## 68.2  68   2                  68.2                  0              8900
## 69.2  69   2                  69.2                  0              8652
## 70.2  70   2                  70.2                  0              7800
## 71.2  71   2                  71.2                  0              7131
## 72.2  72   2                  72.2                  0              7339
## 73.2  73   2                  73.2                  0              6439
## 74.2  74   2                  74.2                  0              7331
## 75.2  75   2                  75.2                  0              5858
## 76.2  76   2                  76.2                  0              6162
## 77.2  77   2                  77.2                  0              5088
## 78.2  78   2                  78.2                  0              4765
## 79.2  79   2                  79.2                  0              4338
## 80.2  80   2                  80.2                  0              3630
## 81.2  81   2                  81.2                  0              3547
## 82.2  82   2                  82.2                  0              3625
## 83.2  83   2                  83.2                  0              3338
## 84.2  84   2                  84.2                  0              2693
## 85.2  85   2                  85.2                  0              3412
## 86.2  86   2                  86.2                  0              2480
## 87.2  87   2                  87.2                  0              1866
## 88.2  88   2                  88.2                  0              2066
## 92.2  92   2                  92.2                  0              8394
##      se.I(AGE == AGE)FALSE se.I(AGE == AGE)TRUE
## 5.1                      0            1065.8547
## 6.1                      0             998.8706
## 7.1                      0             996.0418
## 8.1                      0            1057.9473
## 9.1                      0            1000.2551
## 10.1                     0             967.6361
## 11.1                     0            1087.6176
## 12.1                     0             972.4416
## 13.1                     0            1075.2284
## 14.1                     0             609.0970
## 15.1                     0             674.3683
## 16.1                     0             547.0177
## 17.1                     0             639.7068
## 18.1                     0             706.3281
## 19.1                     0             602.9397
## 20.1                     0             635.8154
## 21.1                     0             850.8433
## 22.1                     0             765.1070
## 23.1                     0             764.0561
## 24.1                     0             793.4883
## 25.1                     0             920.5404
## 26.1                     0             883.7385
## 27.1                     0             842.8864
## 28.1                     0             961.1310
## 29.1                     0             761.1800
## 30.1                     0             932.9010
## 31.1                     0             984.7649
## 32.1                     0             943.3178
## 33.1                     0            1106.9069
## 34.1                     0             983.8111
## 35.1                     0            1070.6090
## 36.1                     0            1075.4580
## 37.1                     0            1035.1271
## 38.1                     0             974.2174
## 39.1                     0             799.9175
## 40.1                     0             990.4356
## 41.1                     0             904.5620
## 42.1                     0            1033.4000
## 43.1                     0             816.5322
## 44.1                     0             831.6856
## 45.1                     0             975.5460
## 46.1                     0             727.7644
## 47.1                     0             873.2403
## 48.1                     0             717.8195
## 49.1                     0             775.7257
## 50.1                     0             770.4319
## 51.1                     0             727.3979
## 52.1                     0             810.4980
## 53.1                     0             780.1206
## 54.1                     0             739.3097
## 55.1                     0             796.3649
## 56.1                     0             879.9392
## 57.1                     0             608.7172
## 58.1                     0             682.5067
## 59.1                     0             841.2945
## 60.1                     0             840.0929
## 61.1                     0             734.8028
## 62.1                     0             756.7794
## 63.1                     0             557.3429
## 64.1                     0             675.2700
## 65.1                     0             606.8719
## 66.1                     0             652.0048
## 67.1                     0             653.8879
## 68.1                     0             656.4332
## 69.1                     0             669.7955
## 70.1                     0             642.7239
## 71.1                     0             628.2306
## 72.1                     0             598.2170
## 73.1                     0             448.0759
## 74.1                     0             514.3468
## 75.1                     0             554.2596
## 76.1                     0             425.5904
## 77.1                     0             359.0982
## 78.1                     0             322.3925
## 79.1                     0             446.5276
## 80.1                     0             264.1345
## 81.1                     0             317.8426
## 82.1                     0             356.4828
## 83.1                     0             301.2407
## 84.1                     0             339.0400
## 85.1                     0             216.6298
## 86.1                     0             262.4886
## 87.1                     0             233.4737
## 88.1                     0             158.7474
## 92.1                     0             415.4951
## 5.2                      0            1052.2586
## 6.2                      0             963.3834
## 7.2                      0             977.3100
## 8.2                      0            1000.8489
## 9.2                      0             909.5491
## 10.2                     0             919.0950
## 11.2                     0             995.7646
## 12.2                     0            1014.9562
## 13.2                     0             875.7386
## 14.2                     0             548.4292
## 15.2                     0             696.5101
## 16.2                     0             553.6783
## 17.2                     0             489.8287
## 18.2                     0             604.8892
## 19.2                     0             629.5210
## 20.2                     0             615.7715
## 21.2                     0             623.2388
## 22.2                     0             672.1651
## 23.2                     0             802.0484
## 24.2                     0             697.8997
## 25.2                     0             796.1277
## 26.2                     0             746.4791
## 27.2                     0             891.3284
## 28.2                     0             889.6314
## 29.2                     0             858.0158
## 30.2                     0             820.1749
## 31.2                     0             812.8603
## 32.2                     0             889.7698
## 33.2                     0             855.0041
## 34.2                     0            1014.4462
## 35.2                     0             847.1011
## 36.2                     0             826.1330
## 37.2                     0             892.9085
## 38.2                     0             924.6913
## 39.2                     0             756.1754
## 40.2                     0             865.6400
## 41.2                     0             801.1876
## 42.2                     0             725.0872
## 43.2                     0             595.6351
## 44.2                     0             680.3432
## 45.2                     0             653.5128
## 46.2                     0             816.5155
## 47.2                     0             747.7983
## 48.2                     0             700.3010
## 49.2                     0             649.1130
## 50.2                     0             724.7906
## 51.2                     0             651.8996
## 52.2                     0             640.8726
## 53.2                     0             679.0321
## 54.2                     0             699.5040
## 55.2                     0             742.2779
## 56.2                     0             777.3970
## 57.2                     0             599.0168
## 58.2                     0             630.8560
## 59.2                     0             628.9780
## 60.2                     0             643.5622
## 61.2                     0             637.0257
## 62.2                     0             734.5575
## 63.2                     0             644.0780
## 64.2                     0             640.6921
## 65.2                     0             704.0208
## 66.2                     0             689.8063
## 67.2                     0             602.6711
## 68.2                     0             643.4643
## 69.2                     0             644.5578
## 70.2                     0             487.0124
## 71.2                     0             552.9478
## 72.2                     0             498.3782
## 73.2                     0             502.7441
## 74.2                     0             581.7255
## 75.2                     0             508.5385
## 76.2                     0             575.5726
## 77.2                     0             453.1334
## 78.2                     0             425.8271
## 79.2                     0             392.7565
## 80.2                     0             340.4155
## 81.2                     0             358.7010
## 82.2                     0             388.0340
## 83.2                     0             438.4535
## 84.2                     0             303.1994
## 85.2                     0             483.9467
## 86.2                     0             341.1640
## 87.2                     0             280.2196
## 88.2                     0             282.3362
## 92.2                     0             586.2100
ling_iso_age_sex_df <- ling_iso_age_sex_df |>
  select(AGE, SEX, `I(AGE == AGE)TRUE`)

ling_iso_age_sex_df <- ling_iso_age_sex_df |>
  mutate(Age_Group = cut(AGE, breaks = seq(0, 100, by = 5), right = FALSE))

age_sex_summary <- ling_iso_age_sex_df |>
  group_by(Age_Group, SEX) |>
  summarise(Count = sum(`I(AGE == AGE)TRUE`, na.rm = TRUE))
## `summarise()` has grouped output by 'Age_Group'. You can override using the
## `.groups` argument.
age_sex_summary_wide <- age_sex_summary |>
  pivot_wider(names_from = SEX, values_from = Count, names_prefix = "Sex_")

colnames(age_sex_summary_wide) <- c("Age_Group", "Men", "Women")

print(age_sex_summary_wide)
## # A tibble: 18 × 3
## # Groups:   Age_Group [18]
##    Age_Group   Men Women
##    <fct>     <dbl> <dbl>
##  1 [5,10)    92250 85787
##  2 [10,15)   77877 74539
##  3 [15,20)   35600 30744
##  4 [20,25)   47788 43058
##  5 [25,30)   63562 66387
##  6 [30,35)   86952 73864
##  7 [35,40)   86304 67181
##  8 [40,45)   73014 53686
##  9 [45,50)   62275 50984
## 10 [50,55)   57261 50304
## 11 [55,60)   56787 50964
## 12 [60,65)   52291 52878
## 13 [65,70)   43663 47173
## 14 [70,75)   32387 36040
## 15 [75,80)   21350 26211
## 16 [80,85)   12670 16833
## 17 [85,90)    5287  9824
## 18 [90,95)    4133  8394
age_sex_summary_wide <- age_sex_summary_wide |>
  mutate(Total_Pop = Men + Women)

age_sex_summary_wide <- age_sex_summary_wide |>
  mutate(
    Men_Percent = - (Men / Total_Pop) ,  
    Women_Percent = (Women / Total_Pop) 
  )

age_sex_summary_wide <- age_sex_summary_wide |>
  select(Age_Group, Men_Percent, Women_Percent)

write.csv(file = "Linguistically_Isolated_PopPyramid.csv",age_sex_summary_wide, row.names = FALSE)
write.csv(file = "Linguistically_Isolated_PopPyramid.csv",age_sex_summary_wide )

BY LANGUAGE

survey_design <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  data = isolated_2022  
)

ling_iso_language_distribution <- svytotal(~Language_Group, survey_design)

print(ling_iso_language_distribution)
##                                                  total      SE
## Language_GroupAsian/Pacific Islander Languages  151611  4051.8
## Language_GroupOther Indo-European Languages      79157  3119.9
## Language_GroupOther Languages                    40397  2732.9
## Language_GroupSpanish                          1485137 12743.6
ling_iso_language_distribution <- as.data.frame(ling_iso_language_distribution)
write.csv(file = "Linguistically_Isolated_Languages.csv",ling_iso_language_distribution)

HEALTHCARE

ling_iso_health <- linguistic_iso_2022 |>
  mutate(HCOVANY = ifelse(HCOVANY == 2, 1, 0))

survey_design <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  data = ling_iso_health
)

ling_isohealthcare_coverage <- svyby(
  ~HCOVANY,  
  ~LINGISOL,  
  survey_design, 
  svymean, 
)

ling_isohealthcare_coverage <- ling_isohealthcare_coverage |>
  mutate(NoCoverage = 1-HCOVANY)
write.csv(file = "Linguistically_Isolated_Healthcare.csv", ling_isohealthcare_coverage)

OCCUPATIONS

ling_iso_occupations <- linguistic_iso_2022 |>
  filter(OCC != 0 & OCC != 9920 & AGE < 65) |>
  filter(EMPSTAT == 1) |>
  mutate(Occupation_Label = case_when(
    OCC >= 10 & OCC <= 960 ~ "Management, Business, and Financial Occupations",
    OCC >= 1005 & OCC <= 1980 ~ "Computer, Engineering, and Science Occupations",
    OCC >= 2001 & OCC <= 2920 ~ "Education, Legal, Community Service, Arts, and Media Occupations",
    OCC >= 3000 & OCC <= 3550 ~ "Healthcare Practitioners and Technical Occupations",
    OCC >= 3601 & OCC <= 4655 ~ "Service Occupations",
    OCC >= 4700 & OCC <= 4965 ~ "Sales and Related Occupations",
    OCC >= 5000 & OCC <= 5940 ~ "Office and Administrative Support Occupations",
    OCC >= 6005 & OCC <= 6130 ~ "Farming, Fishing, and Forestry Occupations",
    OCC >= 6200 & OCC <= 6950 ~ "Construction and Extraction Occupations",
    OCC >= 7000 & OCC <= 7640 ~ "Installation, Maintenance, and Repair Occupations",
    OCC >= 7700 & OCC <= 8990 ~ "Production Occupations",
    OCC >= 9005 & OCC <= 9760 ~ "Transportation and Material Moving Occupations",
    OCC >= 9800 & OCC <= 9830 ~ "Military Occupations"
  ))

table(ling_iso_occupations$Occupation_Label)
## 
##                   Computer, Engineering, and Science Occupations 
##                                                            11746 
##                          Construction and Extraction Occupations 
##                                                            16936 
## Education, Legal, Community Service, Arts, and Media Occupations 
##                                                            14852 
##                       Farming, Fishing, and Forestry Occupations 
##                                                              972 
##               Healthcare Practitioners and Technical Occupations 
##                                                             8827 
##                Installation, Maintenance, and Repair Occupations 
##                                                             6296 
##                  Management, Business, and Financial Occupations 
##                                                            21754 
##                                             Military Occupations 
##                                                              270 
##                    Office and Administrative Support Occupations 
##                                                            16725 
##                                           Production Occupations 
##                                                            10768 
##                                    Sales and Related Occupations 
##                                                            15464 
##                                              Service Occupations 
##                                                            33539 
##                   Transportation and Material Moving Occupations 
##                                                            14279
survey_design <- svydesign(
  id = ~CLUSTER,  
  weights = ~PERWT,  
  data = ling_iso_occupations  
)

ling_iso_occupation_distribution <- svyby(
  ~LINGISOL,  
  ~Occupation_Label,  
  survey_design,
  svytotal,  
  vartype = NULL  
)

print(ling_iso_occupation_distribution)
##                                                                                                                  Occupation_Label
## Computer, Engineering, and Science Occupations                                     Computer, Engineering, and Science Occupations
## Construction and Extraction Occupations                                                   Construction and Extraction Occupations
## Education, Legal, Community Service, Arts, and Media Occupations Education, Legal, Community Service, Arts, and Media Occupations
## Farming, Fishing, and Forestry Occupations                                             Farming, Fishing, and Forestry Occupations
## Healthcare Practitioners and Technical Occupations                             Healthcare Practitioners and Technical Occupations
## Installation, Maintenance, and Repair Occupations                               Installation, Maintenance, and Repair Occupations
## Management, Business, and Financial Occupations                                   Management, Business, and Financial Occupations
## Military Occupations                                                                                         Military Occupations
## Office and Administrative Support Occupations                                       Office and Administrative Support Occupations
## Production Occupations                                                                                     Production Occupations
## Sales and Related Occupations                                                                       Sales and Related Occupations
## Service Occupations                                                                                           Service Occupations
## Transportation and Material Moving Occupations                                     Transportation and Material Moving Occupations
##                                                                  LINGISOLLinguistically isolated
## Computer, Engineering, and Science Occupations                                             22807
## Construction and Extraction Occupations                                                   176886
## Education, Legal, Community Service, Arts, and Media Occupations                           27885
## Farming, Fishing, and Forestry Occupations                                                  7252
## Healthcare Practitioners and Technical Occupations                                         14411
## Installation, Maintenance, and Repair Occupations                                          34932
## Management, Business, and Financial Occupations                                            45052
## Military Occupations                                                                         453
## Office and Administrative Support Occupations                                              38015
## Production Occupations                                                                     72411
## Sales and Related Occupations                                                              51267
## Service Occupations                                                                       216492
## Transportation and Material Moving Occupations                                             81861
##                                                                  LINGISOLNot linguistically isolated
## Computer, Engineering, and Science Occupations                                                271545
## Construction and Extraction Occupations                                                       383658
## Education, Legal, Community Service, Arts, and Media Occupations                              336867
## Farming, Fishing, and Forestry Occupations                                                     17485
## Healthcare Practitioners and Technical Occupations                                            208630
## Installation, Maintenance, and Repair Occupations                                             151301
## Management, Business, and Financial Occupations                                               529099
## Military Occupations                                                                            7091
## Office and Administrative Support Occupations                                                 406010
## Production Occupations                                                                        236488
## Sales and Related Occupations                                                                 387711
## Service Occupations                                                                           774354
## Transportation and Material Moving Occupations                                                349933
##                                                                  se.LINGISOLLinguistically isolated
## Computer, Engineering, and Science Occupations                                             993.3948
## Construction and Extraction Occupations                                                   3706.8116
## Education, Legal, Community Service, Arts, and Media Occupations                          1185.0259
## Farming, Fishing, and Forestry Occupations                                                 691.8161
## Healthcare Practitioners and Technical Occupations                                         896.3208
## Installation, Maintenance, and Repair Occupations                                         1457.1691
## Management, Business, and Financial Occupations                                           1660.2977
## Military Occupations                                                                       126.7017
## Office and Administrative Support Occupations                                             1418.6427
## Production Occupations                                                                    2097.0011
## Sales and Related Occupations                                                             1743.3616
## Service Occupations                                                                       3953.6424
## Transportation and Material Moving Occupations                                            2272.2934
##                                                                  se.LINGISOLNot linguistically isolated
## Computer, Engineering, and Science Occupations                                                 3860.282
## Construction and Extraction Occupations                                                        5121.641
## Education, Legal, Community Service, Arts, and Media Occupations                               4201.952
## Farming, Fishing, and Forestry Occupations                                                     1036.695
## Healthcare Practitioners and Technical Occupations                                             3612.331
## Installation, Maintenance, and Repair Occupations                                              2920.762
## Management, Business, and Financial Occupations                                                5629.916
## Military Occupations                                                                            639.583
## Office and Administrative Support Occupations                                                  4689.204
## Production Occupations                                                                         3630.113
## Sales and Related Occupations                                                                  4765.748
## Service Occupations                                                                            7290.672
## Transportation and Material Moving Occupations                                                 4746.227
sum(ling_iso_occupation_distribution$`LINGISOLLinguistically isolated`) + sum(ling_iso_occupation_distribution$`LINGISOLNot linguistically isolated`)
## [1] 4849896
write.csv(file = "Linguistically_Isolated_Occupations.csv", ling_iso_occupation_distribution)

POVERTY

ling_iso_poverty_2022 <- linguistic_iso_2022 |>
  filter(POVERTY != 0 & POVERTY <= 100) |>
  filter(LINGISOL == "Linguistically isolated")
  
poverty_survey_design <- svydesign(
  id = ~CLUSTER,  
  strata = ~STRATA, 
  weights = ~PERWT,  
  data = ling_iso_poverty_2022  
)

ling_iso_poverty_distribution <- svyby(
  ~POVERTY,  
  ~Language_Group,  
  poverty_survey_design,
  svytotal,  
  vartype = NULL  
)

print(ling_iso_poverty_distribution)
##                                                    Language_Group  POVERTY
## Asian/Pacific Islander Languages Asian/Pacific Islander Languages  1378680
## Other Indo-European Languages       Other Indo-European Languages   860488
## Other Languages                                   Other Languages   711344
## Spanish                                                   Spanish 25721212
##                                         se
## Asian/Pacific Islander Languages 104275.72
## Other Indo-European Languages    101334.97
## Other Languages                   92778.81
## Spanish                          487204.22
#very high se, not very reliable 

INCOME

ling_iso_income_2022 <- linguistic_iso_2022 |>
  select(AGE, INCTOT, PERWT, SEX, EDUCD, AGE, CLUSTER, STRATA, YEAR, Language_Group, Bilingual_Status, LINGISOL) |>
  filter(INCTOT != 9999999 & INCTOT > 0) |>
  filter(AGE > 18 & AGE < 65) 
des_ling_iso_income <- svydesign(
                 ids = ~CLUSTER, 
                 strata = ~STRATA, 
                 weights = ~PERWT, 
                 data = ling_iso_income_2022)

median_income_ling_iso <- svyby(
  ~INCTOT,               
  ~LINGISOL,            
  des_ling_iso_income,   
  svyquantile,           
  quantiles = 0.5,       
  ci = TRUE              
)
## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available

## Warning in vcov.svyquantile(X[[i]], ...): Only diagonal of vcov() available
print(median_income_ling_iso)
##                                                LINGISOL INCTOT       se
## Linguistically isolated         Linguistically isolated  27557 208.6641
## Not linguistically isolated Not linguistically isolated  35130 179.0736
write.csv(file = "Linguistically_Isolated_MedianPersonal_Income.csv", median_income_ling_iso)