全部版块 我的主页
论坛 经济学论坛 三区 区域经济学
33818 53
2019-06-08
clear all
cd D:\statasp\stata制空间权重矩阵代码数据
   set matsize 11000
   use county_jingweidu.dta, clear
   //(1)计算01矩阵
spatwmat, name(W01) xcoord(x) ycoord(y) band(0 12) binary standardize
matlist W01
mat2txt,matrix(W01) saving(3180)replace  //矩阵保存为txt文件
dataout using 3180.txt,word excel  //矩阵转换为word和excel文件
//(2)反距离矩阵和地理矩阵平方的好方法
  clear all
// ssc install spwmatrix
cd D:\statasp\stata制空间权重矩阵代码数据
   use county_jingweidu.dta, clear
  spwmatrix gecon y x, wname(winvsq) wtype(inv)
          matlist winvsq
mat2txt,matrix(winvsq) saving(3180d)replace  //矩阵保存为txt文件,县级太多,跑不出来,考虑减少样本
dataout using 3180d.txt,word excel  //矩阵转换为word和excel文件
mat w1=hadamard(winvsq,winvsq)  //距离倒数的平方
matlist w1
mat2txt,matrix(w1) saving(3180d)replace  //矩阵保存为txt文件
dataout using 3180.txt,word excel  //矩阵转换为word和excel文件



clear all
cd D:\statasp
   use city_jingweidu.dta, clear
   //(1)计算01矩阵
spatwmat, name(W01) xcoord(x) ycoord(y) band(0 12) binary standardize
matlist W01
mat2txt,matrix(W01) saving(310)replace  //矩阵保存为txt文件
dataout using 310.txt,word excel  //矩阵转换为word和excel文件,地级城市
//(2)反距离矩阵和地理矩阵平方的好方法
  clear all
// ssc install spwmatrix
cd D:\statasp
   use city_jingweidu.dta, clear
  spwmatrix gecon y x, wname(winvsq) wtype(inv)
          matlist winvsq
mat2txt,matrix(winvsq) saving(310d)replace  //矩阵保存为txt文件
dataout using 310d.txt,word excel  //矩阵转换为word和excel文件
mat w1=hadamard(winvsq,winvsq)  //距离倒数的平方
matlist w1
mat2txt,matrix(w1) saving(310d)replace  //矩阵保存为txt文件
dataout using 310.txt,word excel  //矩阵转换为word和excel文件


clear all
cd D:\statasp
   use jingweidu.dta, clear
   (1)计算01矩阵
spatwmat, name(W01) xcoord(x) ycoord(y) band(0 12) binary standardize
matlist W01
mat2txt,matrix(W01) saving(100)replace  //矩阵保存为txt文件
dataout using 100.txt,word excel  //矩阵转换为word和excel文件,省级矩阵
(2)反距离矩阵和地理矩阵平方的好方法
  clear all
  ssc install spwmatrix
cd D:\statasp
   use jingweidu.dta, clear
  spwmatrix gecon y x, wname(winvsq) wtype(inv)
          matlist winvsq
mat2txt,matrix(winvsq) saving(111)replace  //矩阵保存为txt文件
dataout using 111.txt,word excel  //矩阵转换为word和excel文件
mat w1=hadamard(winvsq,winvsq)  //距离倒数的平方
matlist w1
mat2txt,matrix(w1) saving(130)replace  //矩阵保存为txt文件
dataout using 130.txt,word excel  //矩阵转换为word和excel文件








jingweidu.dta
大小:(1.97 KB)

只需: 2 个论坛币  马上下载



county_jingweidu.dta
大小:(218.83 KB)

只需: 3 个论坛币  马上下载



city_jingweidu.dta
大小:(11.42 KB)

只需: 3 个论坛币  马上下载














二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2019-6-8 14:39:52
十分感谢楼主
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2019-6-18 23:35:55
请问楼主(1)计算01矩阵spatwmat, name(W01) xcoord(x) ycoord(y) band(0 12) binary standardize中,band的(0 12)是怎么确定的啊?如果是地级市的经纬度,可以还是使用(0 12)吗?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2019-7-1 00:14:31
xuehe 发表于 2019-6-8 08:43
clear all
cd D:\statasp\stata制空间权重矩阵代码数据
   set matsize 11000
经纬度那个数据是一直不变的对吧?不管研究啥,只要是省级的都是一样的吗
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2019-7-5 16:16:24
请问大神报错这个是什么意思啊?
复制代码
报错:   J():  3300  argument out of range
spwmatrix_CalcSPweightM():     -  function returned error
                 <istmt>:     -  function returned error
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2019-7-5 16:48:57
田沁雪 发表于 2019-7-5 16:16
请问大神报错这个是什么意思啊?报错:   J():  3300  argument out of range
spwmatrix_CalcSPweightM(): ...
是因为我用的省份不是连在一起的吗?我用的一带一路沿线省份,剔除西藏就变成了两块,一块北边的省份,一块南边的省份,这两块没有共同点或边。还请大神指教
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群