test_that("rmse works as it should", {
check_tf_version <- greta::.internals$checks$check_tf_version
skip_if_not(check_tf_version())
set.seed(1234)
intercept <- normal(0, 1)
slope <- normal(0, 1)
sd_resid <- cauchy(0, 1, truncation = c(0, 100))
x <- runif(100)
y <- as_data(rnorm(100, 1 + 2 * x, 1))
linpred <- intercept + slope * x
distribution(y) <- normal(linpred, sd_resid)
m <- model(intercept, slope, sd_resid)
drr <- mcmc(m)
# results
expect_error(rmse(y, linpred, drr), NA)
expect_error(rmse(y, linpred, drr, norm = TRUE), NA)
# compare
#expect_equal(round(r2[,1], 2), 0.02)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.