greta-dev / greta-dev/greta

calculate doesn't work on data array?

Open
#520 1 comment 0 reactions 0 assignees View on GitHub
documentation
Dominant language
C++
Stars
607
Forks
67
Avg merge
3d 8h
Merged PRs (30d)
1

Description

Hi, I wish to simulate observations after fitting a greta model with mixture likelihood, but couldn't get it to work. Below is the example in `?mixture`. I only modified the first line with `as_data` to be able to use `calculate` on `x`. Perhaps I missed something?

```
library(greta)

x <- as_data(c(
rpois(800, 3),
rpois(200, 10)
))

weights <- uniform(0, 1, dim = 2)
rates <- normal(0, 10, truncation = c(0, Inf), dim = 2)
distribution(x) <- mixture(poisson(rates[1]),
poisson(rates[2]),
weights = weights
)
m <- model(rates)
draws_rates <- mcmc(m, n_samples = 500)

calculate(x, values = draws_rates, nsim = 1) # will fail with error
```

Thanks in advance!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.