Lab 7: Geographically Weighted Regression

 

  1. Start by copying Data_2006\Database\Census\Census.mdb\Census\BG_BACI feature class to your NR245 geodatabase. Then export a table of block groups for Baltimore city (Data_2006\Database\Analysis\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.

First, give the model a title, say Baltimore block groups. Next, choose the dependent variable, 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. What is the adjusted r-squared for the local and global models? What are the AIC scores for each model? What is the result of the ANOVA, towards the bottom? Based on these which model appears to be better?  Now check out where it says “test for spatial variability of parameters” and interpret that output. How many variables appear to be significantly nonstationary? What does that mean? Finally, check out the casewise diagnostics and attempt to understand what each column means.
  2. OK, now we need to import the results into ArcMap. Open Arc Toolbox and click Conversion Tools>>import to coverage>>import from interchange file. Choose BGPTS and choose to output as BGPTS2. Next you have to define the projection for the file. Right click on it in Arc Catalog, then click properties. Click the projection tab, and then click “define.”  In the next screen, choose to define it as Geographic>>DD>>WGS1984. Then in Arc Catalog click on the plus sign to the left of BGPTS and you should see “point” and “tic” listed underneath. Right click on “point” and click export>>to geodatabase (single). Save it as a feature class classed temp in NR245. Now, in toolbox, change the projection of temp (data management>>projections and transformations>>feature>>project) and make the new projection the same as BG_BACI (when you select the output coordinate system click Import and browse to BG_BACI). 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). 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 . Start by plotting out (using five classes) and screencapturing the residuals from the model. Do you see any clear patterns or does it look fairly random. Then, plot out the local r-squared value (localrsq) and screencapture, describing what local r-squared means in the caption. Next, plot out the parameter value and t statistics from Canmean and screencapture them. 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. Interpret what the pattern of parameters and t statistics for Canmean indicates. If you have time, try doing this for some other variables.