Lab 7: Geographically Weighted Regression

Due March 17

  1. Start by copying NR245\lab_data.mdb\BG_BACI feature class to your NR245 geodatabase. Then export a table of block groups for Baltimore city (NR245\lab_data.mdb\BGBACItable) to your folder (in arc catalog, right click>>export>>to dbase(single). Open BGBACItable in Excel and save it as a CSV file called bgbaci.
  2. Now we’re going to do a Geographically weighted regression in which we regress median home price against a variety of independent variables, including canopy cover. Open Geographically Weighted Regression from the start menu. Then, under the GWR wizard check the “create a new model” radio button and click GO. Under model type, choose Gaussian, then click GO again. In the next dialogue, where it says “open data file” change the input file type to CSV and then browse to your data set you just created. When it asks whether “to undertake analysis at the data point locations,” click “yes.” In the next dialogue choose ArcInfo Export File (e00) as the output type, saving it in your NR245 directory. Call it BGPTS and click save. In the next interface (data preview) click continue. Next, you should get the “confirm data files interface.” You shouldn’t have to change anything here unless you messed up earlier. No need to have a calibration file. Click continue. Now you get the main interface.

Description: gwr

First, give the model a title, say Baltimore block groups. Next, choose the dependent variable of median house value, MED_VAL_AL (click it in the left window, then click the little arrow next to “dependent variable.”). Next choose your independent variables in the same manner: use P_SFDH (that’s percent single family detached homes), POWNOCC(percent owner occupied housing), P_vac (percent vacant housing), MED_ROOMS (median number of rooms per house), YRSOLD (median years old for housing), d2down, d2prot and CANMEAN2.  Then choose X and Y as your location variables. Choose adapative as your kernel type, and set bandwidth selection to all data, and leave everything else as is (making sure that ArcInfo is chosen as the output format).  Click on “model options” and under that interface, choose a Monte Carlo significance test and check “pointwise diagnostics.”  Then click “save model” and give it a name you can remember. Finally, click run. Next you should see prompts for the control and listing files. Keep the control file as given and choose to save a listing file in your nr245 directory, calling it BGBACI. Then click ‘run’ .

You should see a black DOS screen with a “run completed” message box in the background. DON’T click OK on the run completed box, even if it says “the model failed to run.” Instead, let it continue to run until the DOS window disappears, maybe 5 minutes.

  1. Now, check out the outputs. Browse to where you saved your listing (text) file, and open it. Start by interpreting the text output.  [Q1] Report the adjusted r-squared values for the local and global models. Report the AIC scores for each model. Report the F statistic from the ANOVA, towards the bottom. Based on all three heuristics, which model appears to be better?  [Q2]Now check out where it says “test for spatial variability of parameters” and Cut and paste the output. How many variables appear to be significantly spatially nonstationary? What does that mean for a variable to be nonstationary in a model? [Q3] Finally, check out the casewise diagnostics and describe what the R-square values mean and why there is a different one for each row.
  2. OK, now we need to import the results into ArcMap. Open Arc Toolbox and click Conversion Tools>> to coverage>>import E00. Choose BGPTS and choose to output as BGPTS2. In Arc Catalog click on the plus sign to the left of BGPTS and you should see “point” and “tic” listed underneath. Now, you have to simultaneously define the projection for the file and change the projection to the same projection as the rest of the data. Open BGPTS in ArcMap, then in Arc Toolbox change the projection (data management>>projections and transformations>>feature>>project). In that interface, select BGPTS, define the input coordinate system (use the pointing finger button, then the“select button) as geographic>>world>>WGS84. Save the output data set as a feature class in your geodatabase. Then choose the output coordinate system to be the same as BG_BACI (hit pointing finger button, then import, then browse to BG_BACI). Choose the geographic transformation as BGS1984 to NAD 1983. You might get an error saying that the projection failed, but it still should be there if you try to add it from your geodatabase.  Now add both the points and the BG_BACI block groups layer to your ArcMap scene, with BG_BACI in the background. You should see the points overlay nicely on the block groups. Now do a spatial join FROM bgpts2 TO BG_BACI (right click on BG_BACI>>joins and relates>>join>>join by location, choose the second radio button). Make sure to save the output in your geodatabase as BG_GWR. Now all your parameter values, t-statistics, local R-squares, local standard errors, etc. should be saved in the new layer.
  3. Now let’s plots some stuff out. For these plots, use a color ramp with two color families, like Description: colorramp. Start by plotting out (using five classes with the quantile display method) and screencapturing the standardized residuals (STRESID) from the model. Do you see any clear patterns or does it look fairly random. Now plot out the local r-squared value (localrsq) again using 5 classes and quantiles, and screencapture. [Q4] Describe what local r-squared means in the context of GWR. Next, plot out the parameter value from Canmean (tree canopy) with 5 classes, but this time click the “classify” button and under “break value” change the first value to 0. Put it in layout mode with the legend included and screencapture. You can tell which number corresponds to which variable by its order. So, for instance parm01, refers to the parameter on the intercept, and parm02, refers to the parameter on the first listed variable in your output file, while tval02 refers to the t value of that variable. [Q5] Describe what the different colors in the map mean regarding the relationship between tree canopy and housing price. Now plot out the t local t-statistic (T_val) on Canmean, but this time do a manual classification. Click the “classify” button, choose Manual as method, 3 as the number of classes and under “break values” manually type in -1.65 and 1.65 for the first two values (leave the third the same), which represent significance at the 95% confidence level. Turn into layout mode with the legened  and Screencapture.  [Q6]Describe what this map is showing.
  4. Combine everything into a PDF and upload