69

Spatial Analysis

 5 years ago
source link: http://shujuren.org/article/753.html?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

今天是Spatial Analysis上机实习课,平时学了很多统计分析的方法,但是没有具体跑过代码,上机就发现好多分析的结果有点看不懂,索性记录下来,供以后复习使用。

arr<-read.table("reg_data.txt", header=T)
x <- arr$mig
y<-arr$gdp

cor.test(arr$mig, arr$gdp, method = "pearson")
cor.test(x, y, method = "spearman")

这里的cor.test是相关性分析,参数如下:

cor.test(x, y,
         alternative = c("two.sided", "less", "greater"),
         method = c("pearson", "kendall", "spearman"),
         exact = NULL, conf.level = 0.95, continuity = FALSE, ...)

运行结果如下: JNZFVvZ.png!web

这个图最主要的就是要看,P-value的结果。这里的 P < 0.05 ,小概率事件发生了,原假设(null hypothesis)不成立,选择备择假设(alternative hypothesis)。也就是说,x 和 y 是相关的,R中的备择假设说x、y相关性不等于0,就是说他们相关了。

一般回归分析和方差分析

vmIFfej.png!web 这里也是看相关性系数,后面的 * 代表置信度。

MBNrIn7.png!web 接下来是summary.aov(),这个暂时看不懂,先放着吧。

3ieuMjJ.png!web (注:逐步回归过程中,AIC值越小,说明模型的拟合度越好)

练习4:Join_count

zUfqiyQ.png!web 在spdep程辑包中,image可以直接做出热力图, zUfqiyQ.png!web

版权声明:作者保留权利,严禁修改,转载请注明原文链接。

数据人网是数据人学习、交流和分享的平台http://shujuren.org 。专注于从数据中学习到有用知识。 平台的理念:人人投稿,知识共享;人人分析,洞见驱动;智慧聚合,普惠人人。 您在数据人网平台,可以1)学习数据知识;2)创建数据博客;3)认识数据朋友;4)寻找数据工作;5)找到其它与数据相关的干货。 我们努力坚持做原创,聚合和分享优质的省时的数据知识! 我们都是数据人,数据是有价值的,坚定不移地实现从数据到商业价值的转换!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK