0
点赞
收藏
分享

微信扫一扫

时间序列分析R

醉东枫 2022-03-22 阅读 55
r语言

第一章

目录

1生成时间序列数据

1.1行输入

1.2列输入

2绘制时序图

2.1点线结构参数

2.2符号参数

2.3连线类型参数


1生成时间序列数据

1.1行输入

price<-c(101,82,66,35,31,7)

price<-ts(price,start=c(2015,1),frequency = 12)

price

Jan Feb Mar Apr May Jun

2015 101 82 66 35 31 7

plot(price)

1.2列输入

price<-scan()

1: 101

2: 82

3: 66

4: 35

5: 31

6: 7

7:

Read 6 items

> price<-ts(price,start=c(2015,1),frequency=12)

> price

     Jan Feb Mar Apr May Jun

2015 101  82  66  35  31   7

2绘制时序图

2.1点线结构参数

plot(price, type = “o”)

par(mfrow=c(3,2))

plot(price,type="p",main='type="p"')

plot(price,type="l",main='type="l"')

plot(price,type="b",main='type="b"')

plot(price,type="o",main='type="o"')

plot(price,type="h",main='type="h"')

plot(price,type="s",main='type="s"')

plot(price,type="p",main='type="p"')

2.2符号参数

par(mfrow=c(2,2))
plot(price,type="o",pch=1,main='pch=1')
plot(price,type="o",pch=8,main='pch=18')
plot(price,type="o",pch=16,main='pch=16')
plot(price,type="o",pch=24,main='pch=24')

2.3连线类型参数

par(mfrow=c(1,2))
plot(price,lty=1,main='lty=1')
plot(price,lty=2,main='lty=2')

 

 

举报

相关推荐

0 条评论