data-raw/ce_2018.R

## code to prepare `ce_2018` data set goes here

#This is the from the U.S> consumer expenditure survey for 2018. Files have been
#downloaded from the bureau of labor's website: https://www.bls.gov/cex/pumd_data.htm#csv
#An introduction to the data set is here: https://www.bls.gov/cex/pumd-getting-started-guide.htm
#This is a link to the codebook: https://www.bls.gov/cex/pumd/ce_pumd_interview_diary_dictionary.xlsx

#The 184 in the file below indicates this is data for 2018 for the 4th quarter.

ce <- read.csv("C:/Users/Josh/Documents/fabricated - files/fmli184.csv")

cex <- read.csv("C:/Users/Josh/Documents/fabricated - files/fmli181x.csv")

para <- read.csv("C:/Users/Josh/Documents/fabricated - files/fpar1718.csv")

fld <- read.csv("C:/Users/Josh/Documents/fabricated - files/fmld181.csv")



ce <- left_join(ce, para, by = "NEWID")

dim(ce)

ce_1 <- ce %>%
  filter(RECORDS == 2)

dim(ce_1)

benford(ce_1$FINCBTAX, number.of.digits = 1)

benford(ce_1$TOTEXPCQ, number.of.digits = 1)




dim(ce)

dim(fld)

head(fld$STATE)


benford(fld$, number.of.digits = 1)

$FINCBTAX

benford(cex$FINCBTAX, number.of.digits = 1)

benford(cex$ETOTALP, number.of.digits = 1)



#TOTEXPCQ = total expenditures for this quarter.

benford(cex$TOTEXPCQ, number.of.digits = 1)

plot(x)

x


benford(ce$TOTEX4PQ, number.of.digits = 1)

benford(cex$TOTEX4PQ, number.of.digits = 1)


x <- benford(ce$TOTHENTC, number.of.digits = 1)
plot(x)
x

#Income

benford(ce$EARN_OMP)

EARNINCX


benford(cex$ea)

benford(ce$TOTHFARP)


ce$EARNCOMP

x <- benford(cex$FINCBTAX, number.of.digits = 1)

plot(x)

x



cex$FINCBTAX

cex <- cex %>%
  mutate(total_income = FSALARYX + FNONFRMX)





plot(x)

x
josh-mc/fabricated documentation built on April 25, 2022, 1:31 p.m.