R
package to load the JAGS
module pexm.
Description: The Piecewise Exponencial (PE) distribution is not available in JAGS
, therefore, many applications in survival analysis assuming a semiparametric modeling based on a piecewise constant hazard must consider a zeros-trick strategy to deal with the MCMC algorithm related to the Bayesian framework. The present R
package provides a JAGS
module containing distribution and related functions for the random variable T ~ PE(lambda, tau), where lambda is the vector of failure rates specified for different intervals in the time scale and tau is the vector defining a grid partitioning the time line related to the application. All details about the PE distribution and the proposed pexm
module can be found in Mayrink et al. (2020).
Authors: Vinícius D. Mayrink, João D. N. Duarte and Fábio N. Demarqui.
Departamento de Estatística, ICEx, Universidade Federal de Minas Gerais, Av. Antônio Carlos, 6627, Belo Horizonte, MG, Brazil, 31270-901.pexm
is open for free access in
In order to build this package, some scripts from the R
packages runjags
and rjags
were considered as examples. The source code of pexm
may also be used as a template to build other R
packages introducing new JAGS modules. Some knowledge of R
and C++
programming languanges are necessary to work through the details.
The package can be installed (“Unix or Windows”) from CRAN applying the command install.packages(“pexm”)
in the R
console. In addition, the installation from GitHub can be done via devtools::install_github(“vdinizm/pexm”)
. Note that the R
package devtools
is required for this task.
Alternatively, the Sourceforge repository contains the package sources pexm_1.0.0.tar.gz
for both Unix or Windows. The user must download and install it via install.packages(path_to_file, repos = NULL, type=“source”)
, where path_to_file
should be replaced by the path pointing to the target tar.gz
.
Instructions: Before installing the package pexm
, as indicated above, the user must first install a recent version of JAGS
in the computer. For those using the Windows system, the current recommended version is JAGS-4.3.0
. If using a different version, the variable JAGS_ROOT
, defined in the file Makevars.win
(within the directory src
of the source code), must be adapted with the correct numerical indication of version. In an Unix system, this modification is supposed to be automatic. The present package has the following dependencies on other R
packages:
rjags
providing tools to load a JAGS
module and to compile and run a Bayesian model implemented in JAGS
.
msm
providing tools to work with the PE distribution in R
(important to run some comparison examples).
pexm
was succesfully installed in R
, the user is expected to load the package in the console via libary(“pexm”)
and then load the module using loadpexm()
. The message “module pexm loaded”
will be displayed when the module is ready to use. Since one might choose a non-standard location to save the pexm
package library, an error indication may appear in the console when the function loadpexm()
is not able to locate the key files pexm.so
(Unix) or pexm.dll
(Windows). In this situation, the user can manually set the path to the target directory containing one of these key files by using loadpexm(“file_path”)
, where file_path
should be replaced by a quoted path found by the user.