Lab 5: Means, Correlations and Autocorrelation.
Contents
Lab 5: Means, Correlations and Autocorrelation.#
Caution
This lab will provide an opportunity to practice inferential statistics and global spatial autocorrelation in Python. Please start by opening this Google Colab notebook and copying it to your Google Drive.
Important
Please submit your lab by modifying the template notebook!
Warning
Make sure to submit the lab by October 31 / November 1, 2022, depending on the scheduled time of your section.
Lab 5 Instructions.#
Pre-load Guerry data.
Choose one of the numeric variables in Guerry geodataframe. See full list of variables here. You CANNOT use any of the variables from demonstration in the lab or in class.
Check normality assumption using a histogram, QQPlot and Shapiro-Wilk test.
Run a one sample test to check whether the sample mean is equal to the mean(varible_of_your_interest). Write down your hypotheses in markdown. Interpret your results.
Group French departments into East and West based on mean longitude (see example code in the lab).
Run a two sample test to compare the mean between the East and the West. Write down your hypotheses in markdown. Interpret your results.
Run ANOVA to compare the mean of your variable of interest. Write down your hypotheses in markdown. Interpret your results.
Generate pairwise correlation between your variable of interest and other numeric variables in the data frame.
Use Rooks contingency rule to generate spatial weights matrix for Guerry data. Standardize weights by rows.
Calculate Moran’s $I$ for the variable of your choice.
Calculate simulated $p$-value. Interpret your results.
Create Moran’s scatter plot for the variable of your choice. Interpet your plot.
Submit your report to GauchoSpace. Please submit both the .ipynb and .pdf of the notebook.
Lab 5 (Bonus Points - 25 points)#
Repeat your spatial autocorrelation analysis in GeoDa.
You will be following the instructions from GeoDa documentation on Global Spatial Autocorrelation.
Download GeoDa onto your computer from here
Grab Guerry data from GeoDa Data and Lab page
Start GeoDa and open the downloaded files
Generate spatial weights for Guerry data. Tools > Weights Manager. Select ‘CODE_DE’ as an ‘ID variable’ and keep ‘Queen contiguity’ option. Click ‘Create’. When prompted, save the weights on the computer in the directory of your choosing.
Create a Moran scatter plot. Use ‘Moran scatter plot’ icon on a toolbar and select Univariate Moran’s I from the menu. Use the variable of your choice from the main part of the lab.
Generate a histogram of simulated randomized statistic. Right click on the Moran’s scatterplot > Randomization > 999 Permutations. Report the pseudo p-value.
Take a screenshot (see image below) and upload it to the Google Colab Markdown.