Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning Quantitative Finance with R

You're reading from   Learning Quantitative Finance with R Implement machine learning, time-series analysis, algorithmic trading and more

Arrow left icon
Product type Paperback
Published in Mar 2017
Publisher Packt
ISBN-13 9781786462411
Length 284 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
 Jeet Jeet
Author Profile Icon Jeet
Jeet
PRASHANT VATS PRASHANT VATS
Author Profile Icon PRASHANT VATS
PRASHANT VATS
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Learning Quantitative Finance with R
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
1. Introduction to R FREE CHAPTER 2. Statistical Modeling 3. Econometric and Wavelet Analysis 4. Time Series Modeling 5. Algorithmic Trading 6. Trading Using Machine Learning 7. Risk Management 8. Optimization 9. Derivative Pricing

zoo


The ts object has its limitations in representing the time series. It is used for representing equally spaced data. It cannot be used to represent the daily level stock prices as stock prices are equally spaced between Monday to Friday, but it is not the same case for Friday to Monday and in case there is market holidays on weekdays. This type of unequally spaced data cannot be represented by a ts object.

zoo is flexible and fully equipped to handle unequally spaced data, equally spaced data, and numerically indexed data.

Let us first install and load the zoo library. This can be done by executing the following code:

> install.packages("zoo") 
> library(zoo) 

Now we will discuss how to represent different time series scenarios using zoo.

Please note we will be using a common dataset for all the examples.

Constructing a zoo object

In order to create a zoo object, an ordered time index and data are required. So we are going to construct a zoo object.

Let us first import a few rows of our...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images