Linear regression

A simple, one-variable Bayesian linear regression model using the attitude data

# variables & priors
int <- normal(0, 10)
coef <- normal(0, 10)
sd <- cauchy(0, 3, truncation = c(0, Inf))

# linear predictor
mu <- int + coef * attitude$complaints

# observation model
distribution(attitude$rating) <- normal(mu, sd)


greta-dev/greta documentation built on Dec. 21, 2024, 5:03 a.m.