Refresher on x ts and the plot () f u nction Arna u d Amsellem The R - - PowerPoint PPT Presentation

refresher on x ts and the plot f u nction arna u d
SMART_READER_LITE
LIVE PREVIEW

Refresher on x ts and the plot () f u nction Arna u d Amsellem The R - - PowerPoint PPT Presentation

Refresher on x ts and the plot () f u nction Arna u d Amsellem The R Trader VISU AL IZIN G TIME SE R IE S DATA IN R Arna u d Amsellem Q u antitati v e Trader and creator of the R Trader blog Refresher on x ts A special class of object to


slide-1
SLIDE 1

Refresher on xts and the plot() function Arnaud Amsellem The R Trader

VISU AL IZIN G TIME SE R IE S DATA IN R

Arnaud Amsellem

Quantitative Trader and creator of the R Trader blog

slide-2
SLIDE 2

VISUALIZING TIME SERIES DATA IN R

Refresher on xts

A special class of object to handle time series eXtensible Time Series xts = Time Index + Matrix The index is a time object: Date , POSIX Time , timeDate ,

chron

slide-3
SLIDE 3

VISUALIZING TIME SERIES DATA IN R

plot() and plot.xts()

plot() plot.xts() plot() can be used instead of plot.xts() when the object

to be ploed is an xts object

slide-4
SLIDE 4

VISUALIZING TIME SERIES DATA IN R

Using the plot() function

plot(my_ts)

slide-5
SLIDE 5

VISUALIZING TIME SERIES DATA IN R

Using the plot() function

plot(my_ts, main = "my first time series") lines(my_ts, col = "red", lwd = 2)

slide-6
SLIDE 6

VISUALIZING TIME SERIES DATA IN R

Using the plot() function

plot(my_ts, main = "my first time series", sub = "from Sep. 2008 to Dec. 2016") lines(my_ts, col = "red", lwd = 2)

slide-7
SLIDE 7

Let's practice!

VISU AL IZIN G TIME SE R IE S DATA IN R

slide-8
SLIDE 8

Other useful visualizing functions

VISU AL IZIN G TIME SE R IE S DATA IN R

Arnaud Amsellem

Quantitative Trader and creator of the R Trader blog

slide-9
SLIDE 9

VISUALIZING TIME SERIES DATA IN R

Other useful visualizing functions

plot(my_ts, main = "My Stocks")

slide-10
SLIDE 10

VISUALIZING TIME SERIES DATA IN R

Other useful visualizing functions

plot(my_ts, main = "My Stocks") lines(my_ts2, col = "red")

slide-11
SLIDE 11

VISUALIZING TIME SERIES DATA IN R

Other useful visualizing functions

plot(my_ts, main = "My Stocks") lines(my_ts2, col = "red") axis(side = 4, at = pretty(my_ts2))

slide-12
SLIDE 12

VISUALIZING TIME SERIES DATA IN R

Other useful visualizing functions

plot(my_ts, main = "My Stocks") lines(my_ts2, col = "red") axis(side = 4, at = pretty(my_ts2)) legend(x = "bottomright", legend = c("Stock X", "Stock Y"), col = c("black", "red"), lty = c(1, 1))

slide-13
SLIDE 13

VISUALIZING TIME SERIES DATA IN R

abline()-example

abline(v = as.Date("2016-04-14"))

slide-14
SLIDE 14

VISUALIZING TIME SERIES DATA IN R

abline()-example

abline(v = as.Date("2016-04-14")) abline(h = 1)

slide-15
SLIDE 15

VISUALIZING TIME SERIES DATA IN R

Other useful visualizing functions

plot(my_ts, main = "My Stocks") lines(my_ts2, col = "red") axis(side = 4, at = pretty(my_ts2)) legend(x = "bottomright", legend = c("Stock X", "Stock Y"), col = c("black", "red"), lty = c(1, 1)) abline(h = 10)

slide-16
SLIDE 16

VISUALIZING TIME SERIES DATA IN R

Other useful visualizing functions

library(PerformanceAnalytics) period <- c("2014-01/2015-06") chart.TimeSeries(my_ts, period.areas = period, main = "my_ts")

slide-17
SLIDE 17

Let's practice!

VISU AL IZIN G TIME SE R IE S DATA IN R