You are on page 1of 3

8/31/2016

SpatialeconometricmodelingusingPROCSPATIALREGSubconsciousMusings

Subconscious Musings

AdvancedanalyticsfromResearch
Drivetotheworld

Spatialeconometricmodelingusing
PROCSPATIALREG
GuohuiWu | AUGUST23,2016
1139

Tweet

Like 1

Share

31

Inourpreviouspost,Econometricandstatisticalmethodsforspatialdataanalysis,we
discussedtheimportanceofspatialdata.Formostpeople,understandingthat
importanceisrelativelyeasybecausespatialdataareoftenfoundinourdailylives
andweareallaccustomedtoanalyzingthem.Wecanallrelatetothefirstlawof
geographyEverythingisrelatedtoeverythingelse,butnearthingsaremorerelated
thandistantthingsandwecanagreethatourinteractionwithclosethingsaround
usplaysanimportantroleinourdecisionprocess.Applicationsofspatialdatainour
dailylivesareoftenseamless,andyoucouldarguethatweareallspatialstatisticians
andeconometricianswithoutevenrealizingit.Althoughmosthumanbeingshavean
innateabilitytoincorporatespatialinformation,computerbasedanalyticsneedtobe
giventoolstoincludesuchinformationintheiranalyses.SAS/ETS14.2introduces
onesuchtool,theSPATIALREGprocedure,whichenablesyoutoincludespatial
informationintheanalysisandimprovetheeconometricinferenceandstatistical
propertiesofestimators.
Inthispost,wediscusshowyoucanusetheSPATIALREGproceduretoanalyze
2013homevaluedatainNorthCarolinaatthecountylevel.Thefivevariablesinthe
datasetarecounty(countyname),homeValue(medianvalueofowneroccupied
housingunits),income(medianhouseholdincomein2013ininflationadjusted
dollars),bachelor(percentageofpeoplewithbachelorsdegreeorhigherwholivein
thecounty),andcrime(rateofCrimeIndexoffensesper100,000people).Thedata
forhomevalues,income,andbachelorsdegreepercentagesineachcountywere
obtainedfromthewebsiteoftheUnitedStatesCensusBureauandcomputedusing
the20092013AmericanCommunitySurveyfiveyearestimates.Dataforcrimewere
retrievedfromthewebsiteofNorthCarolinaDepartmentofPublicSafety.Forthe
purposeofnumericalstabilityandinterpretation,allfivevariablesarelogtransformed
duringtheprocessofdatacleansing.Weusethisdatasettodemonstratethe
modelingcapabilitiesoftheSPATIALREGprocedureandtounderstandtheimpactof
householdincome,crimerate,andeducationattainmentonhomevalues.
Asapreliminarydataanalysis,wefirstshowamapofNorthCarolinathatdepictsthe
countylevelhomevaluesinFigure1.Itiseasytoseethatthehomevaluestendtobe
clusteredtogether.Highervaluesarefoundinthecoastal,urban,andmountainareas
ofNorthCarolinaandlowerhomevaluescanbefoundinruralareas.Homevaluesof
neighboringcountiesmorecloselyresembleeachotherthanhomevaluesofcounties
thatarefarapart.

Figure1:Medianvalueofowneroccupiedhousingunits

Fromamodelingperspective,findingsfromFigure1suggestthatthedatamight
containaspatialdependence,whichneedstobeaccountedforintheanalysis.In
particular,anendogenousinteractioneffectmightexistinthedatahomevaluestend
tobespatiallycorrelatedwitheachother.PROCSPATIALREGenablesyouto
analyzethedatabyusingavarietyofspatialeconometricmodels.

http://blogs.sas.com/content/subconsciousmusings/2016/08/23/1558/

1/4

8/31/2016

SpatialeconometricmodelingusingPROCSPATIALREGSubconsciousMusings

Tolaythegroundworkfordiscussion,
youcanstarttheanalysiswitha
linearregression.Forthismodel,the
valueofAkaikesinformationcriterion
(AIC)is106.12.Theresultsof
parameterestimationfromalinear
regressionmodel,showninTable1,
suggestthatthreepredictors
income,crime,andbachelorareall
significantatthe0.01level.
Moreover,crimeexertsanegative
Table1:parameterestimatesforalinearregression
impactonhomevalues,indicating
model
thathighcrimeratesreducehome
values.Ontheotherhand,both
incomeandbachelorhavepositiveimpactsonhomevalues.
Figure2providestheplotofpredictedhomeValuefromthelinearregressionmodel.
AlthoughthecomparisonofFigure1andFigure2mightsuggestthatpredicted
homeValuefromthelinearregressionmodelcapturesthegeneralpatterninthe
observeddata,youneedtobecarefulaboutsomeunderlyingassumptionsforlinear
regression.Amongthoseassumptions,acriticaloneisthatthevaluesofthe
dependentvariableareindependentofeachother,whichisnotlikelyforthedataat
hand.Asamatteroffact,bothMoransItestandGearysCtestsuggestthatthereis
aspatialautocorrelationinhomeValueatthe0.01significancelevel.Consequently,if
youignorethespatialdependenceinthedatabyfittingalinearregressionmodelto
thedata,youruntheriskoffalseinference.

Figure2:predictedmedianvalueofowneroccupiedhousingunits
usingalinearregressionmodel

BecauseofthespatialdependenceinhomeValue,agoodcandidatemodelto
considermightbeaspatialautoregressive(SAR)modelforitsabilitytoaccommodate
theendogenousinteractioneffect.YoucanusePROCSPATIALREGtofitaSAR
modeltothedata.Beforeyouproceedwithmodelfitting,youneedprovideaspatial
weightsmatrix.Generallyspeaking,aspatialweightsmatrixsummarizesthespatial
neighborhoodstructureentriesinthematrixrepresenthowmuchinfluenceoneunit
exertsoveranother.
Thespatialweightsmatrix
specificationisofvitalimportancein
spatialeconometricmodeling.
Despitemanydifferentwaysof
specifyingsuchamatrix,resultscan
besensitivetothechoiceofaspatial
weightsmatrix.Withoutdelvinginto
thenittygrittyofsuchchoice,youcan
simplydefinetwocountiestobe
neighborsofeachotheriftheyshare
acommonborder.Aftercreatingthe
spatialweightsmatrix,youcanfeedit
intoPROCSPATIALREGandruna
SARmodel.Table2presentsthe
resultsofparameterestimationfrom
aSARmodel.

Table2:parameterestimatesforaSARmodel

Forthismodel,thevalueAICis110.79.Theregressioncoefficientsthatcorrespond
toincome,crime,andbachelorareallsignificantlydifferentfrom0atthe0.01levelof
significance.Bothincomeandbachelorexhibitasignificantlypositiveshortrundirect
impactonhomevalues.Incontrast,crimerateshowsasignificantlynegativeshort
rundirectimpactonhomevalues.Inaddition,thespatialautoregressivecoefficient
issignificantlydifferentfromzeroat0.01level,suggestingthatthereisasignificantly
positivespatialdependenceinhomevalues.
http://blogs.sas.com/content/subconsciousmusings/2016/08/23/1558/

2/4

8/31/2016

SpatialeconometricmodelingusingPROCSPATIALREGSubconsciousMusings

Figure3showsthepredictedvaluesforhomeValuefromtheSARmodel.Comparing
Figures1and3suggestthatthefittedhomevaluescapturethetrendinthedata
reasonablywell.

Figure3:predictedmedianvalueofowneroccupiedhousingunitsusingaSARmodel

Inthispost,weintroducedtheSPATIALREGprocedure,fitaSARmodel,and
comparedpredictedvaluesfromtheSARmodeltothosefromlinearregression.Even
thoughtheSARmodelpresentedanimprovementoverthelinearmodelintermsof
AIC,manyothermodelsareavailableintheSPATIALREGprocedurethatmight
provideevenmoredesirableresultsandmoreaccuratepredictions.Thesemodels
includethespatialDurbinmodel(SDM),spatialerrormodel(SEM),spatialDurbin
errormodel(SDEM),spatialautoregressiveconfused(SAC)model,spatial
autoregressivemovingaverage(SARMA)model,spatialmovingaverage(SMA)
model,andsoon.Inthenextpost,wewilldiscusstheirfeaturesandshowyouhowto
selectthemostsuitablemodelforthehomevaluedataset.Wewillalsobegivinga
talk,"Location,Location,Location!SAS/ETSSoftwareforSpatialEconometric
Modeling,"attheSASAnalyticsExperienceconferenceSeptember1214,2016in
LasVegas,sostopbyandlet'stalkspatial!
ThispostwascowrittenwithJanChvosta.

tags:advancedanalytics,analyticsconference,econometrics,spatial

2 Comments

Rajendra
PostedAugust25,2016at12:19am | Permalink

Veryinformativeinformation,iwasusingARCGISforSAR.Couldyoupleasealsoblog
onSpatialWeightsMatrix,verykeeninunderstandhowtocreatethisMatrix
Reply

GuohuiWu
PostedAugust25,2016at9:29am | Permalink

Thanksforyourcomment,Rajendra!Wewillconsiderwritingablogposton
howtocreateaspatialweightsmatrixinthenearfuture.Pleasestaytuned.
Reply

Post a Comment
Youremailisneverpublishednorshared.Requiredfieldsaremarked*
Name*

Email*

http://blogs.sas.com/content/subconsciousmusings/2016/08/23/1558/

3/4

You might also like