Learn R Programming

Rgbp (version 1.1.4)

print.gbp: Displaying 'gbp' Class

Description

print.gbp enables users to see a compact group-level (unit-level) estimation result of gbp function.

Usage

# S3 method for gbp
print(x, sort = TRUE, ...)

Arguments

x

a resultant object of gbp function.

sort

TRUE or FALSE flag. If TRUE, the result will appear by the order of se for Gaussian, or of n for Binomial and Poisson data. If FALSE, it will do by the order of data input. Default is TRUE.

...

further arguments passed to other methods.

Value

print(gbp.object) will display:

obs.mean

sample mean of each group

se

if Gaussian data, standard error of each group

n

if Binomial or Poisson data, total number of trials of each group

X

a covariate vector or matrix if designated. NA if not

prior.mean

numeric if entered, NA if not entered

prior.mean.hat

estimate of prior mean by a regression if prior mean is not assigned a priori. The variable name on the display will be "prior.mean"

prior.mean.AR

the posterior mean(s) of the expected random effects, if the acceptance-rejection method is used for the binomial model. The variable name on the display will be "prior.mean".

shrinkage

shrinkage estimate of each group (adjusted posterior mean)

shrinkage.AR

the posterior mean of the shrinkage factor, if the acceptance-rejection method is used for the binomial model. The variable name on the display will be "shrinkage".

low.intv

lower bound of 100*confidence.lvl% posterior interval

post.mean

posterior mean of each group

upp.intv

upper bound of 100*confidence.lvl% posterior interval

post.sd

posterior standard deviation of each group

Details

As for the argument x, if the result of gbp is designated to b like "b <- gbp(z, n, model = "binomial")", the argument x is supposed to be b.

We do not need to type "print(b, sort = TRUE)" but "b" itself is enough to call print(b, sort = TRUE). But if we want to see the result NOT sorted by the order of se for Gaussian, or of n for Binomial and Poisson data, print(b, sort = FALSE) will show the result by the order of data input.

Examples

Run this code
# NOT RUN {
  data(hospital)

  z <- hospital$d
  n <- hospital$n
  y <- hospital$y
  se <- hospital$se
  
  ###################################################################################
  # We do not have any covariates and do not know a mean of the prior distribution. #
  ###################################################################################

    ###############################################################
    # Gaussian Regression Interactive Multilevel Modeling (GRIMM) #
    ###############################################################

    g <- gbp(y, se, model = "gaussian")
    g
    print(g, sort = FALSE)

    ###############################################################
    # Binomial Regression Interactive Multilevel Modeling (BRIMM) #
    ###############################################################

    b <- gbp(z, n, model = "binomial")
    b
    print(b, sort = FALSE)

    ##############################################################
    # Poisson Regression Interactive Multilevel Modeling (PRIMM) #
    ##############################################################

    p <- gbp(z, n, mean.PriorDist = 0.03, model = "poisson")
    p
    print(p, sort = FALSE)

# }

Run the code above in your browser using DataLab