pfamily: Prior Family Objects for Bayesian Models

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/pfamily.R

Description

Prior family objects provide a convenient way to specify the details of the priors used by functions such as glmb. See the documentations for lmb, glmb, glmb, and rglmb for the details of how such model fitting takes place.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
pfamily(object, ...)

dNormal(mu, Sigma, dispersion = NULL)

dGamma(shape, rate, beta)

dNormal_Gamma(mu, Sigma, shape, rate)

dIndependent_Normal_Gamma(mu, Sigma, shape, rate)

## S3 method for class 'pfamily'
print(x, ...)

Arguments

object

the function pfamily accesses the pfamily objects which are stored within objects created by modelling functions (e.g., glmb).

mu

a prior mean vector for the the modeling coefficients used in several pfamilies

Sigma

a prior Variance-Covariance matrix for the model coefficients in several pfamilies

dispersion

the dispersion to be assumed when it is not given a prior. Should be provided when the Normal prior is for the gaussian(), Gamma(), quasibinomial, or quasipoisson families. The binomial() and poisson() families do not have dispersion coefficients.

shape

the prior shape parameter used by the gamma component of the prior. The gamma distribution is used as a prior for the inverse dispersion coefficients.

rate

the rate parameter used by the gamma component of the prior.

beta

the regression coefficients to be assumed when it is not given a prior. Needs to be provided when the Gamma prior is used for the dispersion. This specification is typically only used as part of Gibbs sampling where the beta and dispersion parameters are updated separately.

x

an object, a pfamily function that is to be printed

...

additional argument(s) for methods.

Details

pfamily is a generic function with methods for classe glmb and lmb. Many glmb models currently only have implementations for the dNormal() prior family. The Gamma() family also works with the dGamma() prior family while the gaussian() family works with the dGamma() and dNormal_Gamma() pfamilies.

Value

An object of class "pfamily" (which has a concise print method). This is a list with elements.

pfamily

character: the pfamily name

prior_list

a list with the prior parameters associated with the prior specification

okfamilies

currently implemented families for which the prior family can be used.

plinks

a function that assigns a set of oklinks for the combination of a family and and pfamily.

simfun

function: the function used to generate samples from the posterior density. All currently implemented pfamiles have simulation functions that generate iid samples for the associated posterior distribution.

Author(s)

The design of the pfamily set of functions was developed by Kjell Nygren and was inspired by the family used by the glmb function to specify the likelihood function. That design in turn was inspired by S functions of the same names described in Hastie and Pregibon (1992).

References

Cox, D.R. and Snell, E.J. (1981) Applied Statistics; Principles and Examples. London: chapman and Hall.

Dobson, A. J. (1990) An Introduction to Statistical Modeling. London: Chapman and Hall.

Hastie, T. J. and Pregibon, D. (1992) Generalized linear models. Chapter 6 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole. McCullagh P. and Nelder, J. A. (1989) Generalized Linear Models. London: Chapman and Hall.

Nygren, K.N. and Nygren, L.M (2006) Likelihood Subgradient Densities. Journal of the American Statistical Association. vol.101, no.475, pp 1144-1156. doi: 10.1198/016214506000000357.

Raiffa, Howard and Schlaifer, R (1961) Applied Statistical Decision Theory. Boston: Clinton Press, Inc.

See Also

lmb, glmb, rlmb, rglmb for modeling functions using pfamilies

rNormal_reg, rNormal_Gamma_reg, and rGamma_reg for lower level functions that sample from the resulting posterior distributions from the currently available pfamilies.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
mu=c(0,0)
Sigma=diag(2)

npf<-dNormal(mu,Sigma)  # Normal pfamily
str(dNormal(mu,Sigma))

## Example where # Normal pfamily is used

## Dobson (1990) Page 93: Randomized Controlled Trial :
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
mysd<-1
mu<-matrix(0,5)
mu[1]=log(mean(counts))
V0<-((mysd)^2)*diag(5)
glmb.D93<-glmb(counts ~ outcome + treatment, family = poisson(),pfamily=dNormal(mu=mu,Sigma=V0))
summary(glmb.D93)

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