全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1254 2
2016-12-06

# Step4. Calculateand plot the Moran’s I value for the variable

result<-moran.test(CRIME,col.listw)

print(result)


QQ截图20161206202820.jpg


问题一:如何把调用  Moran I statistic standard deviate = 5.6761,并赋值给一个新变量?



# Step4. Calculateand plot the Moran’s I value for the variable

result<-moran.test(CRIME,col.listw)

print(result)


plot.map(CRIME,col.poly, main= paste ("CRIME",":Moran’sI =", result[1]))


2.jpg


问题二:如何改变图例中数据标签的小数位数?


曾经尝试使用round()函数,未成功,如下图所示:


3.jpg




谢谢!



二维码

扫码加我 拉你入群

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

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

全部回复
2016-12-6 21:17:56
自己已经解决该问题,方法如下:

> head(result)
$statistic
Moran I statistic standard deviate
                          5.676064

$p.value
[1] 6.891468e-09

$estimate
Moran I statistic       Expectation          Variance
      0.519389978      -0.020833333       0.009058413

$alternative
[1] "greater"

$method
[1] "Moran I test under randomisation"

$data.name
[1] "CRIME  \nweights: col.listw  \n"

> morani=round(result$statistic,3)
> print(morani)
Moran I statistic standard deviate
                             5.676
二维码

扫码加我 拉你入群

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

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

2016-12-6 22:51:55
恭喜恭喜
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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