https://github.com/jeffreypullin/rgreta
Simple simulation of greta models
https://github.com/jeffreypullin/rgreta
Last synced: 10 months ago
JSON representation
Simple simulation of greta models
- Host: GitHub
- URL: https://github.com/jeffreypullin/rgreta
- Owner: jeffreypullin
- Created: 2019-02-18T07:20:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-18T07:38:03.000Z (over 7 years ago)
- Last Synced: 2025-01-29T18:11:18.453Z (over 1 year ago)
- Language: R
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# rgreta
**rgreta** provides support for simple simulation of models defined in the
**greta** modelling language/R package
## Usage
Define a simple example greta model:
```{r, message=FALSE}
library(greta)
int <- normal(0, 10)
coef <- normal(0, 10)
sd <- cauchy(0, 3, truncation = c(0, Inf))
mu <- int + coef * attitude$complaints
distribution(attitude$rating) <- normal(mu, sd)
m <- model(int, coef, sd)
```
We can then simulate from the model:
```{r, message=FALSE}
library(rgreta)
simulations <- simulate(m)
head(simulations)
```
Or we can simulate setting parameters to certain values
```{r}
simulations <- simulate(m, list(int = 1, coef = 1, sd = 1))
head(simulations)
```
## Install
```{r, eval=FALSE}
devtools::install_github("Voltemand/rgreta")
```
## TODO
**rgreta** is very much still a work in progress. The current feature/idea list
is:
* Support for more distibutions and operations - currently rgreta only supports
the normal and cauchy distributions and addition and multiplication operations
* Seed passing
* A way to pass simulated data back to models
* Support for tensorflow probability distibutions samplers
* Returning of simulated parameters