Description Details Author(s) References Examples
The package provides functions which perform Bayesian estimation via Metropolis-Hastings algorithm in generalized linear models.
| Package: | bglm | 
| Type: | Package | 
| Version: | 1.0 | 
| Date: | 2014-10-29 | 
| License: | GPL-2 | 
| Depends: | mvtnorm | 
Nicolas Molano-Gonzalez, Edilberto Cepeda-Cuervo
Maintainer: Nicolas Molano-Gonzalez <nmolanog@unal.edu.co>
Gamerman, D. 1997. Sampling from the posterior distribution in generalized linear mixed models. Statistics and Computing, 7, 57-68.
| 1 2 3 4 5 6 7 8 9 | library(faraway)
data(babyfood)
summary(babyfood)
g2<- glm(cbind(disease, nondisease) ~ sex+food,family=binomial,babyfood)
#####use N > 8000 for more accurate results
bmen<-binommh(disease~ sex+food,babyfood$disease+babyfood$nondisease,N=1000,
data=babyfood)
data.frame(R.coef=coef(g2),R.sd=sqrt(diag(summary(g2)$cov.unscaled)),
           mh.mean=apply(bmen$chain,2,mean),mh.sd=apply(bmen$chain,2,sd))
 | 
Loading required package: mvtnorm
    disease        nondisease      sex        food  
 Min.   :16.00   Min.   :111.0   Boy :3   Bottle:2  
 1st Qu.:22.00   1st Qu.:180.0   Girl:3   Breast:2  
 Median :39.00   Median :358.5            Suppl :2  
 Mean   :39.67   Mean   :306.0                      
 3rd Qu.:47.75   3rd Qu.:420.0                      
 Max.   :77.00   Max.   :447.0                      
                R.coef      R.sd    mh.mean      mh.sd
(Intercept) -1.6127038 0.1124100 -1.6304421 0.05709493
sexGirl     -0.3125528 0.1410397 -0.3026019 0.06999519
foodBreast  -0.6692946 0.1530057 -0.6710544 0.07394914
foodSuppl   -0.1725424 0.2055847 -0.1953992 0.11263090
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.