Quantcast

Compute jump test statistic

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Compute jump test statistic

cursethiscure
 Im trying to compute the following statistic testing for jumps in high
frequecy asset prices,
J t,M  =  (1 – MedRVt,M / RVt,M) /(sqrt*( 0.96 * 1/M * max(1, MedRQt,M/
MedRV2t,M ))


I have in R:

## ADS Test Statistic

> numr = 1 - (outads$medrv/outads$rv)> outads$medrq/(outads$medrv^2) -> denom2> fix(denom2)



But when I  try to run the max(1, MedRQt,M/ MedRV2t,M)) part I get:



> max(1, denom2)[1] NA


I guess this is returned because I am tryin to maximise a time series /
sequence against a constant but I am not sure how to run this?

Any advice?
Thanks

        [[alternative HTML version deleted]]


_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Compute jump test statistic

gsee
We don't have your data, so we can't get past
    numr = 1 - (outads$medrv/outads$rv)
    Error: object 'outads' not found

Please see:
tinyurl.com/reproducible-000
and
http://www.r-project.org/posting-guide.html

Also, it wouldn't hurt to explain what you're doing, what all those
terms are in your formula, and what the notation means.

Finally, only send text e-mails to the list; no HTML.

Garrett

On Mon, Jun 18, 2012 at 2:16 PM, Caolan Harvey
<[hidden email]> wrote:

>  Im trying to compute the following statistic testing for jumps in high
> frequecy asset prices,
> J t,M  =  (1 – MedRVt,M / RVt,M) /(sqrt*( 0.96 * 1/M * max(1, MedRQt,M/
> MedRV2t,M ))
>
>
> I have in R:
>
> ## ADS Test Statistic
>
>> numr = 1 - (outads$medrv/outads$rv)> outads$medrq/(outads$medrv^2) -> denom2> fix(denom2)
>
>
>
> But when I  try to run the max(1, MedRQt,M/ MedRV2t,M)) part I get:
>
>
>
>> max(1, denom2)[1] NA
>
>
> I guess this is returned because I am tryin to maximise a time series /
> sequence against a constant but I am not sure how to run this?
>
> Any advice?
> Thanks
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Compute jump test statistic

cursethiscure
In reply to this post by cursethiscure
Sorry please find the outads data attached as a csv file.

 For the max(1, MedRQ/MedRV^2))

 where MedRQ/MedRV is: `outads$medrq/(outads$medrv^2) -> outads$denom2`
 in the csv file.

 I am trying to return the maximum of either 1 or MedRQ/MedRV^2 (i'm
 aware all values are greater than 1, but this needs to be applied to
 other data sets) but I do not know how to maximise a constant against
 time-series sequence. Everything else is ok. I just dont know how to
 return this argumentoutads.csv
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Compute jump test statistic

gsee
A csv does not contain R objects.  How did you read the csv into R?


On Mon, Jun 18, 2012 at 3:24 PM, cursethiscure
<[hidden email]> wrote:

> Sorry please find the outads data attached as a csv file.
>
>  For the max(1, MedRQ/MedRV^2))
>
>  where MedRQ/MedRV is: `outads$medrq/(outads$medrv^2) -> outads$denom2`
>  in the csv file.
>
>  I am trying to return the maximum of either 1 or MedRQ/MedRV^2 (i'm
>  aware all values are greater than 1, but this needs to be applied to
>  other data sets) but I do not know how to maximise a constant against
>  time-series sequence. Everything else is ok. I just dont know how to
>  return this argument http://r.789695.n4.nabble.com/file/n4633741/outads.csv
> outads.csv
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Compute-jump-test-statistic-tp4633731p4633741.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Compute jump test statistic

gsee
What do you want to do with all of the NAs in your data.  You can't
apply functions like max to data with NA

> max(0, 1)
[1] 1
> max(NA, 1)
[1] NA

Maybe you want to use na.omit?

> max(na.omit(c(NA, 0)), 1)
[1] 1

HTH,
Garrett

On Mon, Jun 18, 2012 at 4:29 PM, G See <[hidden email]> wrote:

> A csv does not contain R objects.  How did you read the csv into R?
>
>
> On Mon, Jun 18, 2012 at 3:24 PM, cursethiscure
> <[hidden email]> wrote:
>> Sorry please find the outads data attached as a csv file.
>>
>>  For the max(1, MedRQ/MedRV^2))
>>
>>  where MedRQ/MedRV is: `outads$medrq/(outads$medrv^2) -> outads$denom2`
>>  in the csv file.
>>
>>  I am trying to return the maximum of either 1 or MedRQ/MedRV^2 (i'm
>>  aware all values are greater than 1, but this needs to be applied to
>>  other data sets) but I do not know how to maximise a constant against
>>  time-series sequence. Everything else is ok. I just dont know how to
>>  return this argument http://r.789695.n4.nabble.com/file/n4633741/outads.csv
>> outads.csv
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/Compute-jump-test-statistic-tp4633731p4633741.html
>> Sent from the Rmetrics mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Compute jump test statistic

gsee
On Mon, Jun 18, 2012 at 4:38 PM, G See <[hidden email]> wrote:

> What do you want to do with all of the NAs in your data.  You can't
> apply functions like max to data with NA
>
>> max(0, 1)
> [1] 1
>> max(NA, 1)
> [1] NA
>
> Maybe you want to use na.omit?
>
>> max(na.omit(c(NA, 0)), 1)
> [1] 1

or use `na.rm=TRUE`
> max(c(NA, 1), na.rm=TRUE)
[1] 1

> HTH,
> Garrett
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Loading...