Thursday, December 14, 2017

Assignment 6

Introduction:

By the end of this assignment, students should be able to run regression in SPSS, interpret regression outputs and predict results given data, manipulate data in Excel and Join to ArcGIS, map Standardized Residuals in ArcGIS, and lastly connect statistics and spatial outputs. The overall theme of this assignment is Regression Analysis, and it is split into two separate parts each with their own separate Regression Analysis.  The first part is straight forward and the variables are given. Part two will include three separate Regression results with the number of calls as the dependent variable, and the independent variables are to be personally selected. A chloropleth map showing the number of calls at the Tract Level, and a Residual map of the highest r-squared of one of three independent variables must be created as well.

A Regression Analysis is tool used in statistics that helps discover the relationship between two variables by investigating causation.  All Regression Analysis must have a dependent variable which is found on the Y-axis, and an Independent Variable which is found on the X-axis. The equation for Regression Analysis is Y = a + bX, where "a" or the best fitting location for the point on the line when crossing the Y-axis. "b" is the slope of the line, otherwise known as the Regression Coefficient, and it tells how much the dependent variable changes in the independent variable. Regression Analysis can be perform using the IBM SPSS application using data sets created in Microsoft Excel. Scatterplots will be automatically created, showing the strength of the the two variables. The Strength depends on the relationship between the independent and dependent variable, if the point values are closer to the trendline, they will have a strong relationship. The strength is shown by the Coefficient of determination or R^2.

The OLS statistical function will be utilized in the second part of the assignment  OLS is short for Ordinary Least Squares, and what it does is put a line through the set of values on a graph by adding up the squared distances, according to the Y-axis, from the observed points in order to minimize the fitted line. It uses that same Y = a + bX equation. OLS will be used to create a Residual map. A residual is where the point falls in relation to the y-value on a scatter plot map. The residual is used to find the SEE or Standard Error of Estimate which adds up all the standard deviations of the residual after measuring the distance from each point to the trend line. Therefore, if the the SEE value is small, then predictions will be more accurate.

Methods:

Part 1:

This part will involve using a "Crime" test excel file, showing the crime rate per 100,000 people and the percent of kids that get free lunch for given neighborhoods, in order to show the local news if there is any correlation between crime rates and poverty for town X. Using the data in SPSS, run a regression equation to find out the truth. Answer the questions: what will the corresponding crime rate be for a new area of town in which 30 percent of kids receive a free lunch, and how confident in the data are you? Add the data and a response to the questions in the results.

Open the Crime excel spreadsheet in SPSS, and run a liner regression using Crime as the dependent variable and Free Lunches as the independent variable.

Results:
Figure 1. Coefficient Determination (R-Squared) of the Regression Analysis

Figure 2.  Regression Analysis Equation for the Model

As you can see in Figure 1, the Coefficient Determination isn't all that high meaning the correlation of the regression analysis is not the strongest. However, it is still a positive number meaning that the correlation between kids who receive free lunches and increasing crime rates do have some correlation. The equation for the Regression Analysis is y = 21.819 + 1.685x. The constant (a) in this analysis is 21.819 and the slope (b) or Regression Coefficient is 1.685. With a significance level of 0.005, the relationship is at the 95 percent significant level meaning it the null hypothesis is rejected.

Part 2:

The second part involves using a shapefile and a data set showing the amount of 911 calls in Portland, Oregon, and they are worried about the quality of responses to calls. A company who builds hospitals wants to know where exactly these calls are coming from in order to figure out the best location to make a new one is, and how big the ER department should be. Give them the results they are looking for by using data that gives the number of 911 calls, Jobs, Renters, Amount of people with no High School degree, alcohol sales, unemployment, Foreign born population, Medical income, and the number of college graduates.

The first step will be to run a single regression in SPSS using the excel sheet data in the Portland Shapefile. Use calls as the dependent variable, and for the independent variables choose any three in the sheet. This particular assignment uses Alcohol, Foreign Born, and College Graduates as the three independent variables.

The second step is to create a Chloropleth and Residual Map. Use the shape file 911 calls, and create a Chloropleth map. Then using the the dependent variable with the highest coefficient determination, create a residual map showing the Spatial Relationship ship between the two in Arcmap. Here is were the OLS tool will be utilized. Go to Spatial Statistics Tools in the Arctoolbox, then Modeling Spatial Relationships, and last choose the Ordinary Least Squares tool. Use the Portland Shapefile for input feature class, UniqID for unique field ID, 911 calls for the dependent variable, and choose the variable that had the highest Coefficient of Determination for the Explanatory/Dependent Variable.


Results:

Step 1:

College Graduates:

Figure 3. Coefficient Determination between College Graduates and 911 calls 

Figure 4. Linear equation and Significance of the model

As seen in Figures 3 and 4, the Coefficient Determination between College Graduates and 911 calls is a positive relationship, but it is less than one meaning it is a relatively weak correlation.With a significance level of .004, the relationship of the significance is at 95 percent, and the null hypothesis is rejected. When calls increase by 1, the number of college graduates increases by .029.

Linear equation: y = 13.377 + 0.029X.
The Constant: 12.377
The Slope/Regression Coefficient: 0.029

Alcohol:

Figure 5. Coefficient Determination between Alchol Sales and 911 calls

Figure 6. Linear Equation and Significance of the Model.
For this Regression Analysis, as you can see in Figure 5 and 6, the Coefficient Determination is 0.152, meaning it is a positive relationship and it is a little stronger than that of 911 calls and college graduates. With a significance level of 0.000, the null hypothesis will be rejected, and its safe to say that there is barely any correlation at all the amount of Alcohol sales and 911 calls. When the number of calls increase by one, the number of alcohol sales increase by 0.00003069.

Linear equation: Y = 9.59 + 3.069E-5X
The Constant (a): 9.59
The Slope/Regression Coeffiecient (b): 3.069E-5

Foreign Born Population:

Figure 7. Coefficient Determination between Foreign Born Citizens and 911 calls.
Figure 8. Linear Equation and Significance of the Model.
The third and final Regression Analysis is between Foreign Born Population and 911 calls. With a coefficient determination of 0.552, it is clear that this relationship is the strongest. However, the significance level is 0.000, so again, the null hypothesis is rejected. For every one 911, there is an increase in Foreign Born population by 0.08.

Linear equation: Y = 3.043 + 0.08X
The Constant (a): 3.043
The Slope/Regression Coefficient (b): 0.080

Again, out of the three regression analysis, Foreign Born Population the highest coefficient determination with 0.552. All three analysis were similar in that each significance level was less than 0.05 meaning the null hypothesis was rejected in all three scenarios.

Step 2:

Chloropleth Map:


Figure 9. Chloropleth Map showing the number of calls for each Census Tract.
As you can see in Figure 9, the majority of 911 calls are most common in the inner city, but specifically the North central Census tracts. In turn, the least amount of calls are coming from the outside, but mainly to the very west of Portland. It can be assumed that the outside of the city is a lot safer and less prone to emergencies than the inner city. However, total population is likely higher in the inner city than the outer, so that is also something to keep in mind.

Residual Map:



Figure 10. Residual Map showing the correlation between Foreign Born Citizens and 911 calls.
As you can see in Figure 10, the Residual Map shows the Standard Deviation between the Foreign Born Population and 911 Calls in Portland. It shows a similar trend or correlation with the map displayed in Figure 9. The darker the red, the higher the two variables are higher correlated than expected compared to the trend line. Whereas, the darker the blue, the lower the two variables are correlated in comparison to the trend line. This can also be due to the larger number of Foreign born Citizens occupying living spaces in the inner city. Many of them have probably come to work at stores downtown.

Conclusions:

In conclusion, IBM SPSS is a great way to perform a Regression Analysis getting you instantaneous and spot on results. The OLS statistical function is a great way to display the Coefficient Determination between two variables on the map. For the first part of the assignment, the relationship between Free lunches, and increasing crime rate are related. For the second part of the assignment, out of the three dependent variables chosen in this students assignment, Foreign Born Population had the strongest linear relationship with the number of 911 emergency calls. Alcohol sales was easily the weakest linear relationship, due to its low values across the board.

Sources:

All data and the shapefile were obtained from the class folder:
Q:\StudentCoursework\RWeichelt\Geog.370.2181\Share\Assignment6

Monday, December 4, 2017

Assignment 5

Goals and Background:

This assignment will give students experience with creating a scatter plot in Excel, running correlations in SPSS, interpreting correlation from a scatter plot and SPSS output, utilizing the U.S. Census site to download data and shape files, identifying GEOIDs from the census data, joining U.S census data and other data, as well as creating a report connecting all the data. This assignment is divided into two parts: the first deals with statistical correlation, and the second part deals with spatial auto correlation.

Methods:

Part I: Correlation

Again, the first part deals with statistical correlation, which is a measurement between two variables in order to determine how related they are to each other. By using correlation one can find the strength as well as the direction of a relationship. Strength shows how strong a relationship between variables can be based off a negative one to positive one range. Direction on the other hand tells whether the relation ship is positive, negative, or null. If a relationship is null, the value is zero, meaning there is no difference. A positive relationship means the value is greater than zero with a maximum of 1. If it is one then there is a one-hundred percent correlation, which is extremely rare. On the opposite side of the spectrum, a negative relationship means the value is lesser than zero, but no lower than negative one. However, negative one still means there is a very high correlation between two variables. The closer each value is to zero, the less related it is.

The first portion requires a scatter plot to be made in Microsoft Excel between Distance from the sound source and the sound level. By using the given data and Figure 1, you can create a chart similar to the one in Figure 2. Make sure to insert a Trendline to see how far the Sound Level strays away.

Figure 1. Excel data.
Figure 2. Correlation chart between distance and sound level.

Once a chart has been created, open SPSS to obtain correlation statistics on the scatterplot. Go to the Analyze pull down tab, then correlation, and bivariate. Run it with Pearson Correlation and as a 2-tailed test, and you will get a correlation like the one in Figure 3 shown in the results section.

The second part section of part one deals with Census Tracts and the Population in Detroit, Michigan. Using the Excel file for Detroit, MI,  repeat the same steps as before to get the results shown in Figure 4 also in the results section. The variables tested are given in the directions and shown on the chart.

Part II: Spatial Autocorrelation

The second part of the assignment will involve using specific data from the Texas Election Commission (TEC) for 1980 and 2012 presidential elections including democratic votes and voter turnout. Data on Hispanic populations for 2010 must be downloaded from the U.S. Census during the process. The TEC needs to analyze the patterns of the elections to decipher if voting patterns and voter turnout are clustered in the state in order to see if there are any changes in the past 32 years. Use the GeoDa and SPSS to make conclusions based on spatial autocorrelation. Follow the directions given by Dr. Weichelt to download the necessary data.

Once the Hispanic Texas County Data and Texas shapefile are downloaded, open Arcmap and join the the attribute tables using Geo_ID. Make sure you delete row A2 for Hispanic Texas County data. Also join the Texas voting data to the shapefile as well. Once the data is joined, export the data as a shapefile, and open GeoDa. Then go to File, New Project Form, and find the exported shapefile. You will now create Moran's I graphs and corresponding maps, and then analyze them for clusters. Use the Weights Manager tool to create a spatial weight in order to see if there is spatial autocorrelation for both elections.

Results/Discussion:

Part I: 

Figure 3. Correlation Statistics on Distance and Sound Level.
Notice the two stars meaning there is a 99 percent significance level.

By looking at the chart and reading the correlation stats, it is clear there is a strong negative correlation. The null hypothesis is rejected since their is a 99 percent significance level.

Figure 4. Correlation Statistics for Detroit Populations
After analyzing the correlation numbers, one will find that highest correlations are Median Household income and Medium home value at 0.883. There is two asterisks next to the value meaning there is a 99% significance level, and that the null hypothesis is rejected. The number is close to one and positive, which means there is strong  positive correlation between the two.

The second highest is between Retial and Medium Household income has a correlation coefficient of 0.881 as well as two asterisks inferring a 99 percent significance level. There is also a strong positive correlation for these two variables as well.

On the opposite side of the spectrum, the lowest correlations is between Retial and Hispanic at -.004. Inferring a weak negative correlation.

Part II:

1980 Democratic Vote (Figure 5 and 6):


Figure 5. Moran's 1 graph of the Percent Democratic Vote in 1980
Figure 6. Cluster Map of the Percent Democratic Vote in 1980

2012 Democratic Vote (Figures 7 and 8):


Figure 7: Moran's 1 graph of the Percent Democratic Vote in 2012


Figure 8: Cluster Map of the Percent Democratic Vote in 2012




1980 Voter Turnout (Figures 9 and 10):

Figure 9. Moran's 1 graph of the Percent of Voter Turnout in 1980.

Figure 10. Cluster Map of the Percent of Voter Turnout in 1980.

2012 Voter Turnout (Figures 11 and 12): 

Figure 11. Moran's 1 graph of the Percent of Voter Turnout in 2012

Figure 12. Cluster Map of the Percent of Voter Turnout in 2012

2010 Hispanic Population (Figures 13 and 14):

As you can see the Distribution is 
Figure 13. Moran's 1 graph of the Percent of Hispanic Population in 2010


Figure 14. Cluster Map of Percent of Hispanic Population in 2010.



Conclusion:

In conclusion, SPSS and GeoDa as expected proved to be very effective for analyzing correlation.

Sources: