Last data update: 2014.03.03
R: Displaying 'gbp' Class
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 class '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.
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.
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
Author(s)
Hyungsuk Tak, Joseph Kelly, and Carl Morris
Examples
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)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Rgbp)
Loading required package: sn
Loading required package: stats4
Attaching package: 'sn'
The following object is masked from 'package:stats':
sd
Loading required package: mnormt
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Rgbp/print.gbp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: print.gbp
> ### Title: Displaying 'gbp' Class
> ### Aliases: print.gbp
> ### Keywords: methods
>
> ### ** Examples
>
>
> 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
Summary for each group (sorted by the descending order of se):
obs.mean se prior.mean shrinkage low.intv post.mean upp.intv post.sd
1 -2.07 2.8 0.0184 0.916 -1.883 -0.15703 1.4226 0.842
2 -0.22 2.8 0.0184 0.915 -1.648 -0.00188 1.6277 0.836
3 0.58 1.6 0.0184 0.777 -1.326 0.14385 1.6871 0.768
4 -1.87 1.4 0.0184 0.740 -2.125 -0.47276 0.9273 0.777
5 -0.74 1.4 0.0184 0.732 -1.704 -0.18514 1.2291 0.747
6 -1.97 1.4 0.0184 0.726 -2.183 -0.52667 0.8627 0.776
7 -1.90 1.4 0.0184 0.723 -2.158 -0.51309 0.8736 0.772
8 2.31 1.3 0.0184 0.711 -0.703 0.68108 2.3684 0.783
9 -0.14 1.2 0.0184 0.677 -1.441 -0.03269 1.3531 0.713
10 -1.21 1.2 0.0184 0.677 -1.897 -0.37787 0.9703 0.730
11 -1.43 1.2 0.0184 0.670 -2.000 -0.45937 0.8814 0.733
12 1.56 1.1 0.0184 0.647 -0.759 0.56249 2.0931 0.726
13 0.00 1.1 0.0184 0.631 -1.334 0.01162 1.3548 0.686
14 0.41 1.1 0.0184 0.622 -1.146 0.16644 1.5340 0.683
15 0.08 1.0 0.0184 0.604 -1.268 0.04280 1.3618 0.671
16 -2.15 1.0 0.0184 0.599 -2.426 -0.85010 0.4629 0.736
17 -0.34 1.0 0.0184 0.595 -1.460 -0.12682 1.1574 0.667
18 0.86 1.0 0.0184 0.595 -0.911 0.35945 1.7437 0.676
19 0.01 1.0 0.0184 0.590 -1.284 0.01497 1.3128 0.662
20 1.11 1.0 0.0184 0.575 -0.768 0.48195 1.8740 0.673
21 -0.08 1.0 0.0184 0.565 -1.301 -0.02437 1.2392 0.648
22 0.61 0.9 0.0184 0.550 -0.941 0.28488 1.5873 0.644
23 2.05 0.9 0.0184 0.550 -0.336 0.93347 2.4303 0.704
24 0.57 0.9 0.0184 0.539 -0.942 0.27281 1.5578 0.637
25 1.10 0.9 0.0184 0.533 -0.684 0.52319 1.8622 0.648
26 -2.42 0.8 0.0184 0.499 -2.700 -1.20357 0.0732 0.706
27 -0.38 0.8 0.0184 0.462 -1.367 -0.19598 0.9318 0.586
28 0.07 0.8 0.0184 0.442 -1.068 0.04718 1.1678 0.570
29 0.96 0.7 0.0184 0.436 -0.548 0.54962 1.7388 0.582
30 -0.21 0.7 0.0184 0.381 -1.169 -0.12306 0.9034 0.529
31 1.14 0.6 0.0184 0.352 -0.254 0.74563 1.8226 0.529
Mean 1.2 0.0184 0.614 -1.346 0.01842 1.3681 0.692
> print(g, sort = FALSE)
Summary for each group:
obs.mean se prior.mean shrinkage low.intv post.mean upp.intv post.sd
1 -2.07 2.8 0.0184 0.916 -1.883 -0.15703 1.4226 0.842
2 -0.22 2.8 0.0184 0.915 -1.648 -0.00188 1.6277 0.836
3 0.58 1.6 0.0184 0.777 -1.326 0.14385 1.6871 0.768
4 -1.87 1.4 0.0184 0.740 -2.125 -0.47276 0.9273 0.777
5 -0.74 1.4 0.0184 0.732 -1.704 -0.18514 1.2291 0.747
6 -1.97 1.4 0.0184 0.726 -2.183 -0.52667 0.8627 0.776
7 -1.90 1.4 0.0184 0.723 -2.158 -0.51309 0.8736 0.772
8 2.31 1.3 0.0184 0.711 -0.703 0.68108 2.3684 0.783
9 -0.14 1.2 0.0184 0.677 -1.441 -0.03269 1.3531 0.713
10 -1.21 1.2 0.0184 0.677 -1.897 -0.37787 0.9703 0.730
11 -1.43 1.2 0.0184 0.670 -2.000 -0.45937 0.8814 0.733
12 1.56 1.1 0.0184 0.647 -0.759 0.56249 2.0931 0.726
13 0.00 1.1 0.0184 0.631 -1.334 0.01162 1.3548 0.686
14 0.41 1.1 0.0184 0.622 -1.146 0.16644 1.5340 0.683
15 0.08 1.0 0.0184 0.604 -1.268 0.04280 1.3618 0.671
16 -2.15 1.0 0.0184 0.599 -2.426 -0.85010 0.4629 0.736
17 -0.34 1.0 0.0184 0.595 -1.460 -0.12682 1.1574 0.667
18 0.86 1.0 0.0184 0.595 -0.911 0.35945 1.7437 0.676
19 0.01 1.0 0.0184 0.590 -1.284 0.01497 1.3128 0.662
20 1.11 1.0 0.0184 0.575 -0.768 0.48195 1.8740 0.673
21 -0.08 1.0 0.0184 0.565 -1.301 -0.02437 1.2392 0.648
22 0.61 0.9 0.0184 0.550 -0.941 0.28488 1.5873 0.644
23 2.05 0.9 0.0184 0.550 -0.336 0.93347 2.4303 0.704
24 0.57 0.9 0.0184 0.539 -0.942 0.27281 1.5578 0.637
25 1.10 0.9 0.0184 0.533 -0.684 0.52319 1.8622 0.648
26 -2.42 0.8 0.0184 0.499 -2.700 -1.20357 0.0732 0.706
27 -0.38 0.8 0.0184 0.462 -1.367 -0.19598 0.9318 0.586
28 0.07 0.8 0.0184 0.442 -1.068 0.04718 1.1678 0.570
29 0.96 0.7 0.0184 0.436 -0.548 0.54962 1.7388 0.582
30 -0.21 0.7 0.0184 0.381 -1.169 -0.12306 0.9034 0.529
31 1.14 0.6 0.0184 0.352 -0.254 0.74563 1.8226 0.529
Mean 1.2 0.0184 0.614 -1.346 0.01842 1.3681 0.692
>
> ###############################################################
> # Binomial Regression Interactive Multilevel Modeling (BRIMM) #
> ###############################################################
>
> b <- gbp(z, n, model = "binomial")
> b
Summary for each group (sorted by the ascending order of n):
obs.mean n prior.mean shrinkage low.intv post.mean upp.intv post.sd
1 0.0448 67 0.0285 0.914 0.0187 0.0299 0.0437 0.00640
2 0.0294 68 0.0285 0.913 0.0178 0.0286 0.0419 0.00619
3 0.0238 210 0.0285 0.772 0.0176 0.0275 0.0393 0.00556
4 0.0430 256 0.0285 0.736 0.0214 0.0323 0.0454 0.00612
5 0.0335 269 0.0285 0.726 0.0198 0.0299 0.0419 0.00564
6 0.0438 274 0.0285 0.722 0.0218 0.0328 0.0458 0.00614
7 0.0432 278 0.0285 0.719 0.0218 0.0326 0.0456 0.00610
8 0.0136 295 0.0285 0.707 0.0149 0.0241 0.0354 0.00525
9 0.0288 347 0.0285 0.672 0.0192 0.0286 0.0398 0.00527
10 0.0372 349 0.0285 0.671 0.0213 0.0314 0.0433 0.00564
11 0.0391 358 0.0285 0.665 0.0218 0.0321 0.0442 0.00573
12 0.0177 396 0.0285 0.643 0.0159 0.0247 0.0353 0.00497
13 0.0278 431 0.0285 0.623 0.0193 0.0283 0.0389 0.00503
14 0.0249 441 0.0285 0.618 0.0184 0.0272 0.0376 0.00493
15 0.0273 477 0.0285 0.599 0.0192 0.0280 0.0384 0.00491
16 0.0455 484 0.0285 0.595 0.0246 0.0354 0.0480 0.00600
17 0.0304 494 0.0285 0.590 0.0203 0.0293 0.0398 0.00499
18 0.0220 501 0.0285 0.587 0.0174 0.0258 0.0359 0.00474
19 0.0277 505 0.0285 0.585 0.0195 0.0282 0.0385 0.00486
20 0.0204 540 0.0285 0.569 0.0167 0.0250 0.0349 0.00465
21 0.0284 563 0.0285 0.558 0.0199 0.0285 0.0385 0.00477
22 0.0236 593 0.0285 0.546 0.0181 0.0263 0.0360 0.00458
23 0.0150 602 0.0285 0.542 0.0142 0.0223 0.0321 0.00458
24 0.0238 629 0.0285 0.531 0.0182 0.0263 0.0359 0.00451
25 0.0204 636 0.0285 0.528 0.0167 0.0247 0.0342 0.00447
26 0.0480 729 0.0285 0.494 0.0277 0.0384 0.0508 0.00591
27 0.0306 849 0.0285 0.456 0.0217 0.0297 0.0389 0.00439
28 0.0274 914 0.0285 0.438 0.0203 0.0279 0.0366 0.00416
29 0.0213 940 0.0285 0.431 0.0172 0.0244 0.0328 0.00400
30 0.0293 1193 0.0285 0.374 0.0219 0.0290 0.0372 0.00391
31 0.0201 1340 0.0285 0.347 0.0166 0.0231 0.0305 0.00354
Mean 517 0.0285 0.609 0.0193 0.0285 0.0393 0.00509
> print(b, sort = FALSE)
Summary for each group:
obs.mean n prior.mean shrinkage low.intv post.mean upp.intv post.sd
1 0.0448 67 0.0285 0.914 0.0187 0.0299 0.0437 0.00640
2 0.0294 68 0.0285 0.913 0.0178 0.0286 0.0419 0.00619
3 0.0238 210 0.0285 0.772 0.0176 0.0275 0.0393 0.00556
4 0.0430 256 0.0285 0.736 0.0214 0.0323 0.0454 0.00612
5 0.0335 269 0.0285 0.726 0.0198 0.0299 0.0419 0.00564
6 0.0438 274 0.0285 0.722 0.0218 0.0328 0.0458 0.00614
7 0.0432 278 0.0285 0.719 0.0218 0.0326 0.0456 0.00610
8 0.0136 295 0.0285 0.707 0.0149 0.0241 0.0354 0.00525
9 0.0288 347 0.0285 0.672 0.0192 0.0286 0.0398 0.00527
10 0.0372 349 0.0285 0.671 0.0213 0.0314 0.0433 0.00564
11 0.0391 358 0.0285 0.665 0.0218 0.0321 0.0442 0.00573
12 0.0177 396 0.0285 0.643 0.0159 0.0247 0.0353 0.00497
13 0.0278 431 0.0285 0.623 0.0193 0.0283 0.0389 0.00503
14 0.0249 441 0.0285 0.618 0.0184 0.0272 0.0376 0.00493
15 0.0273 477 0.0285 0.599 0.0192 0.0280 0.0384 0.00491
16 0.0455 484 0.0285 0.595 0.0246 0.0354 0.0480 0.00600
17 0.0304 494 0.0285 0.590 0.0203 0.0293 0.0398 0.00499
18 0.0220 501 0.0285 0.587 0.0174 0.0258 0.0359 0.00474
19 0.0277 505 0.0285 0.585 0.0195 0.0282 0.0385 0.00486
20 0.0204 540 0.0285 0.569 0.0167 0.0250 0.0349 0.00465
21 0.0284 563 0.0285 0.558 0.0199 0.0285 0.0385 0.00477
22 0.0236 593 0.0285 0.546 0.0181 0.0263 0.0360 0.00458
23 0.0150 602 0.0285 0.542 0.0142 0.0223 0.0321 0.00458
24 0.0238 629 0.0285 0.531 0.0182 0.0263 0.0359 0.00451
25 0.0204 636 0.0285 0.528 0.0167 0.0247 0.0342 0.00447
26 0.0480 729 0.0285 0.494 0.0277 0.0384 0.0508 0.00591
27 0.0306 849 0.0285 0.456 0.0217 0.0297 0.0389 0.00439
28 0.0274 914 0.0285 0.438 0.0203 0.0279 0.0366 0.00416
29 0.0213 940 0.0285 0.431 0.0172 0.0244 0.0328 0.00400
30 0.0293 1193 0.0285 0.374 0.0219 0.0290 0.0372 0.00391
31 0.0201 1340 0.0285 0.347 0.0166 0.0231 0.0305 0.00354
Mean 517 0.0285 0.609 0.0193 0.0285 0.0393 0.00509
>
> ##############################################################
> # Poisson Regression Interactive Multilevel Modeling (PRIMM) #
> ##############################################################
>
> p <- gbp(z, n, mean.PriorDist = 0.03, model = "poisson")
> p
Summary for each group (sorted by the ascending order of n):
obs.mean n prior.mean shrinkage low.intv post.mean upp.intv post.sd
1 0.0448 67 0.03 0.911 0.0199 0.0313 0.0454 0.00653
2 0.0294 68 0.03 0.910 0.0189 0.0299 0.0435 0.00631
3 0.0238 210 0.03 0.765 0.0185 0.0285 0.0407 0.00566
4 0.0430 256 0.03 0.728 0.0225 0.0335 0.0467 0.00619
5 0.0335 269 0.03 0.718 0.0208 0.0310 0.0432 0.00573
6 0.0438 274 0.03 0.714 0.0229 0.0339 0.0472 0.00621
7 0.0432 278 0.03 0.711 0.0228 0.0338 0.0469 0.00617
8 0.0136 295 0.03 0.699 0.0157 0.0250 0.0366 0.00534
9 0.0288 347 0.03 0.663 0.0200 0.0296 0.0410 0.00536
10 0.0372 349 0.03 0.662 0.0222 0.0325 0.0446 0.00571
11 0.0391 358 0.03 0.656 0.0228 0.0331 0.0454 0.00579
12 0.0177 396 0.03 0.633 0.0165 0.0255 0.0363 0.00506
13 0.0278 431 0.03 0.613 0.0200 0.0292 0.0400 0.00511
14 0.0249 441 0.03 0.608 0.0191 0.0280 0.0387 0.00502
15 0.0273 477 0.03 0.589 0.0199 0.0289 0.0394 0.00499
16 0.0455 484 0.03 0.585 0.0256 0.0364 0.0491 0.00601
17 0.0304 494 0.03 0.580 0.0211 0.0302 0.0409 0.00506
18 0.0220 501 0.03 0.577 0.0180 0.0266 0.0369 0.00483
19 0.0277 505 0.03 0.575 0.0202 0.0290 0.0395 0.00494
20 0.0204 540 0.03 0.559 0.0173 0.0258 0.0358 0.00474
21 0.0284 563 0.03 0.548 0.0206 0.0293 0.0395 0.00485
22 0.0236 593 0.03 0.535 0.0187 0.0270 0.0369 0.00466
23 0.0150 602 0.03 0.532 0.0147 0.0230 0.0329 0.00466
24 0.0238 629 0.03 0.521 0.0188 0.0271 0.0368 0.00460
25 0.0204 636 0.03 0.518 0.0173 0.0254 0.0351 0.00455
26 0.0480 729 0.03 0.484 0.0286 0.0393 0.0516 0.00587
27 0.0306 849 0.03 0.446 0.0223 0.0303 0.0397 0.00445
28 0.0274 914 0.03 0.428 0.0208 0.0285 0.0374 0.00423
29 0.0213 940 0.03 0.421 0.0176 0.0249 0.0335 0.00407
30 0.0293 1193 0.03 0.364 0.0223 0.0296 0.0379 0.00397
31 0.0201 1340 0.03 0.338 0.0170 0.0235 0.0310 0.00360
Mean 517 0.03 0.600 0.0201 0.0293 0.0403 0.00517
> print(p, sort = FALSE)
Summary for each group:
obs.mean n prior.mean shrinkage low.intv post.mean upp.intv post.sd
1 0.0448 67 0.03 0.911 0.0199 0.0313 0.0454 0.00653
2 0.0294 68 0.03 0.910 0.0189 0.0299 0.0435 0.00631
3 0.0238 210 0.03 0.765 0.0185 0.0285 0.0407 0.00566
4 0.0430 256 0.03 0.728 0.0225 0.0335 0.0467 0.00619
5 0.0335 269 0.03 0.718 0.0208 0.0310 0.0432 0.00573
6 0.0438 274 0.03 0.714 0.0229 0.0339 0.0472 0.00621
7 0.0432 278 0.03 0.711 0.0228 0.0338 0.0469 0.00617
8 0.0136 295 0.03 0.699 0.0157 0.0250 0.0366 0.00534
9 0.0288 347 0.03 0.663 0.0200 0.0296 0.0410 0.00536
10 0.0372 349 0.03 0.662 0.0222 0.0325 0.0446 0.00571
11 0.0391 358 0.03 0.656 0.0228 0.0331 0.0454 0.00579
12 0.0177 396 0.03 0.633 0.0165 0.0255 0.0363 0.00506
13 0.0278 431 0.03 0.613 0.0200 0.0292 0.0400 0.00511
14 0.0249 441 0.03 0.608 0.0191 0.0280 0.0387 0.00502
15 0.0273 477 0.03 0.589 0.0199 0.0289 0.0394 0.00499
16 0.0455 484 0.03 0.585 0.0256 0.0364 0.0491 0.00601
17 0.0304 494 0.03 0.580 0.0211 0.0302 0.0409 0.00506
18 0.0220 501 0.03 0.577 0.0180 0.0266 0.0369 0.00483
19 0.0277 505 0.03 0.575 0.0202 0.0290 0.0395 0.00494
20 0.0204 540 0.03 0.559 0.0173 0.0258 0.0358 0.00474
21 0.0284 563 0.03 0.548 0.0206 0.0293 0.0395 0.00485
22 0.0236 593 0.03 0.535 0.0187 0.0270 0.0369 0.00466
23 0.0150 602 0.03 0.532 0.0147 0.0230 0.0329 0.00466
24 0.0238 629 0.03 0.521 0.0188 0.0271 0.0368 0.00460
25 0.0204 636 0.03 0.518 0.0173 0.0254 0.0351 0.00455
26 0.0480 729 0.03 0.484 0.0286 0.0393 0.0516 0.00587
27 0.0306 849 0.03 0.446 0.0223 0.0303 0.0397 0.00445
28 0.0274 914 0.03 0.428 0.0208 0.0285 0.0374 0.00423
29 0.0213 940 0.03 0.421 0.0176 0.0249 0.0335 0.00407
30 0.0293 1193 0.03 0.364 0.0223 0.0296 0.0379 0.00397
31 0.0201 1340 0.03 0.338 0.0170 0.0235 0.0310 0.00360
Mean 517 0.03 0.600 0.0201 0.0293 0.0403 0.00517
>
>
>
>
>
>
> dev.off()
null device
1
>