Skip to contents

Summary method for an object with class 'bfi' created by the MAP.estimation and bfi functions.

Usage

# S3 method for bfi
summary(object,
        cur_mat = FALSE,
        digits = max(3, getOption("digits") - 3),
        ...)

Arguments

object

fitted bfi object.

cur_mat

logical; if TRUE, minus the curvature matrix around the estimated parameters is returned and printed. Default is FALSE.

digits

significant digits in printout.

...

additional arguments affecting the summary produced.

Details

summary.bfi() gives information about the MAP estimates of parameters of the model. It can be used for the bfi objects built by the MAP.estimation and bfi functions.

The output of the summary method shows the details of the model, i.e. formula, family and link function used to specify the generalized linear model, followed by information about the estimates, standard deviations and credible intervals. Information about the log-likelihood posterior and convergence status are also provided.

By default, summary.bfi function does not return (minus) the curvature matrix, but the user can use cur_mat = TRUE to print it.

Value

summary.bfi returns an object of class summary.bfi, a list with the following components:

theta_hat

the component from object. The last element of this vector is the estimate of the dispersion parameter (sigma2) if family = "gaussian". See the MAP.estimation and bfi functions.

A_hat

the component from object. See the MAP.estimation and bfi functions.

sd

the component from object. If family = "gaussian", the last element of this vector is the square root of the estimated dispersion. See the MAP.estimation and bfi functions.

Lambda

the component from object. See the MAP.estimation function.

formula

the component from object. See the MAP.estimation function.

n

the component from object. See the MAP.estimation function.

np

the component from object. See the MAP.estimation function.

family

the component from object. See the MAP.estimation function.

intercept

the component from object. See the MAP.estimation function.

convergence

the component from object. See the MAP.estimation function.

control

the component from object. See the MAP.estimation function.

stratified

the component from object. See the bfi function.

estimate

the estimated regression coefficients, i.e., without the estimate sigma2.

logLikPost

the value of the log-likelihood posterior density evaluated at estimates (theta_hat).

link

the link function only for GLMs, not for the survival family. By default the gaussian family with identity link function and the binomial family with logit link function are used.

dispersion

the estimated variance of the random error, i.e., sigma2. The dispersion is taken as 1 for the binomial family.

CI

a 95% credible interval of the MAP estimates of the parameters.

Author

Hassan Pazira
Maintainer: Hassan Pazira hassan.pazira@radboudumc.nl

See also

Examples

#-------------
# y ~ Gaussian
#-------------
# model assumption:
theta <- c(1, 2, 3, 4, 1.5)  # coefficients and sigma2 = 1.5

#----------------
# Data Simulation
#----------------
n      <- 40
X      <- data.frame(x1=rnorm(n),                     # continuous variable
                     x2=sample(1:3, n, replace=TRUE)) # categorical variable
Xx2_1  <- ifelse(X$x2 == '2', 1, 0)
Xx2_2  <- ifelse(X$x2 == '3', 1, 0)
X$x2   <- as.factor(X$x2)
eta    <- theta[1] + theta[2] * X$x1 + theta[3] * Xx2_1 + theta[4] * Xx2_2
mu     <- gaussian()$linkinv(eta)
y      <- rnorm(n, mu, sd = sqrt(theta[5]))

#----------------
# MAP estimations
#----------------
Lambda <- inv.prior.cov(X, lambda = c(0.1, 0.5), family = "gaussian")
fit    <- MAP.estimation(y, X, family = "gaussian", Lambda)
class(fit)
#> [1] "bfi"

#-------------------------
# Summary of MAP estimates
#-------------------------
summary(fit)
#> 
#> Summary of the local model:
#> 
#>    Formula: y ~ x1 + x2 
#>     Family: ‘gaussian’ 
#>       Link: ‘identity’
#> 
#> Coefficients:
#> 
#>             Estimate Std.Dev CI 2.5% CI 97.5%
#> (Intercept)   0.6120  0.2924  0.0388   1.1851
#> x1            2.3859  0.2266  1.9418   2.8299
#> x22           3.0242  0.4453  2.1515   3.8969
#> x23           4.1666  0.4453  3.2938   5.0395
#> 
#> Dispersion parameter (sigma2):  1.394 
#>             log Lik Posterior:  -57.93 
#>                   Convergence:  0 
sumfit <- summary(fit, cur_mat = TRUE)
#> 
#> Summary of the local model:
#> 
#>    Formula: y ~ x1 + x2 
#>     Family: ‘gaussian’ 
#>       Link: ‘identity’
#> 
#> Coefficients:
#> 
#>             Estimate Std.Dev CI 2.5% CI 97.5%
#> (Intercept)   0.6120  0.2924  0.0388   1.1851
#> x1            2.3859  0.2266  1.9418   2.8299
#> x22           3.0242  0.4453  2.1515   3.8969
#> x23           4.1666  0.4453  3.2938   5.0395
#> 
#> Dispersion parameter (sigma2):  1.394 
#>             log Lik Posterior:  -57.93 
#>                   Convergence:  0 
#> 
#> Minus the Curvature Matrix: 
#> 
#>             (Intercept)      x1     x22     x23  sigma2
#> (Intercept)     28.7976 -2.8568  8.6093  8.6093 -0.1224
#> x1              -2.8568 19.7821 -1.1363 -0.6222 -0.4773
#> x22              8.6093 -1.1363  8.7093  0.0000 -0.6048
#> x23              8.6093 -0.6222  0.0000  8.7093 -0.8334
#> sigma2          -0.1224 -0.4773 -0.6048 -0.8334 82.7875
sumfit$estimate
#> [1] 0.6119685 2.3858594 3.0241837 4.1666148
sumfit$logLikPost
#> [1] -57.93367
sumfit$dispersion
#>   sigma2 
#> 1.393843 
sumfit$CI
#>                  2.5 %   97.5 %
#> (Intercept) 0.03881022 1.185127
#> x1          1.94178969 2.829929
#> x22         2.15149761 3.896870
#> x23         3.29376976 5.039460
class(sumfit)
#> [1] "summary.bfi"