Censored Distributions for 'greta'

Provides additional censored distributions for use with 'greta', a probabilistic programming framework for Bayesian modeling. Includes censored versions of Normal, Log-Normal, Student's T, Gamma, Exponential, Weibull, Pareto, and Beta distributions with support for right, left, and interval censoring. For details on 'greta', see Golding (2019) . The methods are implemented using 'TensorFlow' and 'TensorFlow Probability' for efficient computation.


greta.censored: Censored Distributions for greta

Codecov testcoverage R-CMD-check

Overview

greta.censored is an R package that extends greta to support the following distributions with right, left, and interval censoring:

  • Normal
  • Log-Normal
  • Student’s T
  • Gamma
  • Exponential
  • Weibull
  • Pareto
  • Beta.

Installation

You can install the development version of greta.censored from GitHub with:

# install.packages("devtools")
devtools::install_github("mtwesley/greta.censored")

Usage

Here are some examples demonstrating how to use the main functions of the greta.censored package:

Example 1: Censored Normal Distribution

library(greta)
library(greta.censored)

# Define the parameters
mean <- as.greta_array(0)
sd <- as.greta_array(1)
is_censored <- as.greta_array(c(0, 1, 0))
censor <- "right"
lower <- -Inf
upper <- 1

# Create the censored normal distribution
dist <- normal_censored(mean, sd, is_censored, censor, lower, upper)

# Print the distribution
print(dist)

Example 2: Censored Log-Normal Distribution

library(greta)
library(greta.censored)

# Define the parameters
meanlog <- as.greta_array(0)
sdlog <- as.greta_array(1)
is_censored <- as.greta_array(c(0, 1, 0))
censor <- "left"
lower <- 0
upper <- Inf

# Create the censored log-normal distribution
dist <- lognormal_censored(meanlog, sdlog, is_censored, censor, lower, upper)

# Print the distribution
print(dist)

Code of Conduct

Please note that the greta.censored project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

Citation

If you use the greta.censored package in your research, please cite it as follows:

greta.censored: Censored Distributions for greta. R package version 0.1.0. https://github.com/mtwesley/greta.censored

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("greta.censored")

0.1.0 by Mlen-Too Wesley, 2 years ago


https://github.com/mtwesley/greta.censored


Report a bug at https://github.com/mtwesley/greta.censored/issues


Browse source code at https://github.com/cran/greta.censored


Authors: Mlen-Too Wesley [aut, cre]


Documentation:   PDF Manual  


Apache License 2.0 license


Imports glue, reticulate, tensorflow

Depends on greta

Suggests devtools, VGAM, knitr, rmarkdown, testthat, roxygen2, styler, pkgdown

System requirements: Python (>= 3.7.0) with header files and shared library; TensorFlow (>= v2.0.0; https://www.tensorflow.org/); TensorFlow Probability (v0.8.0; https://www.tensorflow.org/probability/)


See at CRAN