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

Hilbert transformation


Hilbert transformation is another technique to transform time series and R uses the seewave package for this. This package can be installed using install.packages() and loaded into the workspace using the library() command:

> model <-  hilbert(dji, 1) 

The first parameter is the time series object which you would like to transform, and the second parameter is the sampling frequency of the wave. In the preceding example, I used dji as time series and sampling frequency as 1 to calculate the Hilbert transformation.

If you would like to know the output of the model then you should use the following code:

> summary(model) 
      V1          
 Length:2555 
 Class :complex 
 Mode  :complex 

The preceding output mentions the length of input data series is 2555 and the type of output variable named model is complex.

As the output is complex, we can extract real and imaginary values using the following code:

>rp<- Re(model)   
&gt...
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