楼主: jzbd
25488 26

[一般统计问题] 用spwmatrix 如何生成“经济”空间权重矩阵(WE) [推广有奖]

  • 0关注
  • 28粉丝

已卖:2022份资源

学科带头人

28%

还不是VIP/贵宾

-

威望
1
论坛币
9333 个
通用积分
4.1175
学术水平
53 点
热心指数
55 点
信用等级
37 点
经验
14098 点
帖子
865
精华
0
在线时间
2300 小时
注册时间
2007-11-3
最后登录
2025-11-7

楼主
jzbd 发表于 2010-8-14 01:04:13 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
在spwmatrix 命令中,有一条是说可以生成“经济”空间权重矩阵(WE)。
        wtype(bin|inv|econ|invecon|socnet|socecon) indicates whether binary,
        distance decay, economic distance, inverse economic distance, social
        network, or socio-economic spatial weights should be created.
同时里面也给出了个例子:
4) Generate an economic distance spatial weights matrix using employment  as the economic variable
      run:    spwmatrix gecon latitude longitude, wn(wecon) wtype(econ)  econvar(employment) rowstand.

于此,我就用自己的数据(数据里面包括 latitude, longitude,GDP),我是打算用GDP作为权重的,例子中是用employment的。
我运行后出现以下字母(红色的)
        _=invalid name

        

     SOS ,不知道这是为什么。???
二维码

扫码加我 拉你入群

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

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

关键词:spwmatrix 空间权重矩阵 matrix 空间权重 权重矩阵 employment distance economic network created

沙发
jzbd 发表于 2010-8-14 20:49:07
自己顶一下。

藤椅
zhaowill 发表于 2010-8-15 12:09:26
把数据附上。

板凳
jzbd 发表于 2010-8-15 18:49:22
楼上的,数据已经在这了。SOS,帮忙运算一下吧。 麻烦了。

数据都是很简单的,一个是经度变量,一个是纬度变量,一个是ID,另外一个变量时GDP。
现在来生成 经济空间矩阵,但就是出来。我是安装help 做的。

报纸
zhangtao 发表于 2010-8-16 17:16:29
. spwmatrix gecon latitude longitude, wname(wknn5) knn(5) rowstand

Nearest neighbor (5) spatial weights matrix calculated successfully and
>  the following actions taken:

- Spatial weights matrix  created as Stata object(s): wknn5.

- N.B.: Stata spatial weights matrix, wknn5, can be used as if it was
> created by the user-written command spatwmat.

- Spatial weights matrix has been row-standardized.

. spwmatrix socio village_id, wname(socecon_wght) row wtype(socecon)

spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 500)  r
> (3958.761) row
N.B.: Elements of 2 rows sum up to zero, weighting matrix was not row-s
> tandardized
These rows are:
  28
  29
You might want to rethink your weights structure criteria.
Use nearstat to obtain distance information and a neighbor count
for your distance-cutoff or distance band.
Binary distance spatial weights matrix calculated successfully and the
> following actions taken:
- Spatial weights matrix  created as Stata object(s): wbin.
- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

为什么不出结果呢?
已有 1 人评分论坛币 学术水平 热心指数 收起 理由
SpencerMeng + 20 + 1 + 1 精彩帖子

总评分: 论坛币 + 20  学术水平 + 1  热心指数 + 1   查看全部评分

地板
zhangtao 发表于 2010-8-16 17:19:30
spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 500)  r
> (3958.761) row

N.B.: Elements of 2 rows sum up to zero, weighting matrix was not row-s
> tandardized

These rows are:
  28
  29
You might want to rethink your weights structure criteria.
Use nearstat to obtain distance information and a neighbor count
for your distance-cutoff or distance band.

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

. spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 200)  r
> (3958.761) row

N.B.: Elements of 18 rows sum up to zero, weighting matrix was not row-
> standardized

These rows are:
  5
  6
  7
  9
  11
  12
  13
  14
  17
  18
  19
  20
  21
  22
  23
  28
  29
  30
You might want to rethink your weights structure criteria.
Use nearstat to obtain distance information and a neighbor count
for your distance-cutoff or distance band.

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

.

7
zhangtao 发表于 2010-8-16 17:24:23
spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 150)  r
> (3958.761) row

N.B.: Elements of 22 rows sum up to zero, weighting matrix was not row-
> standardized

These rows are:
  4
  5
  6
  7
  8
  9
  11
  12
  13
  14
  16
  17
  18
  19
  20
  21
  22
  23
  28
  29
  30
  31
You might want to rethink your weights structure criteria.
Use nearstat to obtain distance information and a neighbor count
for your distance-cutoff or distance band.

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

. spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 100)  r
> (3958.761) row

N.B.: Elements of 24 rows sum up to zero, weighting matrix was not row-
> standardized

These rows are:
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  14
  16
  17
  18
  19
  20
  21
  22
  23
  25
  28
  29
  30
  31
You might want to rethink your weights structure criteria.
Use nearstat to obtain distance information and a neighbor count
for your distance-cutoff or distance band.

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

. spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 100)  r
> (358.761) row

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

- Spatial weights matrix has been row-standardized.

.
. spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 100)  r
> (1358.761) row

N.B.: Elements of 6 rows sum up to zero, weighting matrix was not row-s
> tandardized

These rows are:
  9
  11
  21
  28
  29
  30
You might want to rethink your weights structure criteria.
Use nearstat to obtain distance information and a neighbor count
for your distance-cutoff or distance band.

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

. spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 100)  r
> (558.761) row

N.B.: Elements of one row sum up to zero, weighting matrix was not row-
> standardized

This row is:
  28
You might want to rethink your weights structure criteria.
Use nearstat to obtain distance information and a neighbor count
for your distance-cutoff or distance band.

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

. spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 100)  r
> (158.761) row

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

- Spatial weights matrix has been row-standardized.

. list

     +---------------------------------------------------------+
     | provid          proveng   longit~e   latitude       gdp |
     |---------------------------------------------------------|
  1. |      1            Anhui        119         31   69.4842 |
  2. |      2          Beijing     116.43      39.91   72.8565 |
  3. |      3        Chongqing     106.56      29.56     71.73 |
  4. |      4           Fujian        118         26   68.5743 |
  5. |      5            Gansu        102         38   67.2363 |
     |---------------------------------------------------------|
  6. |      6        Guangdong        113         23    72.521 |
  7. |      7          Guangxi        109         24   68.7223 |
  8. |      8          Guizhou        107         27   64.2908 |
  9. |      9           Hainan      109.5       19.2   70.0111 |
10. |     10            Hebei      114.3      38.02   70.3524 |
     |---------------------------------------------------------|
11. |     11     Heilongjiang        128         48   66.9732 |
12. |     12            Henan        114         34   70.1546 |
13. |     13            Hubei        112         31   67.2547 |
14. |     14            Hunan        112         28   66.9335 |
15. |     15          Jiangsu     120.25      31.75    65.678 |
     |---------------------------------------------------------|
16. |     16          Jiangxi        116         28   71.3742 |
17. |     17            Jilin     126.55      43.85   66.1062 |
18. |     18         Liaoning        123         41   67.9495 |
19. |     19       Nei Mongol     111.41      40.48   70.2189 |
20. |     20          Ningxia        106         37   66.9432 |
     |---------------------------------------------------------|
21. |     21          Qinghai         96         36   60.5695 |
22. |     22          Shaanxi        109         35   67.4042 |
23. |     23         Shandong        118         36    70.571 |
24. |     24         Shanghai     121.29      31.14   74.9035 |
25. |     25           Shanxi        112         37   68.9713 |
     |---------------------------------------------------------|
26. |     26          Sichuan        105      29.83   66.3282 |
27. |     27          Tianjin     117.12      39.02   72.3214 |
28. |     28         Xinjiang         82         38    59.638 |
29. |     29   Xizang Zizhiqu         88         29   62.5905 |
30. |     30           Yunnan        101         24   63.4897 |
     |---------------------------------------------------------|
31. |     31         Zhejiang        120         29     71.78 |
     +---------------------------------------------------------+

.

8
zhangtao 发表于 2010-8-17 08:47:15
spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 500)  r
>  (3958.761) row

N.B.: Elements of 2 rows sum up to zero, weighting matrix was not row-s
> tandardized

These rows are:
  28
  29
You might want to rethink your weights structure criteria.
Use nearstat to obtain distance information and a neighbor count
for your distance-cutoff or distance band.

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

. spwmatrix gecon latitude longitude, wn(wbin)  wtype(bin) db(0 100)  r
>  (3958.761) row

N.B.: Elements of 24 rows sum up to zero, weighting matrix was not row-
> standardized

These rows are:
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  14
  16
  17
  18
  19
  20
  21
  22
  23
  25
  28
  29
  30
  31
You might want to rethink your weights structure criteria.
Use nearstat to obtain distance information and a neighbor count
for your distance-cutoff or distance band.

Binary distance spatial weights matrix calculated successfully and the
> following actions taken:

- Spatial weights matrix  created as Stata object(s): wbin.

- N.B.: Stata spatial weights matrix, wbin, can be used as if it was c
> reated by the user-written command spatwmat.

. mat list  wbin

symmetric wbin[31,31]
           0    0    0  100  100  100  100  100  100  100  100  100
SWMDist    0
    Yes    0    0
    Yes    0    0    0
    Yes    0    0    0    0
    Yes    0    0    0    0    0
    Yes    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    1    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    1    0    0    0    0    0    0    0    0    0
    Yes    0    1    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0

         100  100  100  100  100  100  100  100  100  100  100  100
    Yes    0
    Yes    0    0
    Yes    0    0    0
    Yes    0    0    0    0
    Yes    0    0    0    0    0
    Yes    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    1    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0    0    0    0    0    0

         100  100  100  100  100  100  100
    Yes    0
    Yes    0    0
    Yes    0    0    0
    Yes    0    0    0    0
    Yes    0    0    0    0    0
    Yes    0    0    0    0    0    0
    Yes    0    0    0    0    0    0    0

. list

     +---------------------------------------------------------+
     | provid          proveng   longit~e   latitude       gdp |
     |---------------------------------------------------------|
  1. |      1            Anhui        119         31   69.4842 |
  2. |      2          Beijing     116.43      39.91   72.8565 |
  3. |      3        Chongqing     106.56      29.56     71.73 |
  4. |      4           Fujian        118         26   68.5743 |
  5. |      5            Gansu        102         38   67.2363 |
     |---------------------------------------------------------|
  6. |      6        Guangdong        113         23    72.521 |
  7. |      7          Guangxi        109         24   68.7223 |
  8. |      8          Guizhou        107         27   64.2908 |
  9. |      9           Hainan      109.5       19.2   70.0111 |
10. |     10            Hebei      114.3      38.02   70.3524 |
     |---------------------------------------------------------|
11. |     11     Heilongjiang        128         48   66.9732 |
12. |     12            Henan        114         34   70.1546 |
13. |     13            Hubei        112         31   67.2547 |
14. |     14            Hunan        112         28   66.9335 |
15. |     15          Jiangsu     120.25      31.75    65.678 |
     |---------------------------------------------------------|
16. |     16          Jiangxi        116         28   71.3742 |
17. |     17            Jilin     126.55      43.85   66.1062 |
18. |     18         Liaoning        123         41   67.9495 |
19. |     19       Nei Mongol     111.41      40.48   70.2189 |
20. |     20          Ningxia        106         37   66.9432 |
     |---------------------------------------------------------|
21. |     21          Qinghai         96         36   60.5695 |
22. |     22          Shaanxi        109         35   67.4042 |
23. |     23         Shandong        118         36    70.571 |
24. |     24         Shanghai     121.29      31.14   74.9035 |
25. |     25           Shanxi        112         37   68.9713 |
     |---------------------------------------------------------|
26. |     26          Sichuan        105      29.83   66.3282 |
27. |     27          Tianjin     117.12      39.02   72.3214 |
28. |     28         Xinjiang         82         38    59.638 |
29. |     29   Xizang Zizhiqu         88         29   62.5905 |
30. |     30           Yunnan        101         24   63.4897 |
     |---------------------------------------------------------|
31. |     31         Zhejiang        120         29     71.78 |
     +---------------------------------------------------------+

.


.

9
zwa222 发表于 2010-8-21 18:31:58
看来,关于经济矩阵,问题依然存在啊!纠结中...........

10
陈清鸿 发表于 2010-10-7 15:46:09
是啊   我也正需要那
经济一家

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-5 20:50