Error message

  • Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in book_prev() (line 775 of /home3/gardeoi3/public_html/iamrandom/modules/book/book.module).
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home3/gardeoi3/public_html/iamrandom/includes/common.inc).

summary.bayes

This is like the summary.lm() except Bayesian statistics reports different metrics like probability intervals (PIs) for the coefficients. 

### input: lm.bayes object
### output: a table with means and 95% PIs for the parameters b0,b1,...,bp, sigma^2 (one row each).  It returns (lower_bound, mean, upper_bound) where lower and upper bound are the 95% PIs.

summary.bayes=function(reg2)
{  N=nrow(reg2)
   k=(ncol(reg2))
   summ=matrix(0,k,3)
   for(i in 1:k)
   { summ[i,]= c(sort(reg2[,i])[.025*N], mean(reg2[,i]), sort(reg2[,i])[.975*N])
   }
   summ
}

### Example:   use lm.bayes to create a regression object: "reg2"
summary.bayes(reg2)