File: Chapter.7.5.R

package info (click to toggle)
r-cran-learnbayes 2.15.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,864 kB
  • sloc: sh: 15; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 541 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
########################################################
# Section 7.5 Modeling a Prior Belief of Exchangeability
########################################################

library(LearnBayes)

pgexchprior=function(lambda,pars)
{
alpha=pars[1]; a=pars[2]; b=pars[3]
(alpha-1)*log(prod(lambda))-(2*alpha+a)*log(alpha*sum(lambda)+b)
}

alpha=c(5,20,80,400); par(mfrow=c(2,2))
for (j in 1:4)
    mycontour(pgexchprior,c(.001,5,.001,5),c(alpha[j],10,10),
      main=paste("ALPHA = ",alpha[j]),xlab="LAMBDA 1",ylab="LAMBDA 2")