# Share of households
count_over_zero100 <- function(x) { 100 * sum(x>0, na.rm = TRUE) / length(na.omit(x)) }
# Net present value
npv <- function(cf0, cf, times, i){
cf0 <- as.numeric(cf0)
cf <- as.numeric(cf)
vectordiscount <- rep((1+i), times)
t <- 1:times
discountrates <- vectordiscount^t
discount <- cf / discountrates
cf0 + sum(discount)
}
df.NL598 <- read.csv("data/NL598.csv") %>% select(-X)
# net figures
df.NL598$net_income <- df.NL598$A - rowSums(df.NL598[c("A1", "A2", "A3", "A4", "A5")] )
df.NL598$net_savings <- df.NL598$E - df.NL598$B
df.NL598$net_credit <- df.NL598$F - df.NL598$C
# consumption categories
df.NL598$food <- df.NL598$D1_16
df.NL598$shelter <- rowSums(df.NL598[c("D17", "D18", "D19", "D20", "D21a", "D21b", "D21c")])
df.NL598$clothing <- rowSums(df.NL598[c("D25", "D26", "D22")])
df.NL598$leisure <- rowSums(df.NL598[c("D32", "D33")])
df.NL598$other <- rowSums(df.NL598[c("D23a", "D23b", "D24", "D27", "D28", "D29", "D30", "D31", "D34", "D35", "D36", "D37", "D38")])
# fragility
df.NL598 <- df.NL598 %>%
mutate(fm = net_income - food - shelter - clothing) %>%
mutate(fm2 = net_income + A4 - food - shelter - clothing)
# share of consumption
df.NL598 <- df.NL598 %>%
mutate(fffm2 = ifelse(fm2 < quantile(fm2, probs = c(0.33)), 1,
ifelse(fm2 > quantile(fm2, probs = c(0.66)), 0, NaN))) %>%
mutate(fffm.con = ifelse(fm < quantile(fm, probs = c(0.33)), fm,
ifelse(fm > quantile(fm, probs = c(0.66)), fm, NaN)))
# HH size
df.NL598 <- df.NL598 %>%
mutate(temp = ifelse(is.na(age_m) & !is.na(age_f), 1,
ifelse(is.na(age_f) & !is.na(age_m), 1,2))) %>%
mutate(HH_size = temp + visitor + kids) %>%
select(-temp)
# Healthcare
df.NL598 <- df.NL598 %>%
mutate(healthcare = D28 / (net_income + A4)) %>%
mutate(healthcare_shock = ifelse(healthcare > quantile(healthcare, probs = c(0.66)), 1, 0))
Home value #### data manipulation Mean income per income group without farmers (work_class = 4). These average income figures match CBS (1938)
A.1 <- mean(df.NL598[df.NL598$A<1400 & df.NL598$work_class != 4,"A"],na.rm=TRUE)
A.2 <- mean(df.NL598[df.NL598$A>1400 & df.NL598$A<1800 & df.NL598$work_class != 4,"A"],na.rm=TRUE)
A.3 <- mean(df.NL598[df.NL598$A>1800 & df.NL598$A<2300 & df.NL598$work_class != 4,"A"],na.rm=TRUE)
A.4 <- mean(df.NL598[df.NL598$A>2300 & df.NL598$A<3000,"A"],na.rm=TRUE)
A.5 <- mean(df.NL598[df.NL598$A>3000 & df.NL598$A<4000,"A"],na.rm=TRUE)
A.6 <- mean(df.NL598[df.NL598$A>4000 & df.NL598$A<6000,"A"],na.rm=TRUE)
A.7 <- mean(df.NL598[df.NL598$A>6000,"A"],na.rm=TRUE)
How I set the fraction spent on pension and old-age insurance:
Up until A.1 (mean income of HH with income < 1400) P1;
From A.1 apply growh rate S1 until A.2 (mean income of HH with income > 1400 & income < 1800);
From A.2 apply growth rate S2 until A.3;
From A.3 until and including A.7, take the weighted average of the share P_weighted.
From weighted to A.7 take the growth rate
Pension and old-age
S1 <- (P2 - P1)/(A.2-A.1)
S2 <- (P_weighted*100 - P2)/(A.3-A.2)
S3 <- (P4 - P3)/(A.4-A.3)
S4 <- (P5 - P4)/(A.5-A.4)
S5 <- (P6 - P5)/(A.6-A.5)
S6 <- (P7 - P6)/(A.7-A.6)
Funeral and life
S11 <- (P21 - P11)/(A.2-A.1)
S21 <- (P_weighted1*100 - P21)/(A.3-A.2)
S31 <- (P41 - P31)/(A.4-A.3)
S41 <- (P51 - P41)/(A.5-A.4)
S51 <- (P61 - P51)/(A.6-A.5)
S61 <- (P71 - P61)/(A.7-A.6)
Pension and old-age
df.NL598$ins.frac <-
ifelse(df.NL598$A<A.1, P1/100,
ifelse(df.NL598$A>=A.1 & df.NL598$A<A.2,(P1 + ((df.NL598$A-A.1) * S1))/100,
ifelse(df.NL598$A>=A.2 & df.NL598$A < A.3, (P2 + ((df.NL598$A - A.2) *S2))/100 ,
ifelse(df.NL598$A >= A.3 &df.NL598$A < A.6, P_weighted ,
ifelse(df.NL598$A>= A.6 & df.NL598$A < A.7, (P6 + ((df.NL598$A - A.6) *S6))/100,
ifelse(df.NL598$A >=A.7,P7/100,"")))))) %>% as.numeric()
Funeral and life
df.NL598$ins.frac1 <-
ifelse(df.NL598$A<A.1, P11/100,
ifelse(df.NL598$A>=A.1 & df.NL598$A<A.2,(P11 + ((df.NL598$A-A.1) * S11))/100,
ifelse(df.NL598$A>=A.2 & df.NL598$A < A.3, (P21 + ((df.NL598$A - A.2) *S21))/100 ,
ifelse(df.NL598$A >= A.3 &df.NL598$A < A.6, P_weighted1 ,
ifelse(df.NL598$A>= A.6 & df.NL598$A < A.7, (P61 + ((df.NL598$A - A.6) *S61))/100,
ifelse(df.NL598$A >=A.7,P71/100,"")))))) %>% as.numeric()
Pension and old-age
df.NL598$ins.frac.CBS <-
ifelse(df.NL598$A<1400 , P1/100,
ifelse(df.NL598$A>1400 & df.NL598$A<1800,(P2)/100,
ifelse(df.NL598$A>1800 & df.NL598$A<2300, P3/100 ,
ifelse(df.NL598$A>2300 & df.NL598$A<3000, P4/100,
ifelse(df.NL598$A>3000 & df.NL598$A<4000, P5/100,
ifelse(df.NL598$A>4000 & df.NL598$A<6000,P6/100,
ifelse(df.NL598$A>6000,P7/100,""
))))))) %>% as.numeric()
Funeral and life
df.NL598$ins.frac.CBS1 <-
ifelse(df.NL598$A<1400 , P11/100,
ifelse(df.NL598$A>1400 & df.NL598$A<1800,P21/100,
ifelse(df.NL598$A>1800 & df.NL598$A<2300, P31/100 ,
ifelse(df.NL598$A>2300 & df.NL598$A<3000, P41/100,
ifelse(df.NL598$A>3000 & df.NL598$A<4000, P51/100,
ifelse(df.NL598$A>4000 & df.NL598$A<6000,P61/100,
ifelse(df.NL598$A>6000,P71/100,""
))))))) %>% as.numeric()
Health and other
df.NL598$ins.frac.CBS2 <-
ifelse(df.NL598$A<1400 , P12/100,
ifelse(df.NL598$A>1400 & df.NL598$A<1800,P22/100,
ifelse(df.NL598$A>1800 & df.NL598$A<2300, P32/100 ,
ifelse(df.NL598$A>2300 & df.NL598$A<3000, P42/100,
ifelse(df.NL598$A>3000 & df.NL598$A<4000, P52/100,
ifelse(df.NL598$A>4000 & df.NL598$A<6000,P62/100,
ifelse(df.NL598$A>6000,P72/100,""
))))))) %>% as.numeric()
Now I will calculate NPV following my own fractions and CBS fractions, both for pension and life insurance wealth.
Some households don’t have a male household head so then we work with female age. Here I calculate the number of years applied for discounting (time to retirement, ttr).
df.NL598$ttr <- ifelse(is.na(df.NL598$age_m),
ifelse(df.NL598$age_f < 60, 60 - df.NL598$age_f, 0),
ifelse(df.NL598$age_m < 60, 60 - df.NL598$age_m, 0))
Run the NPV command
b <- NULL
b1 <- NULL
b2 <- NULL
b3 <- NULL
#Calculating the NPV
for(i in 1:nrow(df.NL598)) {
if (is.na(df.NL598$ttr[i]) ){
a <- print(NA)
}
else{
a <- (npv(0,df.NL598$pension[i],df.NL598$ttr[i], 0.0332))
a1 <- (npv(0,df.NL598$pension.CBS[i],df.NL598$ttr[i], 0.0332))
a2 <- (npv(0,df.NL598$life[i],df.NL598$ttr[i], 0.0332))
a3 <- (npv(0,df.NL598$life.CBS[i],df.NL598$ttr[i], 0.0332))
}
b <- c(b,a)
b1 <- c(b1,a1)
b2 <- c(b2,a2)
b3 <- c(b3,a3)
}
Combine the data.
df.NL598 <- cbind(df.NL598, npv.pension = b, npv.pension.CBS = b1, npv.life = b2, npv.life.CBS = b3)
# land & pacht
df.land <- read.csv("data/land.csv") %>%
subset(!is.na(pacht)) %>%
select(provincie, pacht) %>%
as.data.frame()
df.NL598 <- df.NL598 %>%
inner_join(df.land, by = "provincie")
df.NL598 <- df.NL598 %>%
mutate(land_value = (land * pacht)/ (0.0332 * 1000) * 1000)
df.NL598 <- df.NL598 %>% mutate(home_value = D17 * own_house / 0.0332)
# clean up
rm(list = ls.str(mode = 'numeric'))
rm(df.land)
df.NL598 <- df.NL598 %>% select(-matches("ins.frac"), -matches("CBS"), -pension, -life)
df.NL700 <- read.csv("data/NL700.csv") %>% select(-X)
# towards yearly figures
df.NL700 <- df.NL700 %>%
mutate(support = support * 52) %>%
mutate(public_employment = public_employment * 52) %>%
mutate(fuel_subsidy = fuel_subsidy * 52) %>%
mutate(food_distr = food_distr * 52) %>%
mutate(income.HH.head = income.HH.head * 52) %>%
mutate(income.own.company = income.own.company * 52) %>%
mutate(other.HH.income = other.HH.income * 52) %>%
mutate(gifts = gifts * 52) %>%
mutate(stocks = stocks * 52) %>%
mutate(income = income * 52) %>%
mutate(food = food * 52) %>%
mutate(housing = housing * 52) %>%
mutate(fire = fire * 52) %>%
mutate(clothing = clothing * 52) %>%
mutate(insurance = insurance * 52) %>%
mutate(other = other * 52) %>%
mutate(consumption = consumption * 52)
# add financial margin and net income
df.NL700 <- df.NL700 %>%
mutate(housing = housing + fire) %>%
mutate(fm = income - stocks - food - housing - clothing) %>%
mutate(net_income = support + public_employment + fuel_subsidy + food_distr + income.HH.head + income.own.company + other.HH.income) %>%
mutate(social_security = support + public_employment + fuel_subsidy + food_distr) %>%
mutate(HHincome = income.HH.head + income.own.company + other.HH.income)
df.A1934 <- read.csv("data/Amsterdam1934.csv") %>%
mutate(HHincome = Man + Vrouw + Kinderen) %>%
mutate(social_security = Werkloosheidssteun + `Andere.steun` + Brandstoffentoeslag) %>%
mutate(financial = `Invaliditeits..of.weezenrente..Pensioen.e.d.`) %>%
mutate(other_income = Onderhuur + Overige) %>%
mutate(gifts = `Diverse.voorwerpen`+ Schoolvoeding + Schoolkleding) %>%
mutate(credit = `Geleend.of.uitbeleening`) %>%
mutate(income = select(., HHincome, social_security,financial,other_income, gifts) %>% rowSums(na.rm = TRUE)) %>%
mutate(food = Food) %>% select(-Food) %>%
mutate(shelter = Rent + `Gas.El.Fuel`) %>% select(-Rent, -`Gas.El.Fuel`) %>%
mutate(clothing = Clothing + Footwear) %>% select(-Clothing, -Footwear) %>%
mutate(insurance = `Funeral.Health`+Insurance) %>%
mutate(other_cons = Other) %>% select(-Other) %>%
mutate(consumption = select(., food, shelter, clothing,insurance,other_cons) %>% rowSums(na.rm = TRUE)) %>%
mutate(fm = income - consumption) %>%
mutate_at(vars(income, consumption, HHincome, social_security, financial, other_income, gifts,
credit,fm, food, shelter, clothing, insurance, other_cons), funs(. / `X.Weeks` * 52))
df.DH1932 <- read.csv("data/DH1932.csv") %>%
mutate(HHincome = Man_loon + Vrouw_loon + Zoonloon + Dochter_loon) %>%
mutate(social_security = Totaal_Steun) %>%
mutate(financial = Ouderdomsrente + Dividend + Restitutie + `Kerst.uitkering`) %>%
mutate(other = `Overig.inkomen`) %>%
mutate(gifts = Voeding + Kleding + Schoeisel + Huisraad + Rookwaren + Overig) %>%
mutate(stocks = Voedsel + Brandstof) %>%
mutate(credit = `Lening.1`) %>%
mutate(income = select(., HHincome, social_security,financial,other, gifts, stocks) %>% rowSums(na.rm = TRUE)) %>%
mutate(consumption = Uitgaven) %>%
mutate(fm = income - consumption) %>%
mutate_at(vars(income, consumption, HHincome, social_security, financial, other, gifts, stocks, credit,fm), funs(. / `X.weken` * 52))
df.DH1935 <- read.csv("data/DH1935.csv") %>%
mutate(income = Ontvangsten + `Waarde.van.schenkingen.in.natura`) %>%
mutate(kind = `Waarde.van.schenkingen.in.natura`) %>%
mutate(social_security = `steunbedrag.per.week.bij.aanvang.onderzoek`) %>%
mutate(consumption = Uitgaven) %>%
mutate(fm = income - consumption) %>%
mutate_at(vars(income, consumption, fm, social_security, kind), funs(. * 52))
fig1 <- read.csv("data/savings.csv") %>%
subset(year<1939) %>%
subset(year > 1899) %>%
# gather(asset, value, "savings", factor_key=TRUE) %>%
ggplot(aes(x=year, y=savings)) + geom_point(shape=1) +
geom_point() +
scale_color_manual(name = "", labels = c("")) +
xlab("Jaar") + ylim(0,350) + scale_x_continuous(breaks = seq(1900, 1940, by=10), limits=c(1900,1940))+
guides(colour = guide_legend(reverse=T)) +
ylab("1936 Guilders") + xlab("year") + labs(title = "Household real savings per capita ") +
theme_bw()
fig2 <- read.csv("data/unemployment.csv") %>%
subset(jaar<1939) %>%
mutate(unemp = unemp/100) %>%
as.data.frame() %>%
ggplot(aes(x=jaar, y=unemp)) +
geom_point() +
scale_color_manual(name = "", labels = c("")) +
xlab("Jaar") + scale_x_continuous(breaks = seq(1900, 1940, by=10), limits=c(1900,1940))+
scale_y_continuous(labels = percent_format(accuracy = 1), breaks = seq(0, 0.2, by = 0.05), limits= c(0,0.20)) +
guides(colour = guide_legend(reverse=T)) +
ylab("") + xlab("year") + labs(title = "Unemployment") +
theme_bw()
fig3 <- read.csv("data/hhbudget.csv") %>%
subset(year<1939) %>%
as.data.frame() %>%
ggplot(aes(x=year, y=rw)) + geom_point(shape=1) +
geom_point() +
scale_color_manual(name = "", labels = c("")) +
xlab("year") + scale_x_continuous(breaks = seq(1900, 1940, by=10), limits=c(1900,1940))+
scale_y_continuous(breaks = seq(0, 50, by = 10), limits= c(0,50)) +
guides(colour = guide_legend(reverse=T)) +
ylab("Guilders") + labs(title = "Real wages building labourer") +
theme_bw()
fig4 <- read.csv("data/hhbudgetprimary.csv") %>%
subset(year<1939) %>%
as.data.frame() %>% select(year, group2, percentage) %>%
ggplot(aes(x=year, y=percentage, group=group2)) +
scale_shape_manual(values=c(1, 2, 3)) +
geom_point(aes(shape = group2)) +
xlab("Jaar") + scale_x_continuous(breaks = seq(1900, 1940, by=10), limits=c(1900,1940))+
scale_y_continuous(labels = percent_format(accuracy = 1), breaks = seq(0, 1, by = 0.2), limits= c(0,1)) +
guides(colour = guide_legend(reverse=T)) + guides(color=guide_legend("labour type")) +
ylab("") + xlab("year") + labs(title = "Share of primary expenses", shape = "Labour type") + scale_size_area(max_size = 20) +
theme_bw() + theme(legend.position = c(0.25, 0.25),legend.box.margin = margin(t = 0.5, unit='cm'),
legend.margin = margin(t = -0.5, unit='cm'),
legend.background = element_rect(fill = "white", color = "black"))
ggarrange(fig2, fig3, fig4, fig1,
labels = c("A", "B", "C", "D"),
ncol = 2, nrow = 2)
rm(fig1, fig2, fig3, fig4)
ggplot(st_read("data/shapefile598.shp", stringsAsFactors = F)) +
geom_sf(aes(fill = Freq), size = .1, colour = "grey90") +
labs(fill = "N") +
theme_minimal() +
scale_fill_gradient(high = "red", low = "yellow", na.value = "grey70") +
theme(axis.text.y = element_blank()) +
theme(axis.text.x = element_blank()) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
## Reading layer `shapefile598' from data source
## `/Users/timvdvalk/Documents/Economics/finkwets/R/howitsmade/data/shapefile598.shp'
## using driver `ESRI Shapefile'
## replacing null geometries with empty geometries
## Simple feature collection with 1125 features and 6 fields (with 4 geometries empty)
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: 13240 ymin: 306980 xmax: 278070 ymax: 618430
## CRS: NA
ggplot(st_read("data/shapefile700.shp", stringsAsFactors = F)) +
geom_sf(aes(fill = Steekproef), size = .1, colour = "grey90") +
labs(fill = "N") +
theme_minimal() +
scale_fill_gradient(high = "red", low = "yellow", na.value = "grey70") +
theme(axis.text.y = element_blank()) +
theme(axis.text.x = element_blank()) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
## Reading layer `shapefile700' from data source
## `/Users/timvdvalk/Documents/Economics/finkwets/R/howitsmade/data/shapefile700.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 1121 features and 7 fields
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: 13240 ymin: 306980 xmax: 278070 ymax: 618430
## CRS: NA
df.income <- read.csv("data/income_distribution.csv")
# now create the table for 598 households
b <- NULL
a <- length(df.NL598$net_income[ df.NL598$net_income < 1400 & df.NL598$net_income >= 800])
b <- c(b,a)
a <- length(df.NL598$net_income[ df.NL598$net_income < 2000 & df.NL598$net_income >= 1400])
b <- c(b,a)
a <- length(df.NL598$net_income[ df.NL598$net_income < 3000 & df.NL598$net_income >= 2000])
b <- c(b,a)
a <- length(df.NL598$net_income[ df.NL598$net_income < 5000 & df.NL598$net_income >= 3000])
b <- c(b,a)
a <- length(df.NL598$net_income[ df.NL598$net_income < 10000 & df.NL598$net_income >= 5000])
b <- c(b,a)
a <- length(df.NL598$net_income[ df.NL598$net_income < 20000 & df.NL598$net_income >= 10000])
b <- c(b,a)
a <- length(df.NL598$net_income[ df.NL598$net_income < 30000 & df.NL598$net_income >= 20000])
b <- c(b,a)
a <- length(df.NL598$net_income[ df.NL598$net_income < 100000 & df.NL598$net_income >= 30000])
b <- c(b,a)
a <- length(df.NL598$net_income[ df.NL598$net_income >= 100000 ])
b <- c(b,a)
# now combine
df.income$N2 <- b
df.income$share2 <- df.income$N2 / sum(df.income$N2)
b <- NULL
a <- length(df.NL700$income[ df.NL700$income < 1400 & df.NL700$income >= 800])
b <- c(b,a)
a <- length(df.NL700$income[ df.NL700$income < 2000 & df.NL700$income >= 1400])
b <- c(b,a)
a <- length(df.NL700$income[ df.NL700$income < 3000 & df.NL700$income >= 2000])
b <- c(b,a)
a <- length(df.NL700$income[ df.NL700$income < 5000 & df.NL700$income >= 3000])
b <- c(b,a)
a <- length(df.NL700$income[ df.NL700$income < 10000 & df.NL700$income >= 5000])
b <- c(b,a)
a <- length(df.NL700$income[ df.NL700$income < 20000 & df.NL700$income >= 10000])
b <- c(b,a)
a <- length(df.NL700$income[ df.NL700$income < 30000 & df.NL700$income >= 20000])
b <- c(b,a)
a <- length(df.NL700$income[ df.NL700$income < 100000 & df.NL700$income >= 30000])
b <- c(b,a)
a <- length(df.NL700$income[ df.NL700$income >= 100000 ])
b <- c(b,a)
# now combine
df.income$N3 <- b
df.income$share3 <- df.income$N3 / sum(df.income$N3)
rm(a,b)
colnames(df.income) <- c("range", "NL N", "NL share", "598 N", "598 share", "700 N", "700 share")
df.income
## range NL N NL share 598 N 598 share 700 N 700 share
## 1 800-1,400 595,384 0.4634940010 154 0.30738523 382 0.957393484
## 2 1,400-2,000 349,502 0.2720800027 162 0.32335329 16 0.040100251
## 3 2,000-3,000 180,867 0.1408011796 102 0.20359281 1 0.002506266
## 4 3,000-5,000 97,444 0.0758581175 55 0.10978044 0 0.000000000
## 5 5,000-10,000 43,846 0.0341331947 22 0.04391218 0 0.000000000
## 6 10,000-20,000 12,492 0.0097247609 6 0.01197605 0 0.000000000
## 7 20,000-30,000 2,730 0.0021252479 0 0.00000000 0 0.000000000
## 8 30,000-100,000 2,084 0.0016223504 0 0.00000000 0 0.000000000
## 9 >100,000 207 0.0001611452 0 0.00000000 0 0.000000000
Income shares for Den Haag and Utrecht 1935 are derived from the original report
df.A1934 %>%
select(income, social_security , HHincome, gifts, other_income, financial) %>%
mutate(HHincome = HHincome / income, social_security = social_security / income, gifts = gifts / income, other_income = (financial +other_income) / income ) %>% select(-financial) %>%
stargazer(summary.stat = c("n","mean"), type = "text",
title = "Domestic accounts Amsterdam 1934-1935 (N = 78)")
##
## Domestic accounts Amsterdam 1934-1935 (N = 78)
## ==========================
## Statistic N Mean
## --------------------------
## income 78 977.559
## social_security 78 0.820
## HHincome 78 0.121
## gifts 78 0.039
## other_income 78 0.020
## --------------------------
df.DH1932 %>%
select(income, social_security , HHincome, gifts, other, financial) %>%
mutate(HHincome = HHincome / income, social_security = social_security / income, gifts = gifts / income, other_income = (financial +other) / income ) %>% select(-other, -financial) %>%
stargazer(summary.stat = c("n","mean"), type = "text",
title = "Domestic accounts The Hague 1932 (N = 90)")
##
## Domestic accounts The Hague 1932 (N = 90)
## ============================
## Statistic N Mean
## ----------------------------
## income 90 1,103.925
## social_security 90 0.867
## HHincome 90 0.051
## gifts 90 0.049
## other_income 90 0.032
## ----------------------------
df.DH1935 %>%
select(income) %>%
stargazer(summary.stat = c("n","mean"), type = "text",
title = "Domestic accounts The Hague 1935 (N = 129)")
##
## Domestic accounts The Hague 1935 (N = 129)
## =====================
## Statistic N Mean
## ---------------------
## income 129 935.639
## ---------------------
Consumption shares for Den Haag 1932 and 1935 and Utrecht 1935 are derived from the original report
df.A1934 %>% select(consumption, food, shelter, clothing, insurance, other_cons) %>%
mutate(food = food / consumption, shelter = shelter / consumption, clothing = clothing / consumption, other_cons = (other_cons +insurance) / consumption ) %>% select(-insurance) %>%
stargazer(summary.stat = c("n","mean"), type = "text",
title = "Domestic accounts Amsterdam 1934-1935 (N = 78)")
##
## Domestic accounts Amsterdam 1934-1935 (N = 78)
## ========================
## Statistic N Mean
## ------------------------
## consumption 78 1,003.922
## food 78 0.403
## shelter 78 0.422
## clothing 78 0.045
## other_cons 78 0.129
## ------------------------
df.DH1932 %>%
select(consumption) %>%
stargazer(summary.stat = c("n","mean"), type = "text",
title = "Domestic accounts The Hague 1932 (N = 90)")
##
## Domestic accounts The Hague 1932 (N = 90)
## ========================
## Statistic N Mean
## ------------------------
## consumption 90 1,077.354
## ------------------------
df.DH1935 %>%
select(consumption) %>%
stargazer(summary.stat = c("n","mean"), type = "text",
title = "Domestic accounts The Hague 1935 (N = 129)")
##
## Domestic accounts The Hague 1935 (N = 129)
## =======================
## Statistic N Mean
## -----------------------
## consumption 129 892.705
## -----------------------
This table is directly taken from the original report.
modelsummary::datasummary(data = df.NL700, escape = FALSE,
(Income = income) +
(` Net income` = HHincome) +
(` Social sec.` = social_security) +
(` Gifts` = gifts) +
(` Stocks` = stocks) +
(`Consumption` = consumption) +
(` Food` = food) +
(` Shelter` = housing) +
(` Clothing` = clothing) +
(` Insurance` = insurance) +
(` Other` = other) ~
(`Share (%)`= count_over_zero100) +
(Mean = mean) +
(`Std. Dev.` = sd) +
(Min = min) +
(Max = max) +
(Median = median) )
Share (%) | Mean | Std. Dev. | Min | Max | Median | |
---|---|---|---|---|---|---|
Income | 100.00 | 852.63 | 222.58 | 409.24 | 2048.80 | 834.08 |
Net income | 59.29 | 138.13 | 206.04 | 0.00 | 1382.16 | 40.30 |
Social sec. | 100.00 | 645.65 | 184.14 | 15.60 | 1235.00 | 660.92 |
Gifts | 70.29 | 32.68 | 48.21 | 0.00 | 323.44 | 11.96 |
Stocks | 79.00 | 35.27 | 46.39 | 0.00 | 250.12 | 17.94 |
Consumption | 100.00 | 891.65 | 230.47 | 390.52 | 2437.76 | 857.48 |
Food | 100.00 | 446.95 | 145.18 | 163.80 | 1347.84 | 428.48 |
Shelter | 100.00 | 241.05 | 76.22 | 46.28 | 528.32 | 242.32 |
Clothing | 99.29 | 67.11 | 51.26 | 0.00 | 367.64 | 53.56 |
Insurance | 97.86 | 57.58 | 31.50 | 0.00 | 171.60 | 56.68 |
Other | 99.29 | 78.05 | 74.54 | 0.00 | 1296.36 | 61.10 |
This table comes from the reported sources in the paper
modelsummary::datasummary(data = df.NL598 %>% filter(work != "landbouwer"), escape = FALSE,
(Income = A) +
(` Net income` = net_income) +
(` Home prod.` = A4) +
(` Impl. rent` = A3) +
(` Inc. (kind)` = A1) +
(` Sup. (kind)` = A2) +
(` Lodgers` = A5) +
(`Consumption` = D) +
(` Food` = food) +
(` Shelter` = shelter) +
(` Clothing` = clothing) +
(` Other` = other) +
(`Savings (net)` = net_savings) +
(`Credit (net)` = net_credit) ~
(`Share (%)`= count_over_zero100) +
(Mean = mean) +
(`Std. Dev.` = sd) +
(Min = min) +
(Max = max) +
(Median = median) )
Share (%) | Mean | Std. Dev. | Min | Max | Median | |
---|---|---|---|---|---|---|
Income | 100.00 | 2255.46 | 1863.15 | 720.29 | 19553.20 | 1740.25 |
Net income | 100.00 | 2176.17 | 1839.08 | 574.51 | 19553.20 | 1692.32 |
Home prod. | 37.90 | 12.93 | 39.30 | 0.00 | 566.12 | 0.00 |
Impl. rent | 22.29 | 29.39 | 80.38 | 0.00 | 652.52 | 0.00 |
Inc. (kind) | 25.52 | 18.18 | 55.62 | 0.00 | 700.00 | 0.00 |
Sup. (kind) | 26.86 | 7.61 | 20.10 | 0.00 | 159.58 | 0.00 |
Lodgers | 7.05 | 11.17 | 98.62 | 0.00 | 1553.80 | 0.00 |
Consumption | 100.00 | 2198.52 | 1702.30 | 739.48 | 19835.26 | 1727.92 |
Food | 100.00 | 630.43 | 211.16 | 276.95 | 1651.35 | 579.51 |
Shelter | 100.00 | 491.24 | 281.87 | 118.74 | 2554.20 | 422.99 |
Clothing | 100.00 | 231.60 | 182.04 | 23.94 | 1698.20 | 180.44 |
Other | 100.00 | 736.23 | 1041.69 | 29.96 | 12255.76 | 399.02 |
Savings (net) | 52.76 | 61.71 | 432.60 | −1073.32 | 6163.92 | 3.13 |
Credit (net) | 38.86 | −4.87 | 190.47 | −2454.38 | 1409.29 | 0.00 |
This table directly comes from the reported sources in the paper
Share (%) | Mean | Min | Median | Max | |
---|---|---|---|---|---|
Housing wealth | 24.76 | 2316.68 | 0.00 | 0.00 | 30120.48 |
Land wealth | 40.19 | 103.61 | 0.00 | 0.00 | 8148.19 |
LI wealth | 93.33 | 925.71 | 0.00 | 664.62 | 11175.71 |
Pension wealth | 93.33 | 1088.14 | 0.00 | 477.19 | 12590.88 |
df.DH1932 %>%
select(fm) %>%
stargazer(covariate.labels = c("Financial margin", summary = TRUE),
summary.stat = c("n","mean","min", "p25","median", "p75","max"), type = "text",
title = "Financial margin The Hague 1932 (N = 90)")
##
## Financial margin The Hague 1932 (N = 90)
## ====================================================================
## Statistic N Mean Min Pctl(25) Median Pctl(75) Max
## --------------------------------------------------------------------
## Financial margin 90 26.571 -194.240 -16.690 8.180 83.850 231.010
## --------------------------------------------------------------------
df.A1934 %>%
select(fm) %>%
stargazer(covariate.labels = c("Financial margin", summary = TRUE),
summary.stat = c("n","mean","min", "p25","median", "p75","max"), type = "text",
title = "Financial margin Amsterdam 1934-1935 (N = 78)")
##
## Financial margin Amsterdam 1934-1935 (N = 78)
## =====================================================================
## Statistic N Mean Min Pctl(25) Median Pctl(75) Max
## ---------------------------------------------------------------------
## Financial margin 78 -26.364 -308.956 -35.790 -6.030 4.785 104.880
## ---------------------------------------------------------------------
df.DH1935 %>%
select(fm) %>%
stargazer(covariate.labels = c("Financial margin", summary = TRUE),
summary.stat = c("n","mean","min", "p25","median", "p75","max"), type = "text",
title = "Financial margin The Hague 1935 (N = 129)")
##
## Financial margin The Hague 1935 (N = 129)
## =====================================================================
## Statistic N Mean Min Pctl(25) Median Pctl(75) Max
## ---------------------------------------------------------------------
## Financial margin 129 42.934 -181.220 -1.560 26.260 66.300 603.460
## ---------------------------------------------------------------------
df.NL700 %>%
select(fm) %>%
stargazer(covariate.labels = c("Financial margin", summary = TRUE),
summary.stat = c("n","mean","min", "p25","median", "p75","max"), type = "text",
title = "Financial margin The Netherlands 1937 (N = 700)")
##
## Financial margin The Netherlands 1937 (N = 700)
## =====================================================================
## Statistic N Mean Min Pctl(25) Median Pctl(75) Max
## ---------------------------------------------------------------------
## Financial margin 700 62.261 -374.920 5.070 70.720 121.160 629.720
## ---------------------------------------------------------------------
df.NL598 %>% filter(work != "landbouwer") %>%
select(fm) %>%
stargazer(covariate.labels = c("Financial margin", summary = TRUE),
summary.stat = c("n","mean","min", "p25","median", "p75","max"), type = "text",
title = "Financial margin The Netherlands 1936-37 (N = 598)")
##
## Financial margin The Netherlands 1936-37 (N = 598)
## ==========================================================================
## Statistic N Mean Min Pctl(25) Median Pctl(75) Max
## --------------------------------------------------------------------------
## Financial margin 525 822.902 -632.510 214.970 464.200 837.340 13,649.450
## --------------------------------------------------------------------------
linear.1 <- lm(fffm.con ~ av_age + HH_size + HC2 + HC3 + HC5 ,
data = df.NL598 %>% filter(work != "landbouwer")) %>%
coeftest(., vcov = vcovHC(., type = "HC0"))
linear.2 <- lm(fffm.con ~ av_age + HH_size + HC2 + HC3 + HC5 + location21 + location22 ,
data = df.NL598 %>% filter(work != "landbouwer")) %>%
coeftest(., vcov = vcovHC(., type = "HC0"))
linear.3 <- lm(fffm.con ~ av_age + HH_size + HC2 + HC3 + HC5 + location21 + location22 +home_value + land_value + npv.life + npv.pension,
data = df.NL598 %>% filter(work != "landbouwer")) %>%
coeftest(., vcov = vcovHC(., type = "HC0"))
linear.4 <- lm(fffm.con ~ av_age + HH_size + HC2 + HC3 + HC5 + location21 + location22 + av_age +home_value + land_value + npv.life + npv.pension + death + newborn + healthcare_shock + unemp ,
data = df.NL598 %>% filter(work != "landbouwer")) %>%
coeftest(., vcov = vcovHC(., type = "HC0"))
stargazer(linear.1, linear.2, linear.3, linear.4, title="The Determinants of Financial Fragility of Dutch Households in 1936-37", type = "text", align=TRUE, covariate.labels = c("Av. Age", "HH size", "HC2 (d)", "HC3 (d)", "HC5 (d)", "Large (d)", "Industrial (d)", "Housing wealth", "Land wealth", "LI wealth", "Pension wealth", "death (d)", "Newborn (d)", "Healthcare (d)", "Unemployment"))
##
## The Determinants of Financial Fragility of Dutch Households in 1936-37
## ======================================================================
## Dependent variable:
## -------------------------------------------------------
##
## (1) (2) (3) (4)
## ----------------------------------------------------------------------
## Av. Age 14.650** 16.060** 33.652*** 28.983***
## (7.190) (7.572) (7.922) (7.430)
##
## HH size -41.545* -46.864** -61.260*** -64.612***
## (21.800) (22.846) (20.626) (20.805)
##
## HC2 (d) -1,766.206*** -1,769.582*** -920.535*** -920.310***
## (350.806) (348.478) (260.659) (254.669)
##
## HC3 (d) -2,714.342*** -2,755.682*** -1,627.673*** -1,655.356***
## (332.114) (338.446) (247.325) (245.594)
##
## HC5 (d) -2,874.741*** -2,839.641*** -1,693.984*** -1,701.765***
## (334.485) (334.488) (266.609) (265.403)
##
## Large (d) 273.216* -28.426 -38.343
## (156.651) (134.714) (133.286)
##
## Industrial (d) -54.386 -98.253 -104.157
## (109.012) (111.200) (110.201)
##
## Housing wealth 0.029* 0.029**
## (0.015) (0.015)
##
## Land wealth -0.002 -0.016
## (0.036) (0.033)
##
## LI wealth 1.296*** 1.370***
## (0.431) (0.433)
##
## Pension wealth -0.459** -0.530**
## (0.224) (0.230)
##
## death (d) 420.937
## (307.033)
##
## Newborn (d) -266.799**
## (131.314)
##
## Healthcare (d) -287.495***
## (90.750)
##
## Unemployment -2.595
## (3.104)
##
## Constant 2,672.911*** 2,567.659*** 446.290 809.374
## (416.609) (414.650) (515.391) (491.540)
##
## ======================================================================
## ======================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
rm(linear.1, linear.2, linear.3, linear.4)
df.NL598.share <- df.NL598 %>% filter(work != "landbouwer") %>%
select(D, net_income, A1, A2, A3, A4, A5, E, B, F, C, fffm2,unemp2) %>%
mutate(E = -E) %>%
mutate(F = -F)
df.NL598.share <- cbind(df.NL598.share[,2:11] / df.NL598.share[,1], df.NL598.share[,12:13])
colnames(df.NL598.share) <- c("net_income", "A1", "A2", "A3", "A4", "A5", "E", "B", "F", "C", "fffm2", "unemp2")
mean <- NULL
stat <- NULL
p <- NULL
col <- names(df.NL598.share[,1:10])
for(i in col){
a <- t.test(data = df.NL598.share, df.NL598.share[[i]] ~ fffm2)$estimate
b <- t.test(data = df.NL598.share, df.NL598.share[[i]] ~ fffm2)$statistic
c <- t.test(data = df.NL598.share, df.NL598.share[[i]] ~ fffm2)$p.value
mean <- rbind(mean,a)
stat <- rbind(stat,b)
p <- rbind(p,c)
}
tt2.2 <- cbind(mean, stat, p)
rownames(tt2.2) <- c("Net income", "Income in kind", "Support in kind", "Impl. rent (net)", "Home prod.", "Lodgers", "Savings (out)", "Savings (in)" , "Credit (out)", "Credit (in)")
colnames(tt2.2) <- c("ff2 = 0", "ff2 = 1", "t", "p")
tt2.2 <- cbind(mean, stat, p)
rownames(tt2.2) <- c("Net income", "Income in kind", "Support in kind", "Impl. rent (net)", "Home prod.", "Lodgers", "Savings (out)", "Savings (in)" , "Credit (out)", "Credit (in)")
# colnames(tt2.2) <-
stargazer(tt2.2, title = "Cash Flows to Finance the Consumption of Dutch Households in 1936-1937 (N = 525)",
type = "text", align=TRUE)
##
## Cash Flows to Finance the Consumption of Dutch Households in 1936-1937 (N = 525)
## ===============================================================
## mean in group 0 mean in group 1 t .1
## ---------------------------------------------------------------
## Net income 1.027 0.888 11.811 0
## Income in kind 0.006 0.011 -2.136 0.034
## Support in kind 0.0002 0.018 -8.550 0
## Impl. rent (net) 0.013 0.015 -0.676 0.499
## Home prod. 0.002 0.025 -5.773 0.00000
## Lodgers 0.005 0.005 -0.012 0.991
## Savings (out) -0.074 -0.010 -5.658 0.00000
## Savings (in) 0.019 0.039 -3.526 0.0005
## Credit (out) -0.018 -0.008 -2.411 0.017
## Credit (in) 0.021 0.017 0.510 0.611
## ---------------------------------------------------------------
rm(df.NL598.share, mean, p, stat, tt2.2, a, b, c, col, i)
df.NL598.share <- df.NL598 %>%
select(D, food, shelter, clothing, leisure, other, fffm2 )
df.NL598.share <- cbind(df.NL598.share[,2:6] / df.NL598.share[,1], df.NL598.share[,7])
colnames(df.NL598.share) <- c("Food", "Shelter", "Clothing", "Leisure", "Other", "fffm2")
mean <- NULL
stat <- NULL
p <- NULL
col <- names(df.NL598.share[,1:5])
for(i in col){
a <- t.test(data = df.NL598.share, df.NL598.share[[i]] ~ fffm2)$estimate
b <- t.test(data = df.NL598.share, df.NL598.share[[i]] ~ fffm2)$statistic
c <- t.test(data = df.NL598.share, df.NL598.share[[i]] ~ fffm2)$p.value
mean <- rbind(mean,a)
stat <- rbind(stat,b)
p <- rbind(p,c)
}
ttc22 <- cbind(mean, stat, p)
rownames(ttc22) <- c("Food", "Shelter", "Clothing", "Leisure", "Other")
colnames(ttc22) <- c("ff = 0", "ff = 1", "t", "p")
stargazer(ttc22, title = "Consumption shares of Dutch Households in 1936-1937 (N = 525)",
type = "text", align=TRUE)
##
## Consumption shares of Dutch Households in 1936-1937 (N = 525)
## ======================================
## ff = 0 ff = 1 t p
## --------------------------------------
## Food 0.239 0.452 -24.744 0
## Shelter 0.216 0.245 -5.066 0.00000
## Clothing 0.108 0.101 2.052 0.041
## Leisure 0.051 0.034 5.967 0
## Other 0.387 0.169 25.672 0
## --------------------------------------
rm(df.NL598.share, mean, p, stat, ttc22, a, b, c, col, i)