关键词不能为空

当前您在: 主页 > 英语 >

用STATA做空间计量

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-06 10:50
tags:

-

2021年2月6日发(作者:省份英语)


实用文案



How can I calculate Moran's I in Stata?


Note:


The


commands


shown


in


this


page


are


user- written


Stata


commands


that


must be downloaded.



To install the package of spatial analysis tools, type findit


spatgsa in the command window.




Moran's


I


is


a


measure


of


spatial


autocorrelation--how


related


the


values


of


a


variable


are


based


on


the


locations


where


they


were


measured.



Using


a


set


of


user-written Stata commands, we can calculate Moran's I in Stata.



We will be using


the spatwmat command to generate a matrix of weights based on the locations in


our


data


and


the


spatgsa


command


to


calculate


Moran's


I


or


other


spatial


autocorrelation measures.





Let's look at an example. Our dataset, ozone, contains ozone measurements from


thirty-two


locations


in


the


Los


Angeles


area


aggregated


over


one


month.


The


dataset


includes


the


station


number


(station),


the


latitude


and


longitude


of


the


station


(lat


and


lon),


and


the


average


of


the


highest


eight


hour


daily


averages


(av8top).


This


data,


and


other


spatial


datasets,


can


be


downloaded


from


the


University


of


Illinois's


Spatial


Analysis


Lab.


We


can


look


at


a


summary


of


our


location variables to see the range of locations under consideration.



use /stat/stata/faq/, clear


summarize lat lon



标准文档



实用文案







Variable |








Obs









Mean





Std. Dev.








Min









Max


-------------+---------- ----------------------------------------------











lat |









32






34.0146




.2228168





33.6275




34.69012











lon |









32




-117.7078




.5683853



-118.5347



-116.2339



Based on the minimum and maximum values of these variables, we can calculate


the


greatest


Euclidean


distance


we


might


measure


between


two


points


in


our


dataset.



display sqrt((34.69012 - 33.6275)^2 + (-116.2339 - -118.5347)^2)



2.5343326


Knowing this maximum distance between two points in our data, we can generate a


matrix


based


on


the


distances


between


points.



In


the


spatwmat


command,


we


name the weights matrix to be generated, indicate which of our variables are the x-


and


y-coordinate


variables,


and


provide


a


range


of


distance


values


that


are


of


interest in the band option.



All of the distances are of interest in this example, so


we create a band with an upper bound greater than our largest possible distance. If


we did not care about distances greater than 2, we could indicate this in the band


option.




spatwmat, name(ozoneweights) xcoord(lon) ycoord(lat) band(0 3)


标准文档



实用文案




The following matrix has been created:



1. Inverse distance weights matrix ozoneweights






Dimension: 32x32





Distance band: 0 < d <= 3





Friction parameter: 1





Minimum distance: 0.1











1st quartile distance: 0.4











Median distance: 0.6











3rd quartile distance: 1.0











Maximum distance: 2.4











Largest minimum distance: 0.50










Smallest maximum distance: 1.23




As described in the output, the command above generated a matrix with 32 rows


and 32 columns because our data includes 32 locations. Each off-diagonal entry [i, j]


in the matrix is equal to 1/(distance between point i and point j).



Thus, the matrix


entries for pairs of points that are close together are higher than for pairs of points


that are far apart.



If you


wish to


look at


the matrix, you


can


display


it


with the


matrix list command. With our matrix of weights, we can now calculate Moran's I.





标准文档



实用文案



spatgsa av8top, weights(ozoneweights) moran



Measures of global spatial autocorrelation




Weights matrix


------------- -------------------------------------------------


Name: ozoneweights


Type: Distance-based (inverse distance)


Distance band: 0.0 < d <= 3.0


Row-standardized: No


------- -------------------------------------------------- -----



Moran's I


-------------------------------------------------- ------------












Variables |





I







E(I)




sd(I)






z





p-value*


--------------------+------------------------ -----------------















av8top |



0.248



-0.032




0.036




7.679




0.000


---------- -------------------------------------------------- --


*1-tail test



Based on these results, we can reject the null hypothesis that there is zero spatial


标准文档



实用文案



autocorrelation present in the variable av8top at alpha = .05.



Variations


Binary


Matrix:


If


there


exists


some


threshold


distance


d


such


that


pairs


with


distances less than d are neighbors and pairs with distances greater than d are not,


you can create a binary neighbors matrix with the spatwmat command (indicating


bin and setting band to have an upper bound of d) and use this weights matrix for


calculating Moran's I.



We could do this for d = .75:




spatwmat, name(ozoneweights) xcoord(lon) ycoord(lat) band(0 .75) bin



The following matrix has been created:



1. Distance-based binary weights matrix ozoneweights






Dimension: 32x32





Distance band: 0 < d <= .75





Friction parameter: 1





Minimum distance: 0.1











1st quartile distance: 0.4











Median distance: 0.6











3rd quartile distance: 1.0











Maximum distance: 2.4








标准文档



实用文案






Largest minimum distance: 0.50










Smallest maximum distance: 1.23



spatgsa av8top, weights(ozoneweights) moran




Measures of global spatial autocorrelation




Weights matrix


------------- -------------------------------------------------


Name: ozoneweights


Type: Distance-based (binary)


Distance band: 0.0 < d <= 0.75


Row-standardized: No


----------------------------------------- ---------------------



Moran's I


------------------ --------------------------------------------












Variables |





I







E(I)




sd(I)






z





p-value*


------------------- -+-----------------------------------------















av8top |



0.188



-0.032




0.033




6.762




0.000


标准文档



实用文案



------------ --------------------------------------------------


*1-tail test



In this example, the binary formulation of distance yields a similar result.



We can


reject the null hypothesis that there is zero spatial autocorrelation present in the


variable av8top at alpha = .05.




Using an existing matrix: If you have calculated a weights matrix according to some


other


metric


than


those


available


in


spatwmat


and


wish


to


use


it


in


calculating


Moran's


I,


spatwmat


allows


you


to


read


in


a


Stata


dataset


of


the


required


dimensions


and


format


it


as


a


distance


matrix


that


can


be


used


by


spatgsa.



If


is a dataset with 32 columns and 32 rows, it could be converted to a


weighted matrix aweights to be used in spatgsa analyzing av8top:



spatwmat using









标准文档



实用文案

























标准文档


-


-


-


-


-


-


-


-



本文更新与2021-02-06 10:50,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/607579.html

用STATA做空间计量的相关文章

  • 余华爱情经典语录,余华爱情句子

    余华的经典语录——余华《第七天》40、我不怕死,一点都不怕,只怕再也不能看见你——余华《第七天》4可是我再也没遇到一个像福贵这样令我难忘的人了,对自己的经历如此清楚,

    语文
  • 心情低落的图片压抑,心情低落的图片发朋友圈

    心情压抑的图片(心太累没人理解的说说带图片)1、有时候很想找个人倾诉一下,却又不知从何说起,最终是什么也不说,只想快点睡过去,告诉自己,明天就好了。有时候,突然会觉得

    语文
  • 经典古训100句图片大全,古训名言警句

    古代经典励志名言100句译:好的药物味苦但对治病有利;忠言劝诫的话听起来不顺耳却对人的行为有利。3良言一句三冬暖,恶语伤人六月寒。喷泉的高度不会超过它的源头;一个人的事

    语文
  • 关于青春奋斗的名人名言鲁迅,关于青年奋斗的名言鲁迅

    鲁迅名言名句大全励志1、世上本没有路,走的人多了自然便成了路。下面是我整理的鲁迅先生的名言名句大全,希望对你有所帮助!当生存时,还是将遭践踏,将遭删刈,直至于死亡而

    语文
  • 三国群英单机版手游礼包码,三国群英手机单机版攻略

    三国群英传7五神兽洞有什么用那是多一个武将技能。青龙飞升召唤出东方的守护兽,神兽之一的青龙。玄武怒流召唤出北方的守护兽,神兽之一的玄武。白虎傲啸召唤出西方的守护兽,

    语文
  • 不收费的情感挽回专家电话,情感挽回免费咨询

    免费的情感挽回机构(揭秘情感挽回机构骗局)1、牛牛(化名)向上海市公安局金山分局报案,称自己为了挽回与女友的感情,被一家名为“实花教育咨询”的情感咨询机构诈骗4万余元。

    语文