{"id":14068965,"url":"https://github.com/kasaai/simulationmachine","last_synced_at":"2025-07-30T05:30:43.751Z","repository":{"id":89957958,"uuid":"203238906","full_name":"kasaai/simulationmachine","owner":"kasaai","description":"Individual claims history simulation machine","archived":false,"fork":false,"pushed_at":"2019-09-25T04:40:50.000Z","size":394,"stargazers_count":19,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-04T10:38:43.841Z","etag":null,"topics":["actuarial-science","neural-networks","reserving","rstats","simulation"],"latest_commit_sha":null,"homepage":"https://blog.kasa.ai/posts/simulation-machine/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kasaai.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-08-19T19:41:59.000Z","updated_at":"2024-01-08T12:28:32.000Z","dependencies_parsed_at":"2023-03-02T22:45:13.539Z","dependency_job_id":null,"html_url":"https://github.com/kasaai/simulationmachine","commit_stats":{"total_commits":54,"total_committers":1,"mean_commits":54.0,"dds":0.0,"last_synced_commit":"0faf07e44fa41621f93b39cdf62039a330e91b21"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kasaai/simulationmachine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fsimulationmachine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fsimulationmachine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fsimulationmachine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fsimulationmachine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kasaai","download_url":"https://codeload.github.com/kasaai/simulationmachine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fsimulationmachine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267815187,"owners_count":24148356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actuarial-science","neural-networks","reserving","rstats","simulation"],"created_at":"2024-08-13T07:06:30.750Z","updated_at":"2025-07-30T05:30:43.310Z","avatar_url":"https://github.com/kasaai.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n# simulationmachine\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n[![Travis build status](https://travis-ci.org/kasaai/simulationmachine.svg?branch=master)](https://travis-ci.org/kasaai/simulationmachine)\n\u003c!-- badges: end --\u003e\n\nThis package implements the claims history simulation algorithm detailed in [*An Individual Claims History Simulation Machine*](https://www.mdpi.com/2227-9091/6/2/29) by Andrea Gabrielli and Mario V. Wüthrich. The goal is to provide an easy-to-use interface for generating claims data that can be used for loss reserving research.\n\n## Installation\n\nYou can install the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"kasaai/simulationmachine\")\n```\n## Example\n\nFirst, we can specify the parameters of a simulation using `simulation_machine()`:\n\n```{r}\nlibrary(simulationmachine)\n\ncharm \u003c- simulation_machine(\n  num_claims = 50000, \n  lob_distribution = c(0.25, 0.25, 0.30, 0.20), \n  inflation = c(0.01, 0.01, 0.01, 0.01), \n  sd_claim = 0.85, \n  sd_recovery = 0.85\n)\n\ncharm\n```\n\nOnce we have the charm object, we can use `conjure()` to perform the simulation.\n\n```{r, message=FALSE}\nlibrary(dplyr)\nrecords \u003c- conjure(charm, seed = 100)\nglimpse(records)\n```\n\nLet's see how many claims we drew:\n\n```{r}\nrecords %\u003e% \n  distinct(claim_id) %\u003e% \n  count()\n```\n\nIf you prefer to have each row of the dataset to correspond to a claim, you can simply pivot the data with tidyr:\n\n```{r}\nrecords_wide \u003c- records %\u003e% \n  tidyr::pivot_wider(\n    names_from = development_year, \n    values_from = c(paid_loss, claim_status_open),\n    values_fill = list(paid_loss = 0)\n  )\n\nglimpse(records_wide)\n````\n\n-----\n\nPlease note that this project is released with a [Contributor Code of Conduct](https://github.com/kasaai/community/blob/master/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasaai%2Fsimulationmachine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkasaai%2Fsimulationmachine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasaai%2Fsimulationmachine/lists"}