R Language-time series plotting

Source: Internet
Author: User

Using the R language, draw two graphics in a drawing window, using the layout manager.

1. The commands for drawing autocorrelation and partial autocorrelation graphs are:

> par (pin=c (4,2), Mfrow=c (2,1)) #设置图形大小 (length 4 ", Height 2"), divided into 2 rows and 1 columns

> Layout (Matrix (c (1,1,2,2), 2,2,byrow=true)) #将绘图区分成4个单元格, 1th, 2 is a row, 3rd, 4 is a row.
> layout.show () #显示布局

> ACF (C2) #自相关图
> pacf (C2) #偏自相关图

The drawing effect diagram is:


2, only calculate not draw the graph

>ACF (C2,plot=false)

3. Draw time series on a graph, ACF (autocorrelation), PACF (partial autocorrelation) diagram
> Layout (Matrix (c (), 3,1,byrow=true), Height=c (1,1,1)) #设置绘图窗口布局, three rows, one column per row, height per row, width not set, 100%
> layout.show () #用于显示布局

> Plot (x1,type= "L") #绘制时间序列

> ACF (x1) #绘制acf图
> PACF (x1) #绘制pacf图
To draw an effect diagram:



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.