# 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 Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus 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 - R Blog and is being posted with its permission. The views expressed in this material are solely those of the author and/or Matthew Smith - R Blog and Interactive Brokers 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 buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. 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.