Skip to content

Commit

Permalink
Added a bunch of stuff. Close to final version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Berry authored and Daniel Berry committed Nov 22, 2016
1 parent 0bbf362 commit a06e4d8
Show file tree
Hide file tree
Showing 7 changed files with 639 additions and 174 deletions.
9 changes: 8 additions & 1 deletion auto/paper.el
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
"report"
"rep10"
"geometry"
"amsmath")
"amsmath"
"graphicx")
(LaTeX-add-labels
"fig:desert"
"fig:black"
"fig:white"
"fig:income"
"fig:vacant"
"cpresult"
"npresult"
"ppresult"
"mlm"
"AICs"
"MSEs"))
:latex)
Expand Down
200 changes: 179 additions & 21 deletions model.r
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ model3 <- glmer(desert ~ CTA_counts +
model4 <- glmer(desert ~ CTA_counts +
vacant_counts +
crime +
Cancer..All.Sites. +
TOTAL.POPULATION +
NHAS +
Dependency +
Expand All @@ -316,6 +317,108 @@ model4 <- glmer(desert ~ CTA_counts +
verbose = TRUE,
control = glmerControl(calc.derivs = FALSE, optCtrl=list(maxfun=5000)))

model5 <- glmer(desert ~ . -
Neighborhood -
TRACT_BLOC -
STATEFP10 -
COUNTYFP10 -
TRACTCE10 -
BLOCKCE10 -
GEOID10 -
NAME10 -
Latitude -
Longitude -
Birth.Rate -
Community.Area.Number -
Childhood.Blood.Lead.Level.Screening -
Childhood.Lead.Poisoning -
Community.Area.x -
Community.Area.y -
Gonorrhea.in.Females -
Gonorrhea.in.Males -
Prostate.Cancer.in.Males -
Breast.cancer.in.females -
Colorectal.Cancer -
TOTAL -
Multiple.Race.. -
PERCENT.HOUSEHOLDS.BELOW.POVERTY -
PERCENT.OF.HOUSING.CROWDED -
PERCENT.AGED.16..UNEMPLOYED -
PERCENT.AGED.25..WITHOUT.HIGH.SCHOOL.DIPLOMA -
PER.CAPITA.INCOME -
PERCENT.AGED.UNDER.18.OR.OVER.64 -
HARDSHIP.INDEX -
nearest_supermarket -
Below.Poverty.Level -
Prenatal.Care.Beginning.in.First.Trimester -
Preterm.Births -
Low.Birth.Weight -
Crowded.Housing -
General.Fertility.Rate -
Infant.Mortality.Rate -
NHW -
NHW_p -
NHOTHER -
NHOTHER_p -
Multiple.Race.._p +
(1|Neighborhood),
data = model_data_scale,
family = 'binomial',
verbose = 2,
control = glmerControl(calc.derivs = FALSE, optCtrl = list(maxfun = 5000)))

summary(model6 <- glmer(desert ~ CTA_counts + crime + vacant_counts +
Cancer..All.Sites. +
Diabetes.related +
Dependency +
TOTAL.POPULATION +
(1 | Neighborhood),
data = model_data_scale,
family = 'binomial',
verbose = 2,
control = glmerControl(calc.derivs = FALSE, optCtrl = list(maxfun = 1000))))

## Gonorrhea in females
## Cancer all sites
## Total population
## NHAS
## Dependency
## Childhood lead poisoning
## Prenatal care beginning in first trimester
## Gonorrhea in males
## NHAM_p
## Multiple.Race..
## Stroke..Cerebrovascular.Disease
## Firearm.related
## Tuberculosis
## NHW_p
## Teen birth rate
## No.high.school.diploma
## Lung.cancer

summary(model7 <- glmer(desert ~ CTA_counts + crime + vacant_counts +
Cancer..All.Sites. +
TOTAL.POPULATION +
Prenatal.Care.Beginning.in.First.Trimester +
NHAM_p +
Multiple.Race.. +
Stroke..Cerebrovascular.Disease. +
Tuberculosis +
NHW_p +
Teen.Birth.Rate +
No.High.School.Diploma +
Lung.Cancer +
(1 | Neighborhood),
data = model_data_scale,
family = 'binomial',
verbose = 2,
control = glmerControl(calc.derivs = FALSE, optCtrl = list(maxfun = 2000))
))

summary(pp <- glmer(desert ~ CTA_counts + vacant_counts + crime + (1 | Neighborhood), data = model_data_scale, family = 'binomial', verbose = 2))

summary(cp <- glm(desert ~ CTA_counts + vacant_counts + crime, data = model_data_scale, family = 'binomial'))

t_data <- complete_datas2[[1]]

model4 <- glmer(desert ~ CTA_counts +
Expand All @@ -325,7 +428,7 @@ model4 <- glmer(desert ~ CTA_counts +
Dependency +
Childhood.Lead.Poisoning +
Prenatal.Care.Beginning.in.First.Trimester +
NHAM_p +.[.---------------[-]]
NHAM_p +
Multiple.Race.. +
Stroke..Cerebrovascular.Disease. +
Tuberculosis +
Expand Down Expand Up @@ -357,26 +460,37 @@ for (i in 1:10) {
pp <- glmer(desert ~ CTA_counts + vacant_counts + crime + (1 | Neighborhood), data = train, family = 'binomial')
print(paste('AIC pp:', AIC(pp)))

mlm <- glmer(desert ~ CTA_counts +
vacant_counts +
crime +
TOTAL.POPULATION +
NHAS +
Dependency +
Childhood.Lead.Poisoning +
Prenatal.Care.Beginning.in.First.Trimester +
NHAM_p +
Multiple.Race.. +
Stroke..Cerebrovascular.Disease. +
Tuberculosis +
Teen.Birth.Rate +
No.High.School.Diploma +
Lung.Cancer +
Colorectal.Cancer +
(1|Neighborhood),
data = train,
family = 'binomial',
control = glmerControl(calc.derivs = FALSE, optCtrl=list(maxfun=1000)))
## mlm <- glmer(desert ~ CTA_counts +
## vacant_counts +
## crime +
## TOTAL.POPULATION +
## NHAS +
## Dependency +
## Childhood.Lead.Poisoning +
## Prenatal.Care.Beginning.in.First.Trimester +
## NHAM_p +
## Multiple.Race.. +
## Stroke..Cerebrovascular.Disease. +
## Tuberculosis +
## Teen.Birth.Rate +
## No.High.School.Diploma +
## Lung.Cancer +
## Colorectal.Cancer +
## (1|Neighborhood),
## data = train,
## family = 'binomial',
## control = glmerControl(calc.derivs = FALSE, optCtrl=list(maxfun=1000)))

mlm <- glmer(desert ~ CTA_counts + crime + vacant_counts +
Cancer..All.Sites. +
Diabetes.related +
Dependency +
TOTAL.POPULATION +
(1 | Neighborhood),
data = train,
family = 'binomial',
control = glmerControl(calc.derivs = FALSE, optCtrl = list(maxfun = 1000)))


print(paste('AIC mlm:', AIC(mlm)))

Expand Down Expand Up @@ -464,3 +578,47 @@ print(paste('Final model:', in_vars, collapse = ', '))
## else {
## break
## }


cp <- glm(desert ~ CTA_counts + vacant_counts + crime, family = 'binomial', data = model_data_scale)
print(paste('AIC cp:', AIC(cp)))

np <- glm(desert ~ CTA_counts + vacant_counts + crime + Neighborhood, family = 'binomial', data = model_data_scale)
print(paste('AIC np:', AIC(np)))

pp <- glmer(desert ~ CTA_counts + vacant_counts + crime + (1 | Neighborhood), data = model_data_scale, family = 'binomial')
print(paste('AIC pp:', AIC(pp)))

## mlm <- glmer(desert ~ CTA_counts +
## vacant_counts +
## crime +
## TOTAL.POPULATION +
## NHAS +
## Dependency +
## Childhood.Lead.Poisoning +
## Prenatal.Care.Beginning.in.First.Trimester +
## NHAM_p +
## Multiple.Race.. +
## Stroke..Cerebrovascular.Disease. +
## Tuberculosis +
## Teen.Birth.Rate +
## No.High.School.Diploma +
## Lung.Cancer +
## Colorectal.Cancer +
## (1|Neighborhood),
## data = model_data_scale,
## family = 'binomial',
## control = glmerControl(calc.derivs = FALSE, optCtrl=list(maxfun=1000)))

mlm <- glmer(desert ~ CTA_counts + crime + vacant_counts +
Cancer..All.Sites. +
Diabetes.related +
Dependency +
TOTAL.POPULATION +
(1 | Neighborhood),
data = model_data_scale,
family = 'binomial',
control = glmerControl(calc.derivs = FALSE, optCtrl = list(maxfun = 1000)))


print(paste('AIC mlm:', AIC(mlm)))
41 changes: 27 additions & 14 deletions paper.aux
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
\relax
\@writefile{toc}{\contentsline {paragraph}{ Crimes 2001 - present}{1}}
\@writefile{toc}{\contentsline {paragraph}{ 311 Service Requests: Vacant Buildings}{1}}
\@writefile{toc}{\contentsline {paragraph}{ CTA Ridership: Avg. Weekly Boardings during October 2010}{1}}
\@writefile{toc}{\contentsline {paragraph}{ Census Block Population }{1}}
\@writefile{toc}{\contentsline {paragraph}{ Public Health Statistics: selected public health indicators by Chicago community area}{1}}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Food Desert Locations in Chicago}}{2}}
\newlabel{fig:desert}{{1}{2}}
\@writefile{toc}{\contentsline {paragraph}{ CTA Ridership: Avg. Weekly Boardings during October 2010}{2}}
\@writefile{toc}{\contentsline {paragraph}{ Census Block Population }{2}}
\@writefile{toc}{\contentsline {paragraph}{ Public Health Statistics: selected public health indicators by Chicago community area}{2}}
\@writefile{toc}{\contentsline {paragraph}{ Census Data: Selected socioeconomic indicators }{2}}
\@writefile{toc}{\contentsline {paragraph}{ Race by Community Area }{2}}
\@writefile{lot}{\contentsline {table}{\numberline {1}{\ignorespaces Complete pooling model summary}}{4}}
\newlabel{cpresult}{{1}{4}}
\@writefile{lot}{\contentsline {table}{\numberline {2}{\ignorespaces No pooling model summary}}{5}}
\newlabel{npresult}{{2}{5}}
\@writefile{lot}{\contentsline {table}{\numberline {3}{\ignorespaces Partial pooling model summary}}{6}}
\newlabel{ppresult}{{3}{6}}
\@writefile{lot}{\contentsline {table}{\numberline {4}{\ignorespaces Model AICs}}{6}}
\newlabel{AICs}{{4}{6}}
\@writefile{lot}{\contentsline {table}{\numberline {5}{\ignorespaces Model Cross Validated MSEs}}{6}}
\newlabel{MSEs}{{5}{6}}
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Neighborhoods by Black Percentage}}{3}}
\newlabel{fig:black}{{2}{3}}
\@writefile{toc}{\contentsline {paragraph}{ Race by Community Area }{3}}
\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces Neighborhoods by White Percentage}}{4}}
\newlabel{fig:white}{{3}{4}}
\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces Neighborhoods by Per Capita Income}}{5}}
\newlabel{fig:income}{{4}{5}}
\@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces Neighborhoods by Number Vacant Buildings with 1 Mile Radius}}{6}}
\newlabel{fig:vacant}{{5}{6}}
\@writefile{lot}{\contentsline {table}{\numberline {1}{\ignorespaces Complete pooling model summary}}{7}}
\newlabel{cpresult}{{1}{7}}
\@writefile{lot}{\contentsline {table}{\numberline {2}{\ignorespaces No pooling model summary}}{7}}
\newlabel{npresult}{{2}{7}}
\@writefile{lot}{\contentsline {table}{\numberline {3}{\ignorespaces Partial pooling model summary}}{8}}
\newlabel{ppresult}{{3}{8}}
\@writefile{lot}{\contentsline {table}{\numberline {4}{\ignorespaces Hierarchical Model Summary}}{8}}
\newlabel{mlm}{{4}{8}}
\@writefile{lot}{\contentsline {table}{\numberline {5}{\ignorespaces Model AICs}}{9}}
\newlabel{AICs}{{5}{9}}
\@writefile{lot}{\contentsline {table}{\numberline {6}{\ignorespaces Model Cross Validated MSEs}}{9}}
\newlabel{MSEs}{{6}{9}}
Loading

0 comments on commit a06e4d8

Please sign in to comment.