This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.

Time Series Classification Synthetic vs Real Financial Time Series – Part VI

See Part IPart II ,Part III, Part IV and Part V in this article for instructions from Matthew Smith on which R packages and data sets you need.

Next the Jarque-Bera tests for normality. Firstly on the synthetically created series.

# For both classes I take a random sample of 1 observation from each class (Synthetic and Real financial series)

jb_zero <- df %>%
filter(class == 0) %>%
group_by(row_id) %>%
nest() %>%
ungroup() %>%
sample_n(1) %>%
unnest() %>%
nest(-row_id) %>%
mutate(JarqueBeraTest = map(data, ~ JarqueBera.test(.x$value)))

print(“Jarque-Bera Test on the 0 – Synthetic class”)

## [1] “Jarque-Bera Test on the 0 – Synthetic class”

jb_zero$JarqueBeraTest

## [[1]]
##
## Jarque Bera Test
##
## data: .x$value
## X-squared = 0.3088, df = 2, p-value = 0.8569
##
##
## Skewness
##
## data: .x$value
## statistic = 0.045794, p-value = 0.7631
##
##
## Kurtosis
##
## data: .x$value
## statistic = 2.8582, p-value = 0.6406

Also on the real financial series.

jb_one <- df %>%
filter(class == 0) %>%
group_by(row_id) %>%
nest() %>%
ungroup() %>%
sample_n(1) %>%
unnest() %>%
nest(-row_id) %>%
mutate(JarqueBeraTest = map(data, ~ JarqueBera.test(.x$value)))

print(“Jarque-Bera Test on the 1 – Real class”)

## [1] “Jarque-Bera Test on the 1 – Real class”

jb_one$JarqueBeraTest

## [[1]]
##
## Jarque Bera Test
##
## data: .x$value
## X-squared = 25.14, df = 2, p-value = 0.000003474
##
##
## Skewness
##
## data: .x$value
## statistic = 0.084191, p-value = 0.5794
##
##
## Kurtosis
##
## data: .x$value
## statistic = 4.514, p-value = 0.0000006251

Stay tuned for the next installment for instructions on Autocorrelation plots.

Visit Matthew Smith – R Blog to download the complete R code and see the next step in this tutorial.

Disclosure: Interactive Brokers

Information posted on IBKR Traders’ Insight that is provided by third-parties and not by Interactive Brokers does NOT constitute a recommendation by Interactive Brokers that you should contract for the services of that third party. Third-party participants who contribute to IBKR Traders’ Insight are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from Matthew Smith and is being posted with permission from Matthew Smith. The views expressed in this material are solely those of the author and/or Matthew Smith and IBKR is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

trading top