Nothing
## summary.rGamma_reg: dGamma prior (dispersion-only; coefficients fixed)
## All five functions (rGamma_reg, rglmb, rlmb, glmb, lmb) use summary.rGamma_reg when
## prior is dGamma.
##
## This example uses the Boston data: Prior_Setup() for hyperparameters and
## ps$coefficients as fixed beta for dGamma / rGamma_reg-style runs.
data("Boston", package = "MASS")
predictors <- setdiff(names(Boston), "medv")
Boston_centered <- Boston
Boston_centered[predictors] <- scale(Boston[predictors], center = TRUE, scale = FALSE)
form <- medv ~
crim + zn +
indus + chas + nox + age + dis + rad + tax + ptratio + black + lstat + rm
ps.boston <- Prior_Setup(form, gaussian(), data = Boston_centered)
rate_dg <- if (!is.null(ps.boston$rate_gamma)) ps.boston$rate_gamma else ps.boston$rate
y <- ps.boston$y
x <- as.matrix(ps.boston$x)
wt <- rep(1, length(y))
## 1. rGamma_reg
out1 <- rGamma_reg(
n = 1000,
y = y,
x = x,
prior_list = list(beta = ps.boston$coefficients, shape = ps.boston$shape, rate = rate_dg),
offset = rep(0, length(y)),
weights = wt,
family = gaussian()
)
summary(out1)
## 2. rglmb
out2 <- rglmb(n = 1000, y = y, x = x,
pfamily = dGamma(shape = ps.boston$shape, rate = rate_dg, beta = ps.boston$coefficients),
weights = wt, family = gaussian())
summary(out2)
## 3. rlmb
out3 <- rlmb(n = 1000, y = y, x = x,
pfamily = dGamma(shape = ps.boston$shape, rate = rate_dg, beta = ps.boston$coefficients),
weights = wt)
summary(out3)
## 4. glmb
out4 <- glmb(form, data = Boston_centered, family = gaussian(),
pfamily = dGamma(shape = ps.boston$shape, rate = rate_dg, beta = ps.boston$coefficients))
summary(out4)
## 5. lmb
out5 <- lmb(form, data = Boston_centered,
pfamily = dGamma(shape = ps.boston$shape, rate = rate_dg, beta = ps.boston$coefficients))
summary(out5)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.