knitr::opts_chunk$set(echo = FALSE)
getwd()
## [1] "/Users/mirajulfahim/Downloads/ecob2000_lecture1/Econometrics Project"
setwd("/Users/mirajulfahim/Downloads/ecob2000_lecture1/Econometrics Project")

library(foreign)
x<-read.csv("/Users/mirajulfahim/Downloads/ecob2000_lecture1/Econometrics Project/hmda_2017_ny_all-records_labels.csv")
library(stargazer)
## 
## Please cite as:
##  Hlavac, Marek (2018). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.2. https://CRAN.R-project.org/package=stargazer
use_varb <- (dfna$minority_population >= 51) 
use_varb2<-(dfna$minority_population <= 51)
majorityneighborhoods <- subset(dfna,use_varb)
minorityneighborhoods<-subset(dfna,use_varb2)

x<-lm(Loan_Approved~minority_population,data=minorityneighborhoods)
x2<-lm(Loan_Approved~minority_population,data=majorityneighborhoods)
stargazer(x)
## 
## % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
## % Date and time: Sat, Dec 19, 2020 - 06:21:59
## \begin{table}[!htbp] \centering 
##   \caption{} 
##   \label{} 
## \begin{tabular}{@{\extracolsep{5pt}}lc} 
## \\[-1.8ex]\hline 
## \hline \\[-1.8ex] 
##  & \multicolumn{1}{c}{\textit{Dependent variable:}} \\ 
## \cline{2-2} 
## \\[-1.8ex] & Loan\_Approved \\ 
## \hline \\[-1.8ex] 
##  minority\_population & $-$0.002$^{***}$ \\ 
##   & (0.0001) \\ 
##   & \\ 
##  Constant & 0.629$^{***}$ \\ 
##   & (0.002) \\ 
##   & \\ 
## \hline \\[-1.8ex] 
## Observations & 286,935 \\ 
## R$^{2}$ & 0.003 \\ 
## Adjusted R$^{2}$ & 0.003 \\ 
## Residual Std. Error & 0.491 (df = 286933) \\ 
## F Statistic & 903.489$^{***}$ (df = 1; 286933) \\ 
## \hline 
## \hline \\[-1.8ex] 
## \textit{Note:}  & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ 
## \end{tabular} 
## \end{table}
stargazer(x2)
## 
## % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
## % Date and time: Sat, Dec 19, 2020 - 06:21:59
## \begin{table}[!htbp] \centering 
##   \caption{} 
##   \label{} 
## \begin{tabular}{@{\extracolsep{5pt}}lc} 
## \\[-1.8ex]\hline 
## \hline \\[-1.8ex] 
##  & \multicolumn{1}{c}{\textit{Dependent variable:}} \\ 
## \cline{2-2} 
## \\[-1.8ex] & Loan\_Approved \\ 
## \hline \\[-1.8ex] 
##  minority\_population & $-$0.003$^{***}$ \\ 
##   & (0.0001) \\ 
##   & \\ 
##  Constant & 0.723$^{***}$ \\ 
##   & (0.010) \\ 
##   & \\ 
## \hline \\[-1.8ex] 
## Observations & 74,750 \\ 
## R$^{2}$ & 0.010 \\ 
## Adjusted R$^{2}$ & 0.010 \\ 
## Residual Std. Error & 0.496 (df = 74748) \\ 
## F Statistic & 762.976$^{***}$ (df = 1; 74748) \\ 
## \hline 
## \hline \\[-1.8ex] 
## \textit{Note:}  & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ 
## \end{tabular} 
## \end{table}
plot(x)

plot(x2)