bayesglm.fit {BAS} | R Documentation |
A version of glm.fit rewritten in C; also returns marginal likelihoods for Bayesian model comparison
bayesglm.fit(
x,
y,
weights = rep(1, nobs),
start = NULL,
etastart = NULL,
mustart = NULL,
offset = rep(0, nobs),
family = binomial(),
coefprior = bic.prior(nobs),
control = glm.control(),
intercept = TRUE
)
x |
design matrix |
y |
response |
weights |
optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector. |
start |
starting value for coefficients in the linear predictor |
etastart |
starting values for the linear predictor |
mustart |
starting values for the vectors of means |
offset |
a priori known component to be included in the linear predictor |
family |
a description of the error distribution and link function for exponential family; currently only binomial() and poisson() with canonical links are implemented. |
coefprior |
function specifying prior distribution on coefficients with
optional hyperparameters leading to marginal likelihood calculations;
options include |
control |
a list of parameters that control convergence in the fitting
process. See the documentation for |
intercept |
should an intercept be included in the null model? |
C version of glm-fit. For different prior choices returns, marginal likelihood of model using a Laplace approximation.
coefficients |
MLEs |
se |
Standard errors of coefficients based on the sqrt of the diagonal of the inverse information matrix |
mu |
fitted mean |
rank |
numeric rank of the fitted linear model |
deviance |
minus twice the log likelihood evaluated at the MLEs |
g |
value of g in g-priors |
shrinkage |
shrinkage factor for coefficients in linear predictor |
RegSS |
quadratic form beta'I(beta)beta used in shrinkage |
logmarglik |
the log marginal or integrated log likelihood (up to a constant) |
Merlise Clyde translated the glm.fit
from R base into
C using the .Call interface
data(Pima.tr, package="MASS")
Y <- as.numeric(Pima.tr$type) - 1
X <- cbind(1, as.matrix(Pima.tr[,1:7]))
out <- bayesglm.fit(X, Y, family=binomial(),coefprior=bic.prior(n=length(Y)))
out$coef
out$se
# using built in function
glm(type ~ ., family=binomial(), data=Pima.tr)