File: Chapter.3.2.R

package info (click to toggle)
r-cran-learnbayes 2.15.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, trixie
  • size: 1,864 kB
  • sloc: sh: 15; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
######################################################################
# Section 3.2 Normal Distribution with Known Mean but Unknown Variance
######################################################################
 
 library(LearnBayes)

 data(footballscores)
 attach(footballscores)
 d = favorite - underdog - spread
 n = length(d)
 v = sum(d^2)

 P = rchisq(1000, n)/v
 s = sqrt(1/P)
 hist(s)

 quantile(s, probs = c(0.025, 0.5, 0.975))