git.schokokeks.org
Repositories
Help
Report an Issue
SS2012-StatisticalMethods.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
8505c07
Branches
Tags
master
SS2012-StatisticalMethods.git
1
solution.r
add solutions for Problem sheet 1 and 2
Michi
commited
8505c07
at 2012-05-16 13:38:38
solution.r
Blame
History
Raw
library(LearnBayes) p = seq(0.05, 0.95, by = 0.1) prior = c(1,5.2,8,7.2,4.6,2.1, 0.7, 0.1, 0.0, 0.0) prior = prior/sum(prior) data = c(11,6) post = pdisc(p, prior, data) round(cbind(p,prior,post),2) par(font.lab=2) par(font.axis=2) plot(p, prior, type = "h", xlab='p',ylab ="probability",lwd=2, ylim=c(0,0.5),xlim=c(0,1)) lines(p,post, type="h",lwd=2,lty=2,col="blue") legend("topleft",legend=c("prior","posterior"),lty=c(1,2),lwd=c(2,2),col=c("black","blue"))