summary.rglmb: Summarizing Bayesian Generalized Linear Model Distribution...

Description Usage Arguments Details Value See Also Examples

View source: R/summary.rglmb.R

Description

These functions are all methods for class rglmb or summary.rglmb objects.

Usage

1
2
3
4
5
## S3 method for class 'rglmb'
summary(object, ...)

## S3 method for class 'summary.rglmb'
print(x, digits = max(3, getOption("digits") - 3), ...)

Arguments

object

an object of class "rglmb" for which a summary is desired.

x

an object of class "summary.rglmb" for which a printed output is desired.

digits

the number of significant digits to use when printing.

...

Additional optional arguments

Details

The summary.rglmb function summarizes the output from the rglmb function. It takes an object of class rglmb as an input. The output to a large extent mirrors the output from the summary.glm function. This is particularly true for the print output from the function (i.e. the output of the function print.summary.rglmb).

Value

summary.rglmb returns a object of class "summary.rglmb", a list with components:

n

number of draws generated

coefficients1

Matrix with the prior mean and approximate weight for the prior relative to the data

coefficients

Matrix with columns for the posterior mode, posterior mean, posterior standard deviation, monte carlo error, and tail probabilities (posterior probability of observing a value for the coefficient as extreme as the prior mean)

Percentiles

Matrix with estimated percentiles associated with the posterior density

See Also

lmb, glmb, summary, [stats]summary.lm,[stats]summary.glm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
data(menarche2)

summary(menarche2)
plot(Menarche/Total ~ Age, data=menarche2)

Age2=menarche2$Age-13

x<-matrix(as.numeric(1.0),nrow=length(Age2),ncol=2)
x[,2]=Age2

y=menarche2$Menarche/menarche2$Total
wt=menarche2$Total

mu<-matrix(as.numeric(0.0),nrow=2,ncol=1)
mu[2,1]=(log(0.9/0.1)-log(0.5/0.5))/3

V1<-1*diag(as.numeric(2.0))

# 2 standard deviations for prior estimate at age 13 between 0.1 and 0.9
## Specifies uncertainty around the point estimates

V1[1,1]<-((log(0.9/0.1)-log(0.5/0.5))/2)^2 
V1[2,2]=(3*mu[2,1]/2)^2  # Allows slope to be up to 3 times as large as point estimate 

out<-rglmb(n = 1000, y=y, x=x, pfamily=dNormal(mu=mu,Sigma=V1), weights = wt, 
           family = binomial(logit)) 
summary(out)

print(summary(out),digits=4)

mean(out$iters)

knygren/glmbayes documentation built on Sept. 4, 2020, 4:39 p.m.