{"id":15165871,"url":"https://github.com/dlsaavedra/rcens","last_synced_at":"2025-10-25T08:30:24.139Z","repository":{"id":212360304,"uuid":"730905381","full_name":"dlsaavedra/rcens","owner":"dlsaavedra","description":"The \"rcens\" package provides functions to generate censored samples of type I,  II and III, from any random sample generator. It also provides the option to create left and right censorship. Along with this, the generation of samples with interval censoring is in the  testing phase. With two options of fixed length intervals and random lengths.","archived":false,"fork":false,"pushed_at":"2024-03-27T19:19:29.000Z","size":1964,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-11T17:41:15.187Z","etag":null,"topics":["censored-data","r","simulation","statistics"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/dlsaavedra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-12T23:49:07.000Z","updated_at":"2024-01-09T20:16:26.000Z","dependencies_parsed_at":"2024-03-19T22:22:46.358Z","dependency_job_id":"fa15ab7b-a774-4b14-835f-476a2cdfaab8","html_url":"https://github.com/dlsaavedra/rcens","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"c233bd0592c72f60717935468ed1f2c804ef7c94"},"previous_names":["dlsaavedra/rcens"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlsaavedra%2Frcens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlsaavedra%2Frcens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlsaavedra%2Frcens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlsaavedra%2Frcens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dlsaavedra","download_url":"https://codeload.github.com/dlsaavedra/rcens/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219866281,"owners_count":16555908,"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","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":["censored-data","r","simulation","statistics"],"created_at":"2024-09-27T04:05:27.298Z","updated_at":"2025-10-25T08:30:23.728Z","avatar_url":"https://github.com/dlsaavedra.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rcens Package\n\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fdlsaavedra%2Frcens\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=rstudio.svg\u0026icon_color=%23FFFFFF\u0026title=Views\u0026edge_flat=true)](https://hits.seeyoufarm.com)\n\nThis package provides functions to generate censored samples of type I, II and III, from any random sample generator. It also provides the option to create left and right censorship Along with this, the generation of samples with interval censoring is in the testing phase. With two options of fixed length intervals and random lengths.\n\n## Installation\n\nYou can install [rcens](https://CRAN.R-project.org/package=rcens) from CRAN via:\n\n``` r\ninstall.packages(\"rcens\")\n```\n\nOr install the latest development version (on GitHub) via `{devtools}`:\n\n``` r\ndevtools::install_github(\"dlsaavedra/rcens\")\n```\n\n## Getting Started\n\nCreate easily a new censored data set establishment the percentage of censoring and the original distribution of random variable.\n\n### Right Censored Data, type III (Random)\n\nIn this example create a right censored data type III and fit Kaplan Meier (survival library).\n\n``` r\n#Example Exponential - Uniform\n\ndevtools::install_github(\"dlsaavedra/rcens\")\nlibrary(rcens)\nlibrary(survival)\n\nData = rcensT3(rdistrX = rexp, pdistrC = punif, rdistrC = runif,\n                 param_X = list(\"rate\" = 2),\n                 param_C = list(\"min\" = 0, \"max\" = \"lambda\"),\n                 n = 1e02, theta = .5, right = TRUE)\n\nS = Surv(Data$sample_censored,Data$censored_indicator, type = \"right\")\ns1 = survfit(S ~ 1)\n\nCDF_censored = ecdf(Data$sample_censored)\nSurvival_CDF = Vectorize(function(x){ 1 - CDF_censored(x)})\nCDF_original= ecdf(Data$sample_uncensored)\nSurvival_CDF_original = Vectorize(function(x){ 1 - CDF_original(x)})\n\nplot(Survival_CDF, col = \"blue\", xlim = c(0,2))\ntitle(\"Survival Curve\")\nplot(Survival_CDF_original, col = \"red\", add= TRUE, xlim = c(0,2))\nlines(s1$time, s1$surv, col = \"green\", xlim = c(0,2))\nlegend(\"topright\",c(\"original\",\"censured\", \"Survival_KM\"),\n       col = c(\"red\", \"blue\", \"green\"), lty = 1)\n```\n\n![\u003chttps://github.com/dlsaavedra/rcens/blob/main/image/Survival_Curve_Example_rcensT3.png\u003e](https://github.com/dlsaavedra/rcens/blob/main/image/Survival_Curve_Example_rcensT3.png)\n\n### Other Examples\n\nIn the folder [examples_plot](https://github.com/dlsaavedra/rcens/tree/main/examples_plot) you can find example for each function in this packages.\n\n## Citation\n\nTo cite `rcens` in publication use:\n\nSaavedra D, Ramos PL (2024). *rcens: Generate Sample Censoring*. R package version 0.1.0, \u003chttps://github.com/dlsaavedra/rcens\u003e.\n\nA BibTeX entry for LaTeX users is:\n\n``` bibtex\n  @Manual{,\n    title = {rcens: Generate Sample Censoring},\n    author = {Daniel Saavedra and Pedro L Ramos},\n    year = {2024},\n    note = {R package version 0.1.1},\n    url = {https://github.com/dlsaavedra/rcens},\n  }\n```\n\n## Future Work\n\nWe are currently working to generate data with interval right censoring, both with fixed and random interval length. Soon we will propose a function to generate data with double interval censoring. All this while maintaining the possibility of using any distribution for the original data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlsaavedra%2Frcens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdlsaavedra%2Frcens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlsaavedra%2Frcens/lists"}