下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、和创建空间权重矩阵介绍-设置默认路径cdC:UsersxiuboDesktopF182013.v4F101994sheng创建新文件*shp2dta:readsashape(.shp)anddbase(.dbf)filefromdiskandconvertsthemintoStatadatasets.*shp2dta:读取CHN_adml文件*CHN_adml:为已有的地图文件*database(chinaprovince):表示创建一个名称为uchinaprovinceM的dBase数据集*database(filename):SpecifiesfilenameofnewdBasedatas
2、et*coordinates(coord):创建一个名称为“coord”的坐标系数据集*coordinates(filename):Specifiesfilenameofnewcoordinatesdataset*gencentroids(stub):Createscentroidvariables*genid(newvarname):Createsuniqueidvariablefordatabase.dtashp2dtausingCHN_adml,database(chinaprovince)coordinates(coord)genid(id)geneentroids(c)"绘
3、制2016年中國GDP分布圖*spmap:Visualizationofspatialdata"clnumber(#):numberofclasses*id(idvar):basemappolygonidentifier)识别符,声明变量名,一般以字母或卜划线开头,包含数字、字母、下划线)*_2016GDP:变量*coord:之前创建的坐标系数据集spmap_2016GDPusingcoord,id(id)clnumber(5)-更改变量名renamex_cIongituderenamey_clatitude"生成距离矩阵*spmat:用于定义与管理空间权重矩阵*Spati
4、al-weightingmatricesarestoredinspatial-weightingmatrixobjects(spmatobjects).*spmatobjectscontainadditionalinformationaboutthedatausedinconstructingspatial-weightingmatrices.*spmatobjectsareusedinfittingspatialmodels;seespreg(ifinstalled)andspivreg(ifinstalled)."idistance:(产生I®离矩卩乍)createan
5、spmatobjectcontaininganinverse-distaneematrixW水或contiguity:createanspmatobjectcontainingacontiguitymatrixW*idistance_jingdu:命名名称为"idistance_jingdu"的距離矩陣"longitude:使用经度latitude:使用纬度卄d(id):使用id*dfunction(function,miles):(设置计算距离方法)specifythedistancefunction.*functionmaybeoneofeuclidean(d
6、efault),dhaversine,rhaversine,ortheMinkowskidistaneeoforderp,wherepisanintegergreaterthanorequalto1."normalize(row):(行旳准ft)specifiesoneofthethreeavailablenormalizationtechniques:row,minmax,andspectral.*lnarow-normalizedmatrix,eachelementinrowiisdividedbythesumofrowi'selements*lnaminmax-norm
7、alizedmatrix,eachelementisdividedbytheminimumofthelargestrowsumandcolumnsumofthematrix*lnaspectral-normalizedmatrix,eachelementisdividedbythemodulusofthelargesteigenvalueofthematrixspmatidistaneeidistanceingdulongitudelatitude,id(id)dfunction(euclidean)normalize(row)"保存stata可读文件idistancejingdu.
8、spmatspmatsaveidistanceingduusingidistancejingdu.spmat*将刚刚保存的idistanceJingdu.spmat文件转化为txt文件spmatexportidistanceingduusingidistanceingdu.txt"生成相邻矩阵spmatcontiguitycontiguityjingduusingcoord,id(id)normalize(row)spmatsavecontiguityjingduusingcontiguityjingdu.spmatspmatexportcontiguityjingduusingco
9、ntiguityjingdu.txt"计算Moran*sI"安装spatwmat*spatwmat:用于定义空间权重矩阵*spatwmat:importsorgeneratesthespatialweightsmatricesrequiredbyspatgsa,spatlsa,spatdiag,andspatreg*Asanoption,spatwmatalsogeneratestheeigenvaluesmatrixrequiredbyspatreg*name(W):读取空间权重矩阵W*name(W):使用生成的空间权重矩阵W*xcoord:x坐标*ycoord:y坐标*
10、band(08):宽窗介绍*band(numlist)isrequiredifoptionusingfilenameisnotspecified.*ltspecifiesthelowerandupperboundsofthedistaneebandwithinwhichlocationpairsmustbeconsideredeighbors11(i.e.,spatiallycontiguous)*and,therefore,assignedanonzerospatialweight"binary:requeststhatabinaryweightsmatrixbegenerated
11、Tothisaim,allnonzerospatialweightsaresetto1.spatwmat,name(W)xcoord(longitude)ycoord(latitude)band(08)*安装绘制Moran'sI工具:splagvar*splagvarGeneratesspatiallylaggedvariables,constructstheMoranscatterplot,*andcalculatesglobalMoran'sIstatistics12016GDP:使用变量_2016GDP*wname(W):使用空间权重矩阵W*indicatethename
12、ofthespatialweightsmatrixtobeused*wfrom(Stata):indicatesourceofthespatialweightsmatrix*wfrom(Stata|Mata)indicateswhetherthespatialweightsmatrixisaStatamatrixloadedinmemoryoraMatafilelocatedintheworkingdirectory.*lfthespatialweightsmatrixhadbeencreatedusingspwmatrixitshouldexistasaStatamatrixorasaMat
13、afile.*moranL2016GDP):计算变量_2016GDP的Moran'sI值*plotC2016GDP):构建变M_2016GDPMoran散点图splagvar_2016GDP,wname(W)wfrom(Stata)moran(_2016GDP)plot(_2016GDP)和使用距离矩阵计算空间计量模型*设置默认路径cdD:软件学习软件资料statastata指导书籍命令陈强高级计量经济学及stata应用(第二版)全部数据*使用product.dta数据集(陈强的高级计量经济学及其stata应用P594)*将数据集product.dta存入当前工作路径useproduc
14、t.dta,clear*创建新变量,对原有部分变屋取对数genIngsp=log(gsp)genlnpcap=log(pcap)genlnpc=log(pc)genInemp=log(emp)*将空间权重矩阵usaww.spat存入当前工作路径spmatuseusawwusingusaww.spmat*使用聚类稳健的标准误估计随机效应的SDM模型xsmleIngspInpcapInpcInempunemp,wmat(usaww)model(sdm)robustnolog-使用选择项durbin(lnemp),不选择不显著的变量,使用聚类稳健的标准误估计随机效应的SDM模型xsmleIngspI
15、npcapInpcInempunemp,wmat(usaww)model(sdm)durbin(lnemp)robustnolognoeffects-使用选择项durbin(lnemp),不选择不显著的变量,使用聚类稳健的标准误估计固定效应的SDM模型xsmleIngspInpcapInpcInempunemp,wmat(usaww)model(sdm)durbin(lnemp)robustnolognoeffectsfe-存储随机效应和固定效应结果quixsmleIngspInpcapInpcInempunemp,wmat(usaww)model(sdm)durbin(lnemp)r2nol
16、ognoeffectsreeststorequixsmleIngspInpcapInpcInempunemp,wmat(usaww)model(sdm)durbin(lnemp)r2nolognoeffectsfeeststofe性sttab:将保存的结果汇总到一张表格中*b(fmt):specifyformatforpointestimates*beta(fmt):displaybetacoefficientsinsteadofpointest's*se(fmt):displaystandarderrorsinsteadoftstatistics*star(*0.1*0.050.01
17、):标记不同显著性水平对应的P值*r21ar21pr2(fmt):display(adjusted,pseudo)R-squared*p(fmt):displayp-valuesinsteadoftstatistics*label:makeuseofvariablelabels*title(string):specifyatitleforthetableesttabfere,bser2star(*0.1*0.05*0.01)*hausman检验*进行hausman检验前,回归中没有使用稳健标准误(没用“r”),*是因为传统的豪斯曼检验建立在同方差的前提卞沐constant:"elud
18、eestimatedinterceptsincomparison;defaultistoexclude*df(#):use#degreesoffreedom*sigmamore:baseboth(co)varianeematricesondisturbancevarianeeestimatefromefficientestimator*sigmaless:baseboth(co)varianeematricesondisturbaneevarianeeestimatefromconsistentestimatorhausmanfere“有时我们还会得到负的chi2值,即chi2<0,表明
19、模型不能满足Hausman检验的渐近假设。产生这些情况的原因可能有多种,1但我认为一个主要的原因是我们的模型设定有问题,导致Hausman检验的基本假设得不到满足。*这时,我们最好先对模型的设定进行分析,看看是否有遗漏变量的问题,或者某些变量是非平稳的等等。1在确定模型的设定没有问题的情况下再进行Hausman检验,如果仍然拒绝原假设或是出现上面的问题,*那么我们就认为随机效应模型的基本假设(个体效应与解释变量不相关)得不到满足。*此时,需要采用工具变量法或是使用固定效应模型。*连玉君(论文(2014):Hausman检验统计量有效性的MonteCarlo模拟分析)*研究了hausman检验统计量的小样
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年度管道试压冲洗对策措施方案-地铁配套建筑
- 地基钎探检查施工组织设计-综合办公楼
- 2026年度关于社区互助养老点照料情况的调查报告
- 2026厦门市集美实验学校产假顶岗教师招聘3人考试参考题库及答案解析
- 2026年阿瓦提县招聘社区工作者(6人)笔试备考题库与答案解析
- 2026-2027学年五年级上学期统编版语文单元练习卷 第七单元-2(含答案)
- 初中美术八年级上册(新教材)岭南版(新教材)第17课 水墨酣畅戏曲画课时作业卷
- 2027年小学数学二年级下册苏教版(新教材)三 认识方向课时测评卷
- 2026年昆明市盘龙区金辰街道办事处社区服务中心见习岗位招录(10人)笔试备考题库与答案解析
- CN119559077A 基于多智能体强化学习下的isp调参方法和设备 (人民中科(北京)智能技术有限公司)
- CSCO结直肠癌指南2026版更新解读
- 绿色施工方案
- 单侧视神经损伤诊断与治疗
- 2026年神经内科护士年度述职课件
- 异位妊娠保守治疗适应症中国专家共识(2026版)
- 产品追溯培训课件
- 康定兴玛拉人力资源有限责任公司企业招聘笔试题库2026
- 运动鞋生产的工艺流程
- 2025中国航天科工集团第六研究院总部呼和浩特校园招聘笔试历年参考题库附带答案详解
- 光伏并网前单位工程验收报告-2023
- 熔炼工艺操作培训课件
评论
0/150
提交评论