THIS README IS FOR THE DATA/MODELS/GLMS DIRECTORY.

THIS DIRECTORY CONTAINS ONE R SCRIPT AND THREE SUB-DIRECTORIES, WHERE THE CODE IMPLEMENTS IN THE POISSON AND NEGATIVE BINOMIAL MODELS FOR THE CENSUS TRACT LEVEL CRIME DATA FOR EACH CITY AND STORES THE OUTPUTS IN THE CORRESPONDING CITY'S SUB-DIRECTORY.

THE MANIPULATED DATA FILES (CREATED WITHIN THIS DIRECTORY) ARE CONTAINED WITHIN THIS ARCHIVED FOLDER.

- InitialModels_final.R: this R script contains the code to fit Poisson and Negative Binomial models to the crime data for Los Angeles, New York and Portland, although we only implement the models for the motor vehicle thefts count data in Portland as there was only one incidence of homicide in Portland in 2015. We also calculate the Ripley's K (homogeneous and inhomogeneous) for the crime point patterns, where the result is plotted to visually compare the empirical function values against the theoretical form of the function, pi*r^2, to check for evidence of clustering or dispersion present in the spatial structure of the point pattern.
	-- Outputs: in this directory we have
		--- InitialModelsMCDF_area3Cities.rds: this is the data set produced which contains the summary results for all three cities and both crimes in order to produce a joint plot of the results.
		--- InitialModelsMCPlot_area3Cities.pdf: this contains the plot of the above generated data frame, with the posterior means and credible intervals for each parameter for all crimes, all cities and all GLMs.

	-- Outputs (for each city, individually): in each of the separate city's sub-directories the models are output as:
		--- RipleysK_*homz_proj_XY.pdf: the Ripley's K results plotted for the homicide point pattern for city * where the census tract socio-economic variables were given at the X x Y resolution - not interpolated but each grid cell centre from the X x Y grid was assigned the value of the variable from the census tract it lies within, to ensure that the relevant functions can assign the relevant socio-economic values at the census tract level to the incidents of crime.
		--- RipleysK_*gtaz_proj_XY.pdf: the Ripley's K results plotted for the motor vehicle thefts point pattern for city * where the census tract socio-economic variables were given at the X x Y resolution - not interpolated but each grid cell centre from the X x Y grid was assigned the value of the variable from the census tract it lies within, to ensure that the relevant functions can assign the relevant socio-economic values at the census tract level to the incidents of crime.
		--- *HommcGLMS_area.rda: the Poisson (fit.zcov) and Negative Binomial (fit.nbzcov) model results for the homicide count data for city *.
		--- *GTAmcGLMS_area.rda: the Poisson (fit.zcov) and Negative Binomial (fit.nbzcov) model results for the motor vehicle theft count data for city *.
The resulting plots take the form:
		--- ct*hom_zcov_+_proj3_area.pdf: homicide Poisson model results for city * and plot + (e.g. trace plot etc.).
		--- ct*hom_nbzcov_+_proj3_area.pdf: homicide Negative Binomial model results for city * and plot + (e.g. trace plot etc.).
		--- ct*gta_zcov_+_proj3_area.pdf: motor vehicle theft  Poisson model results for city * and plot + (e.g. trace plot etc.)
		--- ct*gta_nbzcov_+_proj3_area.pdf: motor vehicle theft Negative Binomial model results for city * and plot + (e.g. trace plot etc.).
		--- *HomPoissonCTError2_area.pdf: this is the plot of the residuals from the homicide Poisson model for city * over the census tracts.
		--- *HomNBCTError2_area.pdf: this is the plot of the residuals from the homicide Negative Binomial model for city * over the census tracts.
		--- *GTAPoissonCTError2_area.pdf: this is the plot of the residuals from the motor vehicle thefts Poisson model for city * over the census tracts.
		--- *GTANBCTError2_area.pdf:  this is the plot of the residuals from the motor vehicle thefts Negative Binomial model for city * over the census tracts.