码迷,mamicode.com
首页 > 编程语言 > 详细

R语言学习笔记(一):时间序列分析

时间:2015-08-15 11:35:30      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:

以数据集robot为例

1.打开数据

data(robot)

2.绘制标准残差图

> m1=arima(x = robot, order = c(1, 0, 0))
> m2=arima(x = robot, order = c(0, 1, 1))
> plot(rstandard(m1),type="o")
> plot(rstandard(m2),type="o")

3.绘制自相关图和偏自相关图

> acf(robot,80)
> pacf(robot,30)

4.导出R的数据

> write.table(robot,"robot.csv",sep=",")

5.绘制时间序列图

> plot.ts(robot)

6.残差正态性检验

> shapiro.test(robot)

当p-value<0.05时,我们拒绝原假设,拒绝其符合正态分布

R语言学习笔记(一):时间序列分析

标签:

原文地址:http://www.cnblogs.com/pursuit1996/p/4731905.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!