mixture() doesn't work with single-column arrays
- Dominant language
- C++
- Stars
- 607
- Forks
- 67
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 1
Description
Hi there, sorry for submitting so many issues lately, but I'm really trying to squeeze a lot from `greta` now!
I'm playing around with `mixture()`. One of the examples in `?mixture` is
```
# weights can also be an array, giving different mixing weights
# for each observation (first dimension must be number of components)
dim <- c(5, 4)
weights <- uniform(0, 1, dim = c(2, dim))
b <- mixture(normal(1, 1, dim = dim),
normal(-1, 1, dim = dim),
weights = weights
)
```
I'm trying to mix two distributions that are single-column arrays, but in an attempt to try `dim <- c(5, 1)` it throws an error:
```
> dim <- c(5, 1)
> weights <- uniform(0, 1, dim = c(2, dim))
> b <- mixture(normal(1, 1, dim = dim),
+ normal(-1, 1, dim = dim),
+ weights = weights
+ )
Error: the dimension of weights must be either "\033[34m2\033[39mx1" or
"\033[34m2\033[39mx\033[34m\"5x1\"\033[39m"
but was "2x5x1"
```
Curiously, `dim <- c(1, 5)` works... did I miss something?
Contributor guide
Assessment
This issue has not been assessed yet.