MSc in Geocomputation (MH50B)

NCG602A: Methods and Techniques in Geocomputation

Regression Exercise

Introduction

We’ve reached a stage in NCG602A where we can start to put some of our knowledge and R skills together in some practical form. You will need to do some searching on the Web for more detailed information about some of the R functions you will use. There will be some in class preliminary discussion of the exercise.

General approach

The object of the exercise will be to create a model which predicts the variation in educational attainment among the counties of Georgia. This will require some initial exploration of the data: useful techniques will include numerical summaries as well as visual tools (which may even include maps). Consider the spatial structure of the data too. You might find it helpful to explore the correlation structure of the data to decide which variables to put in your model. You’ll need to examine the spatial structure of the residuals from the model, and comment on any patterns you observe.

Notes and suggestions

1. The data for Georgia are in the GWmodel. Use the data() function to load them and library() to load GWmodel. ls() will tell you what the data frames are called. names() will list the column headings.

2. Remember to merge the data frames before you can plot them – remember about the order of the data frames… match() will be useful.

3. hist(), summary(), boxplot() and plot() may be useful exploratory tools.

4. cor() will give you a correlation matrix, and cor.test() will carry out a test to determine whether any correlations are likely to be zero.

5. You’ll need the RColorBrewer and classInt libraries when you’re plotting a map {don’t use spplot()}. You might need to write a function to plot maps.

6. the lm() function will fit a regression model. Use PctBach as the dependent variable, and PctEld, PctFB, PctPov and PctBlack as possible predictors.

7. Examine the unadjusted r-squared – start with one independent variable, and create several models with additional variables. What happens to the r-squared when you add a new variable? AIC() might be useful here too.

8. Interpret the coefficient estimates – which ones are significant in the model?

9. Do the residuals exhibit significant spatial autocorrelation? Useful to map the residuals? What do the residuals tell us? In which counties are the predictions worst (standardised residuals might be useful here) – and why might this be? You’ll find the county names in the spatial polygons data frame. I found Wikipedia quite helpful as a start.

10. Write up your results with appropriate maps, and submit them to Moodle for NCG602A.

11. I have no problems with you working as a team, as long as the write ups are individual.

Martin Charlton

10-11-2016

MSc in Geocomputation (MH50B)

NCG602A: Methods and Techniques in Geocomputation

Links

http://www.montefiore.ulg.ac.be/~kvansteen/GBIO0009-1/ac20092010/Class8/Using%20R%20for%20linear%20regression.pdf

http://ncg.nuim.ie/ncg/gwr/GWR_Tutorial.pdf

http://data.princeton.edu/R/linearModels.html

## NCG602A: Methods and Techniques in Geocomputation

24
Nov