| summary.rGamma_reg | R Documentation |
These functions are all methods for class rGamma_reg or summary.rGamma_reg objects.
## S3 method for class 'rGamma_reg'
summary(object, ...)
## S3 method for class 'summary.rGamma_reg'
print(x, digits = max(3, getOption("digits") - 3), ...)
object |
an object of class |
x |
an object of class |
digits |
the number of significant digits to use when printing. |
... |
Additional optional arguments |
summary.rGamma_reg() returns an object of class
"summary.rGamma_reg", a list containing summaries of posterior
draws for the dispersion and precision parameters. Components include:
call |
the matched call from the fitted object. |
n |
number of posterior draws. |
coefficients1 |
matrix of prior means and standard deviations for precision and dispersion. |
coefficients |
matrix of posterior means, posterior standard deviations, Monte Carlo errors, and empirical tail probabilities. |
Percentiles |
matrix of posterior percentiles for dispersion draws. |
implied_disp_point |
dispersion point estimate implied by the Gamma
prior on precision, computed as |
print.summary.rGamma_reg() prints the summary object and returns
x invisibly.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.