gis for applied economicsgis for applied economics visualization tools and vector transformation...
TRANSCRIPT
GISFORAPPLIEDECONOMICS
VisualizationtoolsandVectorTransformation(II)
JuanCarlosMuñoz-MoraUniveristatPompeuFabra
Nov2016
ROADMAP1. Commentsonthereplicationfromprevioussession2. AdditionalconceptsinVectorTransformation3. ConceptsinVectorTransformation(II)
BufferDistances
4. Bufferanddistancesinaction5. ReplicationDell()
REPLICATIONPREVIOUSSESSION
Desktopsolution?ReplicationpyQGISReplicationStandalone
DESKTOPSOLUTIONS(ANIDEA)1addnewvariableattribute2makeintersection3exportdatatoR(csv)4identifyrepeatedunion5joindatafrom
outside
ADDITIONALCONCEPTSINVECTORTRANSFORMATION
UNION
Inshapely(Standalonesolution)
InpyQGIS
a.union(b)
processing.runalg('qgis:union', input, input2, output)
DIFFERENCE
Inshapely(Standalonesolution)
InpyQGIS
a.difference(b)
processing.runalg('qgis:difference', input, overlay, output)
SYMMETRICDIFFERENCE
Inshapely(Standalonesolution)
InpyQGIS
a.symmetric_difference(b)
processing.runalg('qgis:symetricaldifference', input, overlay, output)
SPATIALJOINOverlappingNearbyjoin
DESKTOPSOLUTIONS(PLUGINS)mmqgisspatialjoin
ANYIDEA(INTUITION)HOWCANWEIMPLEMENTTHISINPYTHON/PYQGIS?
Inshapely(Standalonesolution)
InpyQGIS
## ---- For Polygons## Option 1 - object.contains(other)## Option 2 - at the borderobject.touches(other)## Option 3object.within(other)## --- For Linesobject.crosses(other)object.disjoint(other)
processing.runalg('qgis:joinattributesbylocation' , target, join, predicate, summary, stats, keep, output)
CONCEPTSINVECTORTRANSFORMATION(II)
BUFFERThisoperationcreatesapolygonaround
theobjectataspecifieddistance.
Neighborhood(averyrusticdefinition-why?)Identifyspilloversoftreatments
,Peereffect
Alternativewaystodefinetreatment
DISTANCES
Miguel&Kremer(2004) deMeletal.(2008)
Conley&Udry(2010)
Muehlenbachsetal.(2015)
Proximity(veryrude)Buildinstruments(Validity!)
Moreonlocationasainstrumentsee
Whatisthedifferentwithbuffferapproach?
Oster(2012)Nunn(2008)
Gibson&McKenzie2007
source:ArcGISManual
U.S.commercialairports,2008greatarcsandsymbolmapshowVoronoi
Reportamaperror
PompeuFabraUniversity
Madrid,SpainMoreoptions
Signin
©2016Google-Mapdata©2016GeoBasis-DE/BKG(©2009),Google,Inst.Geogr.Nacional TermsofUse
ThreemodelsoftheEarthtocalculatedistances:
FlatplaneSphericalEllipsoid
FLATPLANE-EARTHASAFLATPLANEEuclideandistance(Pythagoreantheorem )
whatifweuseunprojectedcoordinates?units
+ =a2 b2 c2
SPHERICAL-EARTHASAPERFECTSPHEREGreatcircledistance(Haversineformula-decimalsdegrees)
ELLIPSOID-EARTHASANON-PERFECTSPHERE
Greatcircledistance(Vincentyformula-decimalsdegrees)
But,whataboutifwewouldliketotakeintoaccountroads?
Wewilldiscussitonthelastsession!
CONCEPTSINVECTORTRANSFORMATION(II)
INACTION
DavidYanagizawa-Drott
QuarterlyJournalofEconomics,2014,129(4),pp.1947-199
PROPAGANDAANDCONFLICT:EVIDENCEFROMTHERWANDAN
GENOCIDE
Theroleofmassmediaintimesofconflictandstate-sponsoredmassviolenceagainstcivilians.
METHODRTLMtransmittersandradiopropagationsoftwareradiocoveragewithineachvillage.Casuallink receptiongeneratedbyRwanda'shighlyvaryingtopography
MAINFINDINGBroadcastsledtomoreviolenceduringthegenocide.
participation(10%oftotal-51,000persons)spillovereffectsinmilitiaviolence
→
→
↑↑
Inadditiontoviolencebythemilitary,attacksandmassacresconductedbylocalmilitiasgroupsandordinary
civilianscontributedtoadeathtollof0.5–1.0milliondeaths(DesForges,1999;Straus,2004;Verwimp,2006).
TimothyG.ConleyandChristopherR.Udry
AmericanEconomicReview2010,100:1,35–69
LEARNINGABOUTANEWTECHNOLOGY:PINEAPPLEINGHANA
TheroleofsociallearninginthediffusionofanewagriculturaltechnologyinGhana. Dofarmerslearnfrom
theirpeers?
MAINFINDINGSFarmersadjusttheirinputstoalignwiththoseoftheir
informationneighborswhoweresurprisinglysuccessfulinpreviousperiods.
DATAGeo-locatedpanelhouseholdsurveys(every6weekin1996-
98)in3villagesofsouthernGhana
→
NEIGHBORHOODMETRICResponseto"Haveyouevergoneto__foradviceabout
yourfarm?"
EMPIRICALSPECIFICATION
INDEXOFGOODNEWSINPUTLEVELS
Standarderrors:calculatedbyConley(1999)
SPATIALREGRESSIONDISCONTINUITY
DESIGN(fewwords)
WHATISDIFFERENT?Usingboundariesascutoff
lines(set)Indicator-Score-coordinatestwo-dimensions
Further
→
Keele&Titiunik2014
SomeapplicationsinEconomics
DELL(2010) MICHALOPOULOS&PAPAIOANNOU(2014)
NathanNunn
TheQuarterlyJournalofEconomics(2008)123(1):139-176.
(GISstrategyreplication)
THELONG-TERMEFFECTSOFAFRICA'SSLAVETRADES
THEPAPERCanpartofAfrica'scurrentunderdevelopmentbeexplained
byitsslavetrades?
DATASlavesexportedfromeachcountry
fromeachportofAfricaEthnicityofasampleof100,00+slavesEthnichomelandinAfrica
REDUCEDFORM
GDPpercapitaincountry in2000
#ofslavesexported1400-1900fromcountry
Landsurfaceareaofcountry
Controls
= α + β ln( ) + +yiexporti
areaiX ′
i εi
yi i
exportsi
i
areai i
X ′i
DISTANCEASINSTRUMENT
EXCLUSIONRESTRICTION-LOCATIONOFSLAVEPORTS
climatesuitabilityofplantationcrops/locationofminesnotaffectedbythedistancetoAfricaDistancetoslavemarkets Distancetoothereconomicopportunities
≠
FIRSTSTAGE
where,
Distancetonearestslavetradecenters
ln( ) = δ + Ω + +exportsi
areaiD′
i X ′i μi
=D′i
RESULTS(FIRSTSTAGE)
RESULTS(SECONDSTAGE)
REPLICATIONPLANDistancetotheSlaveTradeCenterFromeachcountrytilltheAtlanticborder
REPLICATEITSINSTRUMENTDistancetonearestslavetradecentersPLANARE
TIPSFORPYQGISInpyQGIS
processing.runalg('qgis:union', input, input2, output)
TIPSFORPYQGISGettingthecentroids
Featurebyfeature
processing.runalg('qgis:polygoncentroids', input_layer, output_layer)
for f in layer.getFeatures(): pt = f.geometry().centroid().asPoint()
DistanceMatrixprocessing.runalg('qgis:distancematrix', input_layer, input_field, target_layer, target_field, matrix_type, nearest_points, distance_matrix)
FORNEXTSESSIONInstallthefollowinglibraries
rasteriorasterstats