Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.8%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 4
  • Releases: 0
Created over 3 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  message = FALSE,
  warning = FALSE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# lnmixsurv



[![Lifecycle: stable](https://lifecycle.r-lib.org/articles/figures/lifecycle-stable.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) [![R-CMD-check](https://github.com/vivianalobo/lnmixsurv/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/vivianalobo/lnmixsurv/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/gitlab/victorsney/lnmixsurv/branch/master/graph/badge.svg?token=HU74ZZQ7MD)](https://app.codecov.io/gitlab/victorsney/lnmixsurv)


The `lnmixsurv` package provides an easy interface to the Bayesian lognormal mixture model proposed by [Lobo, Fonseca and Alves, 2023](https://www.cambridge.org/core/journals/annals-of-actuarial-science/article/abs/lapse-risk-modeling-in-insurance-a-bayesian-mixture-approach/EDA511D313959D9A4040C51289A29B4A).

An usual formula-type model is implemented in `survival_ln_mixture`, with the usual `suvival::Surv()` interface. The model tries to follow the [conventions for R modeling packages](https://tidymodels.github.io/model-implementation-principles/), and uses the [hardhat](https://hardhat.tidymodels.org/) structure.

The underlying algorithm implementation is a Gibbs sampler which takes initial values from a small run of the EM-Algorithm, with initial values selection based on the log-likelihood. Besides the Bayesian approach, the Expectation-Maximization approach (which focus on maximizing the likelihood) for censored data is also available. The methods are implemented in `C++` using `RcppArmadillo` for the linear algebra operations, `RcppGSL` for the random number generation and seed control and `RcppParallel` (since version 3.0.0) for parallelization.

## Dependencies

The only dependency is on GSL, so, make sure you have [GSL](https://www.gnu.org/software/gsl/) installed before proceeding Below, there are some basic guides on how to install these for each operational system other than Windows (Windows users are probably fine and ready to go).

### Mac OS

Run `brew install gsl` at the console/terminal should be enough for installing GSL.

### Linux

The installation of GSL on Linux is distro-specific. For the main distros out-there:

- Arch: `sudo pacman -S gsl`
- CentOS/RHEL: `sudo yum install gsl-devel` or `sudo dnf install gsl-devel` (make sure the EPEL -- Extra Packages for Enterprise Linux -- repository is enabled)
- Debian/Ubuntu: `sudo apt-get install libgsl-dev`
- Fedora: `sudo dnf install gsl-devel`
- Gentoo: `sudo emerge sci-libs/gsl`
- openSUSE: `sudo zypper install gsl-devel`

## Installation

You can install the latest development version of `lnmixsurv` from [GitHub](https://github.com/):

``` r
# install.packages("devtools")
devtools::install_github("vivianalobo/lnmixsurv")
```

Alternatively, to install the latest development version of `lnmixsurv`, you can use the following code:

```r
# install.packages("devtools")
devtools::install_github("vivianalobo/lnmixsurv", "devel")
```

## parsnip and censored extension

An extension to the models defined by [parsnip](https://parsnip.tidymodels.org/index.html) and [censored](https://censored.tidymodels.org/articles/examples.html) is also provided, adding the `survival_ln_mixture` engine to the `parsnip::survival_reg()` model.

The following models, engines, and prediction type are available/extended through `persistencia`:

```{r, echo=FALSE, message=FALSE}
library(censored)
library(dplyr)
library(purrr)
library(tidyr)
library(lnmixsurv)

yep <- cli::symbol$tick
nope <- cli::symbol$cross
mod_names <- get_from_env("models")
model_info <-
  map_dfr(mod_names, ~ get_from_env(paste0(.x, "_predict")) %>% mutate(model = .x)) %>%
  select(model, engine, mode, type)
pkg_info <-
  map_dfr(mod_names, ~ get_from_env(paste0(.x, "_pkgs")) %>% mutate(model = .x)) %>%
  select(model, engine, pkg) %>%
  unnest(cols = pkg) %>%
  filter(pkg == "lnmixsurv") %>%
  select(!pkg)

model_info %>%
  filter(mode == "censored regression") %>%
  select(model, engine, mode, type) %>%
  pivot_wider(
    names_from = type,
    values_from = mode,
    values_fill = nope,
    values_fn = function(x) yep
  ) %>%
  inner_join(pkg_info, by = c("model", "engine")) %>%
  knitr::kable()
```

Owner

  • Login: vivianalobo
  • Kind: user

GitHub Events

Total
  • Push event: 6
  • Pull request event: 2
  • Fork event: 1
Last Year
  • Push event: 6
  • Pull request event: 2
  • Fork event: 1

Packages

  • Total packages: 1
  • Total downloads:
    • cran 216 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: lnmixsurv

Bayesian Mixture Log-Normal Survival Model

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 216 Last month
Rankings
Dependent packages count: 28.3%
Dependent repos count: 34.9%
Average: 50.0%
Downloads: 86.7%
Maintainers (1)
Last synced: 12 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • parsnip >= 1.1.0 depends
  • survival * depends
  • Rcpp * imports
  • abind * imports
  • dplyr * imports
  • generics * imports
  • glue * imports
  • hardhat >= 1.3.0 imports
  • posterior * imports
  • purrr * imports
  • rlang * imports
  • stats * imports
  • tibble * imports
  • bayesplot * suggests
  • censored >= 0.2.0 suggests
  • covr * suggests
  • ggplot2 * suggests
  • ggsurvfit * suggests
  • knitr * suggests
  • parallel * suggests
  • pec * suggests
  • rmarkdown * suggests
  • rstanarm * suggests
  • testthat >= 3.0.0 suggests
  • tidymodels * suggests
  • tidyr * suggests
  • truncnorm * suggests
  • withr * suggests