I tried to run the following code from the example(https://cran.r-project.org/web/packages/greta/vignettes/get_started.html)
library(greta)
# data
x <- as_data(iris$Petal.Length)
y <- as_data(iris$Sepal.Length)
# variables and priors
int <- normal(0, 1)
coef <- normal(0, 3)
sd <- student(3, 0, 1, truncation = c(0, Inf))
# operations
mean <- int + coef * x
# likelihood
distribution(y) <- normal(mean, sd)
# defining the model
m <- model(int, coef, sd)
# plotting
plot(m)
# sampling
draws <- mcmc(m, n_samples = 1000)
But I keep getting error “Error in dim(free_state_draws) <- c(1, dim(free_state_draws)) :
invalid first argument” when I try to run the line “draws <- mcmc(m, n_samples = 1000)”
If anyone know how to solve this problem, help would be greatly appreciated.
Thanks!