[R-SIG-Finance] Behavior of sigThreshold()

Joshua Ulrich josh.m.ulrich at gmail.com
Mon Jul 14 04:14:58 CEST 2014


On Sun, Jul 13, 2014 at 2:58 PM, stergios marinopoulos
<stergenator at gmail.com> wrote:
> Hi,  I noticed an unexpected result when I used sigThreshold() with
> relationship="eq" and cross=TRUE on a xts object primarily filled with NA's
> and 1's for the value to be matched.  When I tried using cross=FALSE, it
> worked as expected since the branch
>
>     if (isTRUE(cross))
>         ret_sig <- diff(ret_sig) == 1
>
> is not executed.   My take away from this is that I should not be using
> columns with NA's as the base value and 1's as the occasional interesting
> value.   Instead I should use 0's as the base value.
>
I agree with your assessment.  If your variable can only take 2 values, use 0/1.

Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com



More information about the R-SIG-Finance mailing list