Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

--- title: "Final Project - Report" subtitle: "Effect of Poverty on Housing Affordability" author: "Your Name" output: html_document # ioslides_presentation --- # 1. Introduction ## Overview...

1 answer below »
---
title: "Final Project - Report"
subtitle: "Effect of Poverty on Housing Affordability"
author: "Your Name"
output:
html_document
# ioslides_presentation
---
# 1. Introduction
## Overview {.smaller}
***EDIT ME***
!---
Describe your topic and why it interests you, and main tasks performed
--
## Hypothesis Development {.smaller}
***EDIT ME***
!---
State your research question and testable hypothesis
--
# 2. Empirical Framework
```{r, message=F, warning=F, echo=F}
#Load in li
aries
li
ary(tidycensus)
li
ary(tidyverse)
li
ary(plyr)
li
ary(stargazer)
li
ary(co
plot)
li
ary(pu
)
```
```{r echo=F, message=F, quietly=T}
li
ary(tidycensus)
census_key <- "8eab9b16f44cb26460ecbde164482194b7052772"
census_api_key(census_key)
```
```{r, message=F, warning=F, echo=F}
#Create your list of variables
variables = c(
HousePrice = 'B25077_001', # Median Value of Housing Units
HHIncome = 'B19013_001', # Median household Income
#Explanatory Variables Below
below_poverty = 'B05010_002',
total_pop ='B01001_001',
pop_white = 'B01001H_001', # not hispanic
pop_black = 'B01001B_001',
pop_hispanic = 'B01001I_001',
speak_english = 'B06007_002',
speak_spanish = 'B06007_003',
bachelors = 'B06008_002',
ma
ied = 'B06008_003',
no_hs = 'B06009_002',
hs = 'B06009_003',
bach_degree = 'B06009_005',
grad_degree = 'B06009_006')
```
```{r, message=F, warning=F, echo=F}
#Load in census data
CensusDF <- get_acs(geography="county", year=2017, survey="acs5",
XXXXXXXXXXvariables= variables,
XXXXXXXXXXgeometry=F)
```
```{r, message=F, warning=F, echo=F}
CensusDF <- CensusDF %>%
select(-moe) %>% #Removes MOE variable
spread(variable, estimate) %>% #Converts data from long to wide
mutate( # Creates new variable
Home_Affordability = HousePrice/HHIncome, # Dependent Variable
below_poverty = below_poverty/ total_pop,
bach_degree = bach_degree / total_pop,
bachelors = bachelors / total_pop,
grad_degree = grad_degree / total_pop,
hs = hs / total_pop,
ma
ied = ma
ied / total_pop,
no_hs = no_hs / total_pop,
pop_black = pop_black / total_pop,
pop_hispanic = pop_hispanic / total_pop,
pop_white = pop_white / total_pop,
speak_english = speak_english / total_pop,
speak_spanish = speak_spanish / total_pop)
```
## Data Description {.smaller}
***EDIT ME***
!---
Describe your data: source of the data, time period of analysis, unit of analysis, dependent variable, main explanatory variable of interest.
--
## View Data {.smaller}
```{r, message=F, warning=F, echo=F}
head(CensusDF[,c("Home_Affordability","below_poverty")])
```
***EDIT ME***
!---
Describe what transformation you performed on your variables, and what the first few rows (observations) indicate for you your dependnet variable and main explanatory variable
--
# 3. Descriptive Results {.smaller}
```{r,message=F, warning=F, echo=F}
CensusDF<-as.data.frame(CensusDF)
ReportThese<-c("Home_Affordability","below_poverty",
"no_hs","hs","bach_degree","bachelors","grad_degree",
"pop_hispanic","pop_white","pop_black",
"speak_english","speak_spanish","ma
ied")
```
## 5-point summary {.smaller}
```{r, results='asis',message=F, warning=F, fig.width = 9,fig.align='center', echo=F }
#Visualize 5-point summary
stargazer(CensusDF[,ReportThese],
XXXXXXXXXXomit.summary.stat = c("p25", "p75"), nobs=F, type="html") # For a pdf document, replace html with latex
```
***EDIT ME***
!---
Interpret the 5-point summary for your dependant variable and main explanatory variable
--
## Histogram {.smaller}
```{r,message=F, warning=F, echo=F}
#Histogram
CensusDF %>%
keep(is.numeric) %>%
gather() %>%
ggplot(aes(value)) +
facet_wrap(~ key, scales = "free") +
geom_histogram()
```
***EDIT ME***
!---
Interpret the histogram for dependant variable and main explanatory variable and comment whether or not they follow normal distribution
--
## Histogram after Log-Transformation {.smaller}
```{r,message=F, warning=F, echo=F}
#Log transformation
CensusDF %>%
keep(is.numeric) %>%
gather() %>%
ggplot(aes(log(value+1))) +
facet_wrap(~ key, scales = "free") +
geom_histogram()
```
***EDIT ME***
!---
Interpret the histogram after log transformation for dependant variable and main explanatory variable and comment whether or not they follow normal distribution
--
## Co
elation Plot {.smaller}
```{r, message=F, warning=F, echo=F}
#Remove NAs
CensusDF<-na.omit(CensusDF)
##save co
elations in train_co
train_cor <- cor(CensusDF[,ReportThese ])
##Co
elation Plot
co
plot(train_cor, type='lower')
```
***EDIT ME***
!---
Interpret the Co
elation Plot and comment which variables, if any, appear to be highly multi-collinear.
--
# 4. Map Results {.smaller}
##
```{r, message=F, warning=F, quietly=T, results='hide', echo=F}
#Create your list of variables
variablesNew = c(
HousePrice = 'B25077_001', # Median Value of Housing Units
HHIncome = 'B19013_001' # Median household Income
)
#Load in census data
CensusSp <- get_acs(geography="county", year=2017, survey="acs5",
XXXXXXXXXXvariables= variablesNew,
XXXXXXXXXXgeometry=T, shift_geo = T)
#Data Wrangling
CensusSp <- CensusSp %>%
select(-moe) %>% #Removes MOE variable
spread(variable, estimate) %>% #Converts data from long to wide
mutate( # Creates new variable
Home_Affordability = HousePrice/HHIncome) # Dependent Variable
#Map
MapFig<-ggplot(CensusSp, aes(fill=Home_Affordability)) +
geom_sf(color="white") +
theme_void() + theme(panel.grid.major = element_line(colour = 'transparent')) +
scale_fill_distiller(palette="Reds", direction=1, name="House Price to Income Ratio") +
labs(title="Home_Affordability in US counties", caption="Source: US Census/ACS5 2017")
MapFig
```
***EDIT ME***
!---
Interpret map Results
--
# 5. Regression Model Results
## {.smaller}
```{r, results='asis',message=F, warning=F, echo=F, fig.align='center'}
eg1<-lm(log(Home_Affordability+1) ~ log(below_poverty+1)
, data=CensusDF)
eg2<-lm(log(Home_Affordability+1) ~ log(below_poverty+1) + log(no_hs+1) + log(hs+1) + log(bachelors+1)
, data=CensusDF)
eg3<-lm(log(Home_Affordability+1) ~ log(below_poverty+1) + log(no_hs+1) + log(hs+1) + log(bachelors+1) +
XXXXXXXXXXlog(ma
ied+1) + log(pop_black+1) + log(pop_hispanic XXXXXXXXXXlog(pop_white+1)
, data=CensusDF)
#present results with stargaze
li
ary(stargazer)
stargazer(reg1, reg2, reg3, title="Effect of Local Poverty on Housing Affordability",type='html',align=TRUE) # For a pdf document, replace html with latex
```
## Summary of Main Findings {.smaller}
***EDIT ME***
!---
Interpret model Results:
(1) Interpret size and magnitude of the coefficient on your main explanatory variable of interest.
(2) Interpret the meaning of the coefficient in Column 4 and explain what we expect to happen to depenent variable if we increase the value of the explanatory variable by 10%.
(3) Explain R^2 and F-statistics.
--
# Conclusion
## Summary of Findings and Policy Implications
***EDIT ME***
!---
Explain why your findings are important, and any policy implications.
-->
Answered Same Day Oct 08, 2021

Solution

Subhanbasha answered on Oct 08 2021
139 Votes
Final Project - Report





1. Introduction
Overview
1.Here my topic is hypothesis testing and regression analysis. i got interested in this topic because of we can know the which variables if affecting the dependent variable or also we can see is there any difference between variables or not.
2.The tasks are hypothesis testing and the regression analysis by applying the various types of transformations.
Hypothesis Development
The research hypothesis is that whether the models producing the same R square by building the model using the different variables, and also we can know which variable is significantly different in model.
2. Empirical Framework
Data Description
1.The data is census data from the various states of the country United states consisting the various features of the people in the various states. I got the data from the US Census survey the data from 2013 to 2017.
2.Here the dependent variable is Home_Affordability abd the main interest of explanatory variables are below_poverty, bachelors, hs, no_hs, pop_hispanic, pop_white, ma
ied and pop_black
View Data
## # A ti
le: 6 x 2
## Home_Affordability below_poverty
## ## 1 2.59 0.0472
## 2 3.46 0.0325
## 3 2.68 0.0835
## 4 2.43 0.0395
## 5 2.58 0.0563
## 6 2.25 0.0956
i have applied the log transformation to the variables and the first few rows of the dependent and the main explanatory variable showing that the data is converted into the specific range of the each variable because of applying the transformation.
3. Descriptive Results
5-point...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here