Description Usage Arguments Details Value Author(s) Examples

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

1 2 3 4 5 6 | ```
tseriescq(data, maxiter = 1000, burnin = floor(0.1 * maxiter),
thinning = 5, level = FALSE, trend = TRUE, seasonality = TRUE,
deg = 2,c0eps = 2, c1eps = 1, c0beta = 2, c1beta = 1,
c0alpha = 2,c1alpha = 1, priora = FALSE, pia = 0.5, q0a = 1,
q1a = 1,priorb = FALSE, 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. |

`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. |

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ```
## Do not run
#
# data(houses)
# tseriescq.out <- tseriescq(houses,maxiter=4000,level=FALSE,trend=TRUE,
# seasonality=TRUE,priora=TRUE)
#
# The console output of the above example is:
#
# Number of groups of the chosen cluster configuration : 9
# Time series in group 1 : 1
# Time series in group 2 : 2 3 4 5 6 7 9 10 11 12 13 15 16 17 18 19 20 21 # 25 26 27 29 30 31 33
# Time series in group 3 : 8 23
# Time series in group 4 : 14
# Time series in group 5 : 22
# Time series in group 6 : 24
# Time series in group 7 : 28
# Time series in group 8 : 32
# Time series in group 9 : 34
# HM Measure : 126.9543
#
# 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)
``` |

```
Loading required package: mvtnorm
Loading required package: MASS
```

BNPTSclust documentation built on May 30, 2017, 6:09 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.