An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20090305/aeacd677/attachment.pl>
Locating peaks in zoo objects in one go
7 messages · Vorlow Constantinos, Joshua Ulrich, Gabor Grothendieck +1 more
Try this:
require(xts) vix <- as.xts(VIX) vix[vix > 70]
Close 2008-10-17 70.33 2008-10-24 79.13 2008-10-27 80.06 2008-11-19 74.26 2008-11-20 80.86 2008-11-21 72.67
index(vix[vix > 70])
[1] "2008-10-17" "2008-10-24" "2008-10-27" [4] "2008-11-19" "2008-11-20" "2008-11-21" HTH, Josh -- http://quantemplation.blogspot.com http://www.fosstrading.com
On Thu, Mar 5, 2009 at 9:00 AM, Vorlow Constantinos <CVorlow at eurobank.gr> wrote:
Dear R users,
The following code will download the VIX volatility index to a variable
called "VIX" (what else)...
library(tseries)
VIX <- get.hist.quote("^VIX", start = "1990-01-01", quote = "Close")
Is there a way I could determine (in one go or iteratively), where the
peaks (local maxima) lie in the sequence
(say by using an arbitrary rule i.e., locate prices which are greater
than x% the sample's average or a certain value) ???
I would like to be able to capture the prices as well as their
time-stamps....
Thanks in advance &
Best regards,
Costas Vorlow
P Think before you print.
Disclaimer:
This e-mail is confidential. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete the copy from your system.
EFG Eurobank Ergasias S.A. is not responsible for, nor endorses, any opinion, recommendation, conclusion, solicitation, offer or agreement or any information contained in this communication.
EFG Eurobank Ergasias S.A. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. If you suspect that the message may have been intercepted or amended, please call the sender.
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
This locates peaks over plus or minus (k+1)/2 days (k odd): # VIX from post library(zoo) k <- 201 idx <- rollapply(VIX, k, function(x) which.max(x) == (k+1)/2) plot(VIX) abline(v = time(idx)[idx]) On Thu, Mar 5, 2009 at 10:00 AM, Vorlow Constantinos
<CVorlow at eurobank.gr> wrote:
Dear R users,
The following code will download the VIX volatility index to a variable
called "VIX" (what else)...
library(tseries)
VIX <- get.hist.quote("^VIX", start = "1990-01-01", quote = "Close")
Is there a way I could determine (in one go or iteratively), where the
peaks (local maxima) lie in the sequence
(say by using an arbitrary rule i.e., locate prices which are greater
than x% the sample's average or a certain value) ???
I would like to be able to capture the prices as well as their
time-stamps....
Thanks in advance &
Best regards,
Costas Vorlow
P Think before you print.
Disclaimer:
This e-mail is confidential. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete the copy from your system.
EFG Eurobank Ergasias S.A. is not responsible for, nor endorses, any opinion, recommendation, conclusion, solicitation, offer or agreement or any information contained in this communication.
EFG Eurobank Ergasias S.A. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. If you suspect that the message may have been intercepted or amended, please call the sender.
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
This locates peaks over plus or minus (k+1)/2 days (k odd): # VIX from post library(zoo) k <- 201 idx <- rollapply(VIX, k, function(x) which.max(x) == (k+1)/2) plot(VIX) abline(v = time(idx)[idx]) On Thu, Mar 5, 2009 at 10:00 AM, Vorlow Constantinos
<CVorlow at eurobank.gr> wrote:
Dear R users,
The following code will download the VIX volatility index to a variable
called "VIX" (what else)...
library(tseries)
VIX <- get.hist.quote("^VIX", start = "1990-01-01", quote = "Close")
Is there a way I could determine (in one go or iteratively), where the
peaks (local maxima) lie in the sequence
(say by using an arbitrary rule i.e., locate prices which are greater
than x% the sample's average or a certain value) ???
I would like to be able to capture the prices as well as their
time-stamps....
Thanks in advance &
Best regards,
Costas Vorlow
P Think before you print.
Disclaimer:
This e-mail is confidential. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete the copy from your system.
EFG Eurobank Ergasias S.A. is not responsible for, nor endorses, any opinion, recommendation, conclusion, solicitation, offer or agreement or any information contained in this communication.
EFG Eurobank Ergasias S.A. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. If you suspect that the message may have been intercepted or amended, please call the sender.
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
Dear Gabor, Thanks for your prompt answer. One question though: It seems to be missing the VIX peaks at the beginning and the very end of the history of the sequence. What am I missing? I am trying to understand it from the help pages but... Costas Vorlow -----Original Message----- From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com] Sent: Thursday, March 05, 2009 6:39 PM To: Vorlow Constantinos; costas at vorlow.org Cc: r-sig-finance at stat.math.ethz.ch Subject: Re: [R-SIG-Finance] Locating peaks in zoo objects in one go This locates peaks over plus or minus (k+1)/2 days (k odd): # VIX from post library(zoo) k <- 201 idx <- rollapply(VIX, k, function(x) which.max(x) == (k+1)/2) plot(VIX) abline(v = time(idx)[idx])
On Thu, Mar 5, 2009 at 10:00 AM, Vorlow Constantinos <CVorlow at eurobank.gr> wrote:
Dear R users,
The following code will download the VIX volatility index to a
variable called "VIX" (what else)...
library(tseries)
VIX <- get.hist.quote("^VIX", start = "1990-01-01", quote = "Close")
Is there a way I could determine (in one go or iteratively), where the
peaks (local maxima) lie in the sequence (say by using an arbitrary
rule i.e., locate prices which are greater than x% the sample's
average or a certain value) ???
I would like to be able to capture the prices as well as their
time-stamps....
Thanks in advance &
Best regards,
Costas Vorlow
P Think before you print.
Disclaimer:
This e-mail is confidential. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete the copy from your system.
EFG Eurobank Ergasias S.A. is not responsible for, nor endorses, any opinion, recommendation, conclusion, solicitation, offer or agreement or any information contained in this communication.
EFG Eurobank Ergasias S.A. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. If you suspect that the message may have been intercepted or amended, please call the sender.
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
It will only locate peaks in the middle of a stretch of k values so near the ends you don't have (k+1)/2 values on either side. 2009/3/6 Vorlow Constantinos <CVorlow at eurobank.gr>:
Dear Gabor, Thanks for your prompt answer. One question though: It seems to be missing the VIX peaks at the beginning and the very end of the history of the sequence. What am I missing? I am trying to understand it from the help pages but... Costas Vorlow -----Original Message----- From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com] Sent: Thursday, March 05, 2009 6:39 PM To: Vorlow Constantinos; costas at vorlow.org Cc: r-sig-finance at stat.math.ethz.ch Subject: Re: [R-SIG-Finance] Locating peaks in zoo objects in one go This locates peaks over plus or minus (k+1)/2 days (k odd): # VIX from post library(zoo) k <- 201 idx <- rollapply(VIX, k, function(x) which.max(x) == (k+1)/2) plot(VIX) abline(v = time(idx)[idx]) On Thu, Mar 5, 2009 at 10:00 AM, Vorlow Constantinos <CVorlow at eurobank.gr> wrote:
Dear R users,
The following code will download the VIX volatility index to a
variable called "VIX" (what else)...
library(tseries)
VIX <- get.hist.quote("^VIX", start = "1990-01-01", quote = "Close")
Is there a way I could determine (in one go or iteratively), where the
peaks (local maxima) lie in the sequence (say by using an arbitrary
rule i.e., locate prices which are greater than x% the sample's
average or a certain value) ???
I would like to be able to capture the prices as well as their
time-stamps....
Thanks in advance &
Best regards,
Costas Vorlow
P Think before you print.
Disclaimer:
This e-mail is confidential. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete the copy from your system.
EFG Eurobank Ergasias S.A. is not responsible for, nor endorses, any opinion, recommendation, conclusion, solicitation, offer or agreement or any information contained in this communication.
EFG Eurobank Ergasias S.A. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. If you suspect that the message may have been intercepted or amended, please call the sender.
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
Vorlow Constantinos <CVorlow <at> eurobank.gr> writes:
Is there a way I could determine (in one go or iteratively), where the peaks (local maxima) lie in the sequence (say by using an arbitrary rule i.e., locate prices which are greater than x% the sample's average or a certain value) ???
Perhaps this peaks function will give you some ideas http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33097.html and another one http://ur.ly/8Ii Regards, John.