greta-dev / greta-dev/greta

weird error message when trying to initialise a simplex

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

Description

Different than #748, here we get an R error message about a missing function when try to set initial values *for* a simplex variable, rather than another object in a model that also contains a simplex variable.

Maybe both issues relate to there not being a function to map back from simplex variables to an appropriate free state?

``` r
library(greta)
#>
#> Attaching package: 'greta'
#> The following objects are masked from 'package:stats':
#>
#> binomial, cov2cor, poisson
#> The following objects are masked from 'package:base':
#>
#> %*%, apply, backsolve, beta, chol2inv, colMeans, colSums, diag,
#> eigen, forwardsolve, gamma, identity, rowMeans, rowSums, sweep,
#> tapply
x <- simplex_variable(3)
y <- normal(0, 1)
#> ℹ Initialising python and checking dependencies, this may take a moment.
#> ✔ Initialising python and checking dependencies ... done!
#>
z <- x * y
m <- model(z)
inits <- initials(x = t(c(0.1, 0.2, 0.7)))
mcmc(m, initial_values = inits)
#> Only one set of initial values was provided, and was used for all chains
#> Error in fun(data): could not find function "fun"
```

Created on 2024-11-12 with [reprex v2.0.2](https://reprex.tidyverse.org)

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.