tseriescq {BNPTSclust} | R Documentation |

Function that performs the time series clustering algorithm described in Nieto-Barajas and Contreras-Cristan (2014) for quarterly time series data.

tseriescq(data, maxiter = 500, burnin = floor(0.1 * maxiter), thinning = 5, scale = TRUE, level = FALSE, trend = TRUE, seasonality = TRUE, deg = 2, c0eps = 2, c1eps = 1, c0beta = 2, c1beta = 1, c0alpha = 2, c1alpha = 1, priora = TRUE, pia = 0.5, q0a = 1, q1a = 1, priorb = TRUE, q0b = 1, q1b = 1, a = 0.25, b = 0, indlpml = FALSE)

`data` |
Data frame with the time series information. |

`maxiter` |
Maximum number of iterations for Gibbs sampling. |

`burnin` |
Burn-in period of the Markov Chain generated by Gibbs sampling. |

`thinning` |
Number that indicates how many Gibbs sampling simulations should be skipped to form the Markov Chain. |

`scale` |
Flag that indicates if the time series data should be scaled to the [0,1] interval with a linear transformation as proposed by Nieto-Barajas and Contreras-Cristan (2014). If TRUE, then the time series are scaled to the [0,1] interval. |

`level` |
Flag that indicates if the level of the time series will be considered for clustering. If TRUE, then it is taken into account. |

`trend` |
Flag that indicates if the polinomial trend of the model will be considered for clustering. If TRUE, then it is taken into account. |

`seasonality` |
Flag that indicates if the seasonal components of the model will be considered for clustering. If TRUE, then they are taken into account. |

`deg` |
Degree of the polinomial trend of the model. |

`c0eps` |
Shape parameter of the hyper-prior distribution on sig2eps. |

`c1eps` |
Rate parameter of the hyper-prior distribution on sig2eps. |

`c0beta` |
Shape parameter of the hyper-prior distribution on sig2beta. |

`c1beta` |
Rate parameter of the hyper-prior distribution on sig2beta. |

`c0alpha` |
Shape parameter of the hyper-prior distribution on sig2alpha. |

`c1alpha` |
Rate parameter of the hyper-prior distribution on sig2alpha. |

`priora` |
Flag that indicates if a prior on parameter "a" is to be assigned. If TRUE, a prior on "a" is assigned. |

`pia` |
Mixing proportion of the prior distribution on parameter "a". |

`q0a` |
Shape parameter of the continuous part of the prior distribution on parameter "a". |

`q1a` |
Shape parameter of the continuous part of the prior distribution on parameter "a". |

`priorb` |
Flag that indicates if a prior on parameter "b" is to be assigned. If TRUE, a prior on "b" is assigned. |

`q0b` |
Shape parameter of the prior distribution on parameter "b". |

`q1b` |
Shape parameter of the prior distribution on parameter "b". |

`a` |
Initial/fixed value of parameter "a". |

`b` |
Initial/fixed value of parameter "b". |

`indlpml` |
Flag that indicates if the LPML is to be calculated. If TRUE, LPML is calculated. |

It is assumed that the time series data is organized into a data frame with the time periods included as its row names.

`mstar` |
Number of groups of the chosen cluster configuration. |

`gnstar` |
Array that contains the group number to which each time series belongs. |

`HM` |
Heterogeneity Measure of the chosen cluster configuration. |

`arrho` |
Acceptance rate of the parameter "rho". |

`ara` |
Acceptance rate of the parameter "a". |

`arb` |
Acceptance rate of the parameter "b". |

`sig2epssample` |
Matrix that in its columns contains the sample of each sig2eps_i's posterior distribution after Gibbs sampling. |

`sig2alphasample` |
Matrix that in its columns contains the sample of each sig2alpha_i's posterior distribution after Gibbs sampling. |

`sig2betasample` |
Matrix that in its columns contains the sample of each sig2beta_i's posterior distribution after Gibbs sampling. |

`sig2thesample` |
Vector that contains the sample of sig2the's posterior distribution after Gibbs sampling. |

`rhosample` |
Vector that contains the sample of rho's posterior distribution after Gibbs sampling. |

`asample` |
Vector that contains the sample of a's posterior distribution after Gibbs sampling. |

`bsample` |
Vector that contains the sample of b's posterior distribution after Gibbs sampling. |

`msample` |
Vector that contains the sample of the number of groups at each Gibbs sampling iteration. |

`lpml` |
If indlpml = TRUE, lpml contains the value of the LPML of the chosen model. |

`scale` |
Flag that indicates if the time series data were scaled to the [0,1] interval with a linear transformation. This will be taken as an input for the plotting functions. |

Martell-Juarez, D.A. and Nieto-Barajas, L.E.

## Do not run # # data(houses) # tseriescq.out <- tseriescq(houses,maxiter=4000,level=FALSE,trend=TRUE, # seasonality=TRUE,priora=TRUE) # # Make sure that chain convergence is always assessed. Run the following # code to show the cluster and diagnostic plots: data(houses) data(tseriescq.out) attach(tseriescq.out) clusterplots(tseriescq.out,houses) diagplots(tseriescq.out)

[Package *BNPTSclust* version 2.0 Index]