Bayesian model-based clustering for longitudinal ordinal data
Computer scripts to reproduce simulation in Costilla et al 2019
This repository contains the R and C++ binary files to reproduce results presented in Table 2 (section 3.4 Model validation using simulated data). C++ source files are also included for convenience. Scripts run in Linux, Windows and Mac OS X (x86-64, i.e. 64 bits versions).
A brief description of these files can be found below.
R scripts
-
pomtc.sim.r Simulates data, estimates the model using a Metropolis-Hastings sampler, and relabels MCMC chains.
-
functions.pomtc.r Functions to perform all above taks, including loading C++ binaries.
C++ files
Binaries, x86-64 versions
-
Linux: theta.pomtc.so, Zrc_tt.so
-
Windows: theta.pomtc.dll, Zrc_tt.dll
-
Mac OS X: theta.pomtc.macosx.so, Zrc_tt.macosx.so
Source files
-
theta.pomtc.cpp. Calculates cell probabilities given parameters mu, alpha, beta, and gamma.
-
Zrc_tt.cpp. Numerator for z_ig in logs. Used to compute likelihood as a function of theta, pi, and the data.
Running instructions
To run the simulation please:
- Download or clone the git repository. Uncompress it to your local computer.
- Run “pomtc.sim.r” within R. Note that you need to access to several R libraries.
- Table 2 contents will be saved as a csv file.
For the simulation in the paper (n=1000, p=15, q=5, R=3) programs take about an hour to run using R 3.3.3 in a Xeon E5-2680 2.50GHz CPU. Depending on your computer specifications this time might vary. Running time includes simulating the data, estimating the model using 3 MCMC chains and relabeling. In addition to that, traceplots for the original and relabelled chains are also produced and the R session saved. The complete output is available here in R markdown format.
References
Costilla, Liu, Arnold, and Fernandez (2019). Bayesian model-based clustering for longitudinal ordinal data. Computational Statistics. https://doi.org/10.1007/s00180-019-00872-4
Comments/questions to
Roy Costilla
PhD Statistics
Institute for Molecular Biosciences and Queensland Alliance for Agriculture and Food Innovation. University of Queensland. Brisbane. Australia.
r.costilla@uq.edu.au
https://www.researchgate.net/profile/Roy_Costilla
https://twitter.com/CmRoycostilla