submit the ioslides_presentation file of your final presentation.
--- 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*** ## Hypothesis Development {.smaller} ***EDIT ME*** # 2. Empirical Framework ```{r, message=F, warning=F, echo=F} #Load in libraries library(tidycensus) library(tidyverse) library(plyr) library(stargazer) library(corrplot) library(purrr) ``` ```{r echo=F, message=F, quietly=T} library(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' ,="" married='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" ,="" variables="variables," geometry="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, married = married / 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*** ## View Data {.smaller} ```{r, message=F, warning=F, echo=F} head(CensusDF[,c("Home_Affordability","below_poverty")]) ``` ***EDIT ME*** # 3. Descriptive Results {.smaller} ```{r,message=F, warning=F, echo=F} CensusDF<-as.data.frame(censusdf)>-as.data.frame(censusdf)><-c("home_affordability","below_poverty", "no_hs","hs","bach_degree","bachelors","grad_degree",="" "pop_hispanic","pop_white","pop_black",="" "speak_english","speak_spanish","married")="" ```="" ##="" 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],="" omit.summary.stat="c("p25"," "p75"),="" nobs="F," type="html" )="" #="" for="" a="" pdf="" document,="" replace="" html="" with="" latex="" ```="" ***edit="" me***="" ##="" 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*** ## 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*** ## Correlation Plot {.smaller} ```{r, message=F, warning=F, echo=F} #Remove NAs CensusDF<-na.omit(censusdf) ##save="" correlations="" in="" train_cor="" train_cor="">-na.omit(censusdf)><- cor(censusdf[,reportthese="" ])="" ##correlation="" plot="" corrplot(train_cor,="" type='lower' )="" ```="" ***edit="" me***="" #="" 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" ,="" variables="variablesNew," geometry="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***="" #="" 5.="" regression="" model="" results="" ##="" {.smaller}="" ```{r,="" results='asis' ,message="F," warning="F," echo="F," fig.align='center' }="">-ggplot(censussp,><-lm(log(home_affordability+1) ~="" log(below_poverty+1)="" ,="" data="CensusDF)">-lm(log(home_affordability+1)><-lm(log(home_affordability+1) ~="" log(below_poverty+1)="" +="" log(no_hs+1)="" +="" log(hs+1)="" +="" log(bachelors+1)="" ,="" data="CensusDF)">-lm(log(home_affordability+1)><-lm(log(home_affordability+1) ~ log(below_poverty+1) + log(no_hs+1) + log(hs+1) + log(bachelors+1) + log(married+1) + log(pop_black+1) + log(pop_hispanic+1) + log(pop_white+1) , data=censusdf) #present results with stargazer library(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*** # conclusion ## summary of findings and policy implications ***edit me*** ~="" log(below_poverty+1)="" +="" log(no_hs+1)="" +="" log(hs+1)="" +="" log(bachelors+1)="" +="" log(married+1)="" +="" log(pop_black+1)="" +="" log(pop_hispanic+1)="" +="" log(pop_white+1)="" ,="" data="CensusDF)" #present="" results="" with="" stargazer="" library(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***="" #="" conclusion="" ##="" summary="" of="" findings="" and="" policy="" implications="" ***edit="">-lm(log(home_affordability+1) ~ log(below_poverty+1) + log(no_hs+1) + log(hs+1) + log(bachelors+1) + log(married+1) + log(pop_black+1) + log(pop_hispanic+1) + log(pop_white+1) , data=censusdf) #present results with stargazer library(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*** # conclusion ## summary of findings and policy implications ***edit me***>->-c("home_affordability","below_poverty",>->