Data for this analysis from the 2023 Annual Social and Economic Supplement (ASEC) of the Current Population Survey (CPS).
Import Data
I filtered before downloading the data from IPUMS for TX (Fips 48)
Defining Kinship
To define kinship, I have to link using the RELATE variable and then specify no mother or father in household using the MOMLOC and POPLOC variables. There is no readily available variable to do this, so this is a work around.
AECF defines kinship in the following manner:
To define children in kinship care we use data on whether there is a parent in the household (PARENT) and the relationship of the child to the reference person (PERRP).
Specifically, children are in kinship care if there is no parent present in the household and the relationship between the child and the reference person is:
However, for this analysis, I am using microdata from IPUMS. So, given the description of the RELATE variable, I included the following in my classification of kinship:
The definition on the AECF Kids Count Dashboard seems inconsistent with the one on the in the email from Alicia. Which is it??
#Here I am filtering to get children under 18kinchildren <- kin|>filter( AGE <18, YEAR==2023)kinchildren <- kinchildren|>filter(!is.na(ASECWT))#Defining what classifies as kinship per Alicia VN's definition. kinchildren2 <- kinchildren |>filter( MOMLOC ==0& POPLOC ==0& RELATE %in%c(0901, 0701, 1001, 1260) )kinchildren2 <- kinchildren2 |>mutate(RaceEthnicity =case_when( HISPAN !=0~"Hispanic", RACE ==100& HISPAN ==0~"White", RACE ==200& HISPAN ==0~"African-American", RACE !=100& RACE !=200& HISPAN ==0~"Non-Hispanic Other" ) )# kinchildren3 <- kinchildren2|># mutate(ASEC_adjusted = ASECWT / 10000) <--Leaving this as a reminder to myself that we don't need to divide because this is automatically done for us via variable definition here: https://cps.ipums.org/cps-action/variables/ASECWT#codes_section#create survey design des <-svydesign(ids =~1, weights =~ASECWT, data = kinchildren2)#calculations -- using a binary indicator total_kinship_care <-svytotal(~I(MOMLOC ==0& POPLOC ==0& RELATE %in%c(0901, 0701, 1001, 1260)), des, na.rm =TRUE)print(total_kinship_care)
#Cross validating# Create a binary indicator for being in kinship carekinchildren3 <- kinchildren2 %>%mutate(in_kinship =ifelse( MOMLOC ==0& POPLOC ==0& RELATE %in%c(0901, 0701, 1001, 1260), 1, 0 ) )# Create survey designdes2 <-svydesign(ids =~1, weights =~ASECWT, data = kinchildren3)# Calculate the total number of children in kinship care by RaceEthnicitykin_totals <-svyby(~in_kinship, ~RaceEthnicity, des2, svytotal,na.rm =TRUE)# Print the resultsprint(kin_totals)
RaceEthnicity in_kinship se
African-American African-American 46678.65 12578.588
Hispanic Hispanic 115611.74 13512.907
Non-Hispanic Other Non-Hispanic Other 11729.48 8952.891
White White 88993.49 14949.567
# Cross-validate by calculating the overall total and by groupoverall_total <-svytotal(~in_kinship, des2)print(overall_total)
total SE
in_kinship 263013 10096
# Validate by summing up individual totalsgrouped_totals <- kin_totals %>%summarise(Total_Kinship =sum(in_kinship))print(grouped_totals)
# A tibble: 4 × 3
RaceEthnicity Total_Kinship Percentage
<chr> <dbl> <dbl>
1 African-American 46679. 17.7
2 Hispanic 115612. 44.0
3 Non-Hispanic Other 11729. 4.46
4 White 88993. 33.8
#----------------USING A SCALING FACTOR----------Didn't end up using, but useful in other situations, possibly. Messed around with this option because I had an estimate from the AECF/PRB 3-year estimate of 272,000 from KC data dashboard. Wanted to see what it looked like# total_weighted <- sum(kinchildren2$WTFINL, na.rm = TRUE)# # scaling_factor <- 272000 / total_weighted# # kinchildren2 <- kinchildren2|># mutate(# ScaledWTFINL = WTFINL * scaling_factor# )# # kinship_summary <- kinchildren2|># group_by(RaceEthnicity) |># summarize(# WeightedNumber = sum(ScaledWTFINL, na.rm = TRUE)# ) %>%# mutate(# Percentage = (WeightedNumber / sum(WeightedNumber)) * 100,# WeightedNumber = comma(WeightedNumber, accuracy = 1),# Percentage = round(Percentage, 1)# )# print(kinship_summary)
Poverty Try #1
Now, I want to recreate the estimate of children in kinship care living in households below 150% of poverty.
# binary indicator for kinship care and for poverty statuskinpov<- kinchildren2 |>mutate(in_kinship =ifelse( MOMLOC ==0& POPLOC ==0& RELATE %in%c(0901, 0701, 1001, 1260), 1, 0 ),below_150_poverty =ifelse(POVERTY %in%c(10, 21, 22), 1, 0) # 1 if below 150% poverty, 0 otherwise )# Filter to keep only those below 150% of povertykinpov2 <- kinpov |>filter(below_150_poverty ==1, in_kinship ==1)kinpov_summary <- kinpov2 |>group_by(RaceEthnicity) |>summarise(Total_Kinship_Below_150 =sum(ASECWT, na.rm =TRUE), # No need to multiply by in_kinship since we already filtered for it.groups ='drop' ) |>mutate(Percentage = Total_Kinship_Below_150 /sum(Total_Kinship_Below_150) *100 )# Print the results for children in kinship care below 150% of povertyprint(kinpov_summary)
Use of data from IPUMS CPS is subject to conditions including that users should cite the data appropriately. Use command `ipums_conditions()` for more details.
#####################Yearly totals##################Use this in data brief # Group by Year and RaceEthnicity to calculate totals for each yearkin_totals_by_year <- kin_allyears2 |>group_by(YEAR, RaceEthnicity) |>summarise(Total_Kinship =sum(ASECWT * in_kinship, na.rm =TRUE),.groups ='drop' ) |>mutate(Percentage = Total_Kinship /sum(Total_Kinship) *100 )print(kin_totals_by_year)
# A tibble: 12 × 4
YEAR RaceEthnicity Total_Kinship Percentage
<dbl> <chr> <dbl> <dbl>
1 2021 African-American 46575. 6.35
2 2021 Hispanic 118390. 16.2
3 2021 Non-Hispanic Other 14861. 2.03
4 2021 White 79065. 10.8
5 2022 African-American 44938. 6.13
6 2022 Hispanic 107275. 14.6
7 2022 Non-Hispanic Other 3990. 0.544
8 2022 White 54848. 7.48
9 2023 African-American 46679. 6.37
10 2023 Hispanic 115612. 15.8
11 2023 Non-Hispanic Other 11729. 1.60
12 2023 White 88993. 12.1
# Calculate the overall total kinship care estimates by yearoverall_totals_by_year <- kin_allyears2 |>group_by(YEAR) |>summarise(Overall_Kinship =sum(ASECWT * in_kinship, na.rm =TRUE) )print(overall_totals_by_year)
# A tibble: 3 × 2
YEAR Overall_Kinship
<dbl> <dbl>
1 2021 258891.
2 2022 211051.
3 2023 263013.
By Age & Sex (3 and 1 year)
# Function to calculate CI and reliability flagcalculate_ci_rse_flag <-function(data) { data <- data %>%mutate(RSE = se / in_kinship *100,CI_lower = in_kinship -1.96* se,CI_upper = in_kinship +1.96* se,Flag_Unreliable = RSE >30# Flag unreliable if RSE > 30% )return(data)}# Survey design specificationdes3 <-svydesign(ids =~1, weights =~ASECWT, data = kin_allyears2)# Group by Age categories for all three years - need to divide by three to get averagekin_age_totals <-svyby(~in_kinship, ~cut(AGE, breaks =c(0, 5, 12, 18), labels =c("0-5", "6-12", "13-17")), des3, svytotal,na.rm =TRUE)print(kin_age_totals)
# Group by Year and Age categories to get yearly estimateskin_age_totals_by_year <-svyby(~in_kinship, ~interaction(YEAR, cut(AGE, breaks =c(0, 5, 12, 18), labels =c("0-5", "6-12", "13-17"))), des3, svytotal,na.rm =TRUE)print(kin_age_totals_by_year)
kin_gender_totals_by_year <-svyby(~in_kinship, ~interaction(YEAR, SEX), # Grouping by both YEAR and SEX des3, svytotal,na.rm =TRUE)print(kin_gender_totals_by_year)
#three-year average of children in kinship care below 150% of povertykinpov_totals_average <-svyby(~in_kinship, ~below_150_poverty, # Grouping only by poverty status for three-year average des_pov, svytotal,na.rm =TRUE)# Divide by 3 to get the three-year averagekinpov_totals_average <- kinpov_totals_average |>mutate(Average_Three_Years = in_kinship /3)print(kinpov_totals_average)
#total number of children in kinship care below 150% of poverty by race/ethnicity and yearkinpov_totals_by_year_race <-svyby(~in_kinship, ~interaction(YEAR, below_150_poverty, RaceEthnicity), # Grouping by YEAR, poverty status, and race/ethnicity des_pov, svytotal,na.rm =TRUE)print(kinpov_totals_by_year_race)
interaction(YEAR, below_150_poverty, RaceEthnicity)
2021.0.African-American 2021.0.African-American
2022.0.African-American 2022.0.African-American
2023.0.African-American 2023.0.African-American
2021.1.African-American 2021.1.African-American
2022.1.African-American 2022.1.African-American
2023.1.African-American 2023.1.African-American
2021.0.Hispanic 2021.0.Hispanic
2022.0.Hispanic 2022.0.Hispanic
2023.0.Hispanic 2023.0.Hispanic
2021.1.Hispanic 2021.1.Hispanic
2022.1.Hispanic 2022.1.Hispanic
2023.1.Hispanic 2023.1.Hispanic
2021.0.Non-Hispanic Other 2021.0.Non-Hispanic Other
2023.0.Non-Hispanic Other 2023.0.Non-Hispanic Other
2021.1.Non-Hispanic Other 2021.1.Non-Hispanic Other
2022.1.Non-Hispanic Other 2022.1.Non-Hispanic Other
2021.0.White 2021.0.White
2022.0.White 2022.0.White
2023.0.White 2023.0.White
2021.1.White 2021.1.White
2022.1.White 2022.1.White
2023.1.White 2023.1.White
in_kinship se
2021.0.African-American 26737.374 9990.735
2022.0.African-American 41799.550 13273.137
2023.0.African-American 28828.660 9572.632
2021.1.African-American 19837.919 8910.907
2022.1.African-American 3138.620 3138.620
2023.1.African-American 17849.990 9292.084
2021.0.Hispanic 51220.804 12272.252
2022.0.Hispanic 53297.770 12653.187
2023.0.Hispanic 80365.820 13784.132
2021.1.Hispanic 67169.114 13662.670
2022.1.Hispanic 53976.770 14116.590
2023.1.Hispanic 35245.920 10823.270
2021.0.Non-Hispanic Other 8423.981 5001.376
2023.0.Non-Hispanic Other 11729.480 8977.438
2021.1.Non-Hispanic Other 6436.955 4542.161
2022.1.Non-Hispanic Other 3990.500 3990.500
2021.0.White 63162.005 12488.538
2022.0.White 34215.160 10915.743
2023.0.White 64598.930 14873.411
2021.1.White 15903.235 6450.233
2022.1.White 20632.450 7898.523
2023.1.White 24394.560 8621.766
# Calculate Relative Standard Error (RSE) and Confidence Intervalskinpov_totals_by_year_race <- kinpov_totals_by_year_race %>%mutate(RSE = (se / in_kinship) *100, # Relative Standard Error as a percentageCI_lower = in_kinship -1.96* se, # 95% Confidence Interval lower boundCI_upper = in_kinship +1.96* se, # 95% Confidence Interval upper boundFlag_Unreliable =ifelse(RSE >30, TRUE, FALSE) # Flag if RSE > 30% )print(kinpov_totals_by_year_race)
#three-year average of children in kinship care below 150% of poverty by race/ethnicitykinpov_totals_average_race <-svyby(~in_kinship, ~interaction(below_150_poverty, RaceEthnicity), # Grouping by poverty status and race/ethnicity for three-year average des_pov, svytotal,na.rm =TRUE)kinpov_totals_average_race <- kinpov_totals_average_race |>mutate(Average_Three_Years = in_kinship /3)print(kinpov_totals_average_race)
interaction(below_150_poverty, RaceEthnicity) in_kinship
0.African-American 0.African-American 97365.58
1.African-American 1.African-American 40826.53
0.Hispanic 0.Hispanic 184884.39
1.Hispanic 1.Hispanic 156391.80
0.Non-Hispanic Other 0.Non-Hispanic Other 20153.46
1.Non-Hispanic Other 1.Non-Hispanic Other 10427.45
0.White 0.White 161976.09
1.White 1.White 60930.25
se Average_Three_Years
0.African-American 18492.013 32455.195
1.African-American 13102.585 13608.843
0.Hispanic 20207.701 61628.131
1.Hispanic 20918.109 52130.601
0.Non-Hispanic Other 10236.609 6717.820
1.Non-Hispanic Other 6028.445 3475.818
0.White 20644.562 53992.032
1.White 12969.486 20310.082
kinpov_totals_average_race1 <-svyby(~in_kinship, ~interaction(below_150_poverty, RaceEthnicity), # Grouping by poverty status and race/ethnicity for three-year average des_pov, svytotal,na.rm =TRUE)kinpov_totals_average_race1 <- kinpov_totals_average_race1 %>%mutate(Average_Three_Years = in_kinship /3,RSE = (se / in_kinship) *100, # Relative Standard Error as a percentageCI_lower = in_kinship -1.96* se, # 95% Confidence Interval lower boundCI_upper = in_kinship +1.96* se, # 95% Confidence Interval upper boundFlag_Unreliable =ifelse(RSE >30, TRUE, FALSE) # Flag if RSE > 30% )print(kinpov_totals_average_race1)
3 Yearh Average Kinship by Poverty and Relationship
# Step 2: Group by RELATE to match the categories from the provided tablekin_tot_relate <- kinpov3 |>group_by(RELATE) |>summarise(Total_Kinship =sum(ASECWT * in_kinship, na.rm =TRUE),Total_Poverty_Kinship =sum(ASECWT * in_kinship * below_150_poverty, na.rm =TRUE),.groups ='drop' )# Calculate the percentages and overall totals for all relationshipskin_tot_relate <- kin_tot_relate |>mutate(Percentage = Total_Kinship /sum(Total_Kinship) *100,Poverty_Percentage = Total_Poverty_Kinship /sum(Total_Poverty_Kinship) *100 )print(kin_tot_relate)
# Step 1: Create a new column for relationship categories based on RELATEkinpov3 <- kinpov3 |>mutate(Relationship =case_when( RELATE ==0901~"Grandchild", RELATE ==0701~"Brother/sister", RELATE ==1001~"Other relative", RELATE %in%c(1113, 1114, 1115, 1241, 1242) & (MOMLOC !=0| POPLOC !=0) ~"Nonrelative with relatives", RELATE ==1260| (RELATE %in%c(1113, 1114, 1115, 1241, 1242) & MOMLOC ==0& POPLOC ==0) ~"Nonrelative without relatives",TRUE~"Other" ) )# Step 2: Group by YEAR and Relationship to get totals for each yearkin_tot_relate_by_year <- kinpov3 |>group_by(YEAR, Relationship) |>summarise(Total_Kinship =sum(ASECWT * in_kinship, na.rm =TRUE),Total_Poverty_Kinship =sum(ASECWT * in_kinship * below_150_poverty, na.rm =TRUE),.groups ='drop' )# Calculate the percentages and overall totals for each relationship by yearkin_tot_relate_by_year <- kin_tot_relate_by_year |>group_by(YEAR) |>mutate(Percentage = Total_Kinship /sum(Total_Kinship) *100,Poverty_Percentage = Total_Poverty_Kinship /sum(Total_Poverty_Kinship) *100 )# Step 3: Filter the data to include only 2023 for totals by relationship categorykin_tot_relate_2023 <- kin_tot_relate_by_year |>filter(YEAR ==2023)# Print the results for 2023print(kin_tot_relate_2023)
# A tibble: 4 × 6
# Groups: YEAR [1]
YEAR Relationship Total_Kinship Total_Poverty_Kinship Percentage
<dbl> <chr> <dbl> <dbl> <dbl>
1 2023 Brother/sister 27579. 20577. 10.5
2 2023 Grandchild 103832. 26499. 39.5
3 2023 Nonrelative without rela… 66955. 15905. 25.5
4 2023 Other relative 64647. 14510. 24.6
# ℹ 1 more variable: Poverty_Percentage <dbl>
Use of data from IPUMS CPS is subject to conditions including that users should cite the data appropriately. Use command `ipums_conditions()` for more details.
kin_offpov <- kin_o |>filter(AGE <18)kin_offpov2 <- kin_offpov |>filter( MOMLOC ==0& POPLOC ==0& RELATE %in%c(0901, 0701, 1001, 1260) ) |>mutate(RaceEthnicity =case_when( HISPAN !=0~"Hispanic", RACE ==100& HISPAN ==0~"White", RACE ==200& HISPAN ==0~"African-American", RACE !=100& RACE !=200& HISPAN ==0~"Non-Hispanic Other" ) )kin_offpov3 <- kin_offpov2 |>mutate(in_kinship =ifelse( MOMLOC ==0& POPLOC ==0& RELATE %in%c(0901, 0701, 1001, 1260), 1, 0 ),poverty_status =ifelse(OFFPOV ==1, 1, 0) # 1 if below poverty line, 0 if above )# Step 1: Create a new column for relationship categories based on RELATEkin_offpov3 <- kin_offpov3 |>mutate(Relationship =case_when( RELATE ==0901~"Grandchild", RELATE ==0701~"Brother/sister", RELATE ==1001~"Other relative", RELATE %in%c(1113, 1114, 1115, 1241, 1242) & (MOMLOC !=0| POPLOC !=0) ~"Nonrelative with relatives", RELATE ==1260| (RELATE %in%c(1113, 1114, 1115, 1241, 1242) & MOMLOC ==0& POPLOC ==0) ~"Nonrelative without relatives",TRUE~"Other" ) )# Step 2: Filter for the year 2023kin_offpov_2023 <- kin_offpov3 |>filter(YEAR ==2023)# Step 4: Group by Relationship and summarize the totals for children in kinship care by poverty statuskin_tot_relate_2023 <- kin_offpov_2023 |>group_by(Relationship) |>summarise(Total_Kinship =sum(ASECWT * in_kinship, na.rm =TRUE), # Total children in kinship careBelow_Poverty_Kinship =sum(ASECWT * in_kinship * poverty_status, na.rm =TRUE), # Total below poverty.groups ='drop' ) |>mutate(Above_Poverty_Kinship = Total_Kinship - Below_Poverty_Kinship # Total above poverty )# Step 5: Calculate percentages for each relationship typekin_tot_relate_2023 <- kin_tot_relate_2023 |>mutate(Percentage = Total_Kinship /sum(Total_Kinship) *100, # Percentage of total kinship care childrenPoverty_Percentage = Below_Poverty_Kinship / Total_Kinship *100# Percentage of kinship children below poverty )# Print the resultsprint(kin_tot_relate_2023)