{"id":23509368,"url":"https://github.com/paulnorthrop/rust","last_synced_at":"2026-01-08T03:34:16.659Z","repository":{"id":38434111,"uuid":"70637746","full_name":"paulnorthrop/rust","owner":"paulnorthrop","description":"Ratio-of-Uniforms Simulation with Transformation.","archived":false,"fork":false,"pushed_at":"2024-08-18T08:12:10.000Z","size":55138,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-28T23:06:29.536Z","etag":null,"topics":["1977","bayesian-inference","cran","kinderman","monahan","of","posterior-samples","r","ratio","ratio-of-uniforms","ratio-of-uniforms-method","rcpp","simulation","transformation","uniforms"],"latest_commit_sha":null,"homepage":"https://paulnorthrop.github.io/rust/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulnorthrop.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-11T21:40:46.000Z","updated_at":"2024-08-18T08:12:14.000Z","dependencies_parsed_at":"2024-02-24T13:26:39.080Z","dependency_job_id":"e1d9f6f4-182a-43c1-bf21-ae4372328c01","html_url":"https://github.com/paulnorthrop/rust","commit_stats":{"total_commits":535,"total_committers":1,"mean_commits":535.0,"dds":0.0,"last_synced_commit":"c40c0c6f573ce00d4f94379a63aebd0e2033d3c3"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulnorthrop%2Frust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulnorthrop%2Frust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulnorthrop%2Frust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulnorthrop%2Frust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulnorthrop","download_url":"https://codeload.github.com/paulnorthrop/rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231232503,"owners_count":18344938,"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":["1977","bayesian-inference","cran","kinderman","monahan","of","posterior-samples","r","ratio","ratio-of-uniforms","ratio-of-uniforms-method","rcpp","simulation","transformation","uniforms"],"created_at":"2024-12-25T11:40:33.188Z","updated_at":"2026-01-08T03:34:16.653Z","avatar_url":"https://github.com/paulnorthrop.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n# rust \u003ca href=\"https://paulnorthrop.github.io/rust/\"\u003e\u003cimg src=\"tools/rust_logo.png\" align=\"right\" style=\"float:right; height:150px;\" alt=\"rust logo\"/\u003e\u003c/a\u003e\n\n[![R-CMD-check](https://github.com/paulnorthrop/rust/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/paulnorthrop/rust/actions/workflows/R-CMD-check.yaml)\n[![Coverage Status](https://codecov.io/github/paulnorthrop/rust/coverage.svg?branch=master)](https://app.codecov.io/github/paulnorthrop/rust?branch=master)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/rust)](https://cran.r-project.org/package=rust)\n[![Downloads (monthly)](https://cranlogs.r-pkg.org/badges/rust?color=brightgreen)](https://cran.r-project.org/package=rust)\n[![Downloads (total)](https://cranlogs.r-pkg.org/badges/grand-total/rust?color=brightgreen)](https://cran.r-project.org/package=rust)\n\nSee also [RUSampling](https://pypi.org/project/rusampling/) for a translation of `rust` into Python, courtesy of Lynne Jewson.\n\n## Ratio-of-uniforms simulation with transformation\n\n### What does rust do?\n\nThe `rust` package implements the multivariate generalized ratio-of-uniforms method of simulating random variates from a d-dimensional continuous distribution.  The user specifies (the log of) a positive target function `f` that is proportional to the density function of the distribution.  \n\n### A simple example\n\nWe use the function `ru` to simulate a sample of size 1000 from a two-dimensional standard normal distribution with strong positive correlation between the components.  Of course, this particular example is purely illustrative: there are better ways to simulate from a multivariate normal distribution.\n\n```{r, eval = FALSE}\nrho \u003c- 0.9\ncovmat \u003c- matrix(c(1, rho, rho, 1), 2, 2)\nlog_dmvnorm \u003c- function(x, mean = rep(0, d), sigma = diag(d)) {\n  x \u003c- matrix(x, ncol = length(x))\n  d \u003c- ncol(x)\n  - 0.5 * (x - mean) %*% solve(sigma) %*% t(x - mean)\n}\nx \u003c- ru(logf = log_dmvnorm, sigma = covmat, d = 2, n = 1000, init = c(0, 0))\n```\n\nFrom version 1.2.0 onwards the faster function `ru_rcpp` can be used.  See the vignette \"Rusting Faster: Simulation using Rcpp\" for details.\n\n```{r, eval = FALSE}\n# Create an external pointer to a C++ function to evaluate the log-density.\nptr_bvn \u003c- create_xptr(\"logdnorm2\")\n# Pass the external pointer to `ru_rcpp`.\nx \u003c- ru_rcpp(logf = ptr_bvn, rho = rho, d = 2, n = 1000, init = c(0, 0))\n```\n\n### Installation\n\nTo get the current released version from CRAN:\n\n```{r installation, eval = FALSE}\ninstall.packages(\"rust\")\n```\n\n### Vignettes\n\nSee `vignette(\"rust-a-vignette\", package = \"rust\")` for an overview of the package,\n`vignette(\"rust-b-when-to-use-vignette\", package = \"rust\")` for guidance on when `rust` can be used and `vignette(\"rust-c-using-rcpp-vignette\", package = \"rust\")` for information on how to take advantage of the Rcpp package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulnorthrop%2Frust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulnorthrop%2Frust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulnorthrop%2Frust/lists"}