Skip to content

Commit e39539f

Browse files
committed
Deploying to gh-pages from @ 5cfb547 🚀
1 parent f11ed19 commit e39539f

5 files changed

Lines changed: 54 additions & 9 deletions

File tree

articles/Chapter06.html

Lines changed: 25 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

articles/Chapter06.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,19 +621,43 @@ of genre comedy, with average values of and {Weeks} as well as the
621621
sentiments and volumes of Twitter-posts set, but different values of .
622622

623623
``` r
624-
nf=3
624+
nf=4
625625
X_new <- cbind(rep(1,nf), matrix(0,nrow=nf,ncol=p))
626626
colnames(X_new)<-colnames(X)
627-
X_new[,"Comedy"]=rep(1,3)
628-
X_new[,"Screens"]=c(0,3,10)
627+
628+
X_new[2,"Comedy"]=1
629+
X_new[3:4,"Thriller"]=1
630+
X_new[3,"PG13"]=1
631+
X_new[4,"R"]=1
632+
633+
X_new[,"Budget"]=c(10)
629634

630635
ypred.sc=X_new%*%t(beta.sc)+rnorm(sqrt(sigma2.sc))
631636
pred.int.sc<- apply(ypred.sc,1, quantile, probs=c(0.025,0.5, 0.975))
637+
pred.mean.sc<- rowMeans(ypred.sc)
632638

633639
ypred.hs<-X_new%*%t(beta.hs)+rnorm(sqrt(sigma2.hs))
634640
pred.int.hs<- apply(ypred.hs,1, quantile, probs=c(0.025,0.5, 0.975))
641+
pred.mean.hs<- rowMeans(ypred.hs)
635642
```
636643

637644
plot predicted expectation,the median of the predictive distribution,
638645
together with vertical bars indicating the pointwise equal-tailed
639646
95%-predictive interval
647+
648+
``` r
649+
par(mfrow=c(1,1))
650+
651+
matplot(x=t(matrix(1:nf,ncol=3, nrow=nf)),y=pred.int.sc,col="blue",type = "l",pch=16,lty=1,ylim=c(5,35), xlim=c(0,nf+1), xlab="Scenarios", ylab="Prediction",xaxt="n")
652+
points(x = 1:nf, y = pred.int.sc[2,], pch=16,col="blue")
653+
points(x = 1:nf, y = pred.mean.sc, pch=16,col="red")
654+
655+
matplot(x=t(matrix((1:nf)+0.2,ncol=3, nrow=nf)),y=pred.int.hs,col="blue",type = "l",pch=16,lty=1,add=TRUE)
656+
657+
points(x = (1:nf)+0.2, y = pred.int.hs[2,], pch=16,col="blue")
658+
points(x = (1:nf)+0.2, y = pred.mean.hs, pch=16,col="red")
659+
660+
axis(1,at=1:nf,labels=c("A","B","C","D"))
661+
```
662+
663+
![](Chapter06_files/figure-html/unnamed-chunk-31-1.png)
22.1 KB
Loading

pkgdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ articles:
1111
Chapter07: Chapter07.html
1212
Chapter08: Chapter08.html
1313
Chapter09: Chapter09.html
14-
last_built: 2025-12-16T17:17Z
14+
last_built: 2025-12-17T15:07Z
1515
urls:
1616
reference: https://gregorkastner.github.io/BayesianLearningCode/reference
1717
article: https://gregorkastner.github.io/BayesianLearningCode/articles

search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)