Introducton

These following visualizations were included in a research paper for CSU Long Beach Applied Statistics graduate program - STAT 530, Experimental Design and Analysis. Luis Cervantes and I used a three factor unbalanced design to analyze the significance of population density, median income, location of county within California, and their interactions in determining residential burglary rates. The maps help show how we classified our factors, and provide some initial summary of our data. The rest of our numerical analysis was done in SAS.

Please refer to our completed research paper for more details.

#Burg Rate
ggplot(map_stuff, aes(x=long,y=lat,group=group))+
  geom_polygon(aes(fill=BurgRateTrans))+
  geom_path()+ 
  scale_fill_gradientn(colours = rev(heat.colors(10)))+
  coord_map()+ 
  labs(title='Prominence of Residential Burglary \n(transformed response)')+
  theme(plot.title = element_text(hjust = 0.5))

#Location
ggplot(map_stuff, aes(x=long,y=lat,group=group))+
  geom_polygon(aes(fill=Location))+
  geom_path()+ 
  scale_fill_discrete()+
  coord_map()+ 
  labs(title='Location Classification')+
  theme(plot.title = element_text(hjust = 0.5))

#Med Income
ggplot(map_stuff, aes(x=long,y=lat,group=group))+
  geom_polygon(aes(fill=MedIncome))+
  geom_path()+ 
  scale_fill_discrete()+
  coord_map()+ 
  labs(title='Median Income Classification')+
  theme(plot.title = element_text(hjust = 0.5))

#PopDensity
ggplot(map_stuff, aes(x=long,y=lat,group=group))+
  geom_polygon(aes(fill=PopDensity))+
  geom_path()+ 
  scale_fill_discrete()+
  coord_map()+ 
  labs(title='Population Density Classification')+
  theme(plot.title = element_text(hjust = 0.5))

#burgrate & county with popdensity
ggplot() + 
  geom_point(aes(x=County,y=BurgRate, colour=PopDensityNum, size=PopDensityNum),data=crimedata) +
  theme(axis.text.x = element_text(angle = 90, hjust = 1)) + 
  labs(title="Residential Burglary Rate by County & Population Density",
       y="Burglary Rate")+
  guides(colour=guide_legend(title="Population\nDensity"),size=guide_legend(title="Population\nDensity"))+
    theme(plot.title = element_text(hjust = 0.5))+
  scale_size_continuous(
    limits=c(min(crimedata$PopDensityNum),20000),
    breaks=seq(0,20000,by=5000))+
  scale_colour_continuous(
    limits=c(min(crimedata$PopDensityNum),20000),
    breaks=seq(0,20000,by=5000))