File:Confidence-interval.svg

Original file(SVG file, nominally 720 × 405 pixels, file size: 189 KB)

Summary

Description
English: A probability density function of Student's t-distribution for directions to construct confidence interval of mean of normal distribution.
Date
Source Own work
Author ARAKI Satoru
SVG development
InfoField
W3C grn 
The SVG code is valid.
Unknown logo-V 
This vector image was created with an unknown SVG tool.
library(ggplot2)
alpha <- 0.05 # a significance level
n <- 10       # degree of freedom
accept <- function(x){
  y <- dt(x, n)
  y[x < qt(alpha/2, n) | x > qt(1 - alpha/2, n)] <- NA
  return(y)
}
reject <- function(x){
  y <- dt(x, n)
  y[x > qt(alpha/2, n) & x < qt(1 - alpha/2, n)] <- NA
  return(y)
}
N <- 1e4 # a large number
s <- 5   # fontsize
p <-
  ggplot(data.frame(x=c(-3, +3)), aes(x=x)) +
  stat_function(
    fun=accept, geom="area",
    fill="#0072B2", n=N) + 
  stat_function(
    fun=reject, geom="area",
    fill="#D55E00", n=N) +
  annotate(
    "text", x=0, y=0.2, 
    parse=T, label="1-alpha", 
    size=s, colour="#EEEEEE") +  
  annotate(
    "text", x=-2.5, y=0.2, 
    parse=T, label="alpha/2", 
    size=s, colour="#D55E00") +
  annotate(
    "text", x=+2.5, y=0.2, 
    parse=T, label="alpha/2", 
    size=s, colour="#D55E00") +
  annotate(
    "text", x=qt(alpha/2, n), y=-0.02,
    parse=T, label="-t[n-1](alpha/2)",
    size=s, colour="#000000") +
  annotate(
    "text", x=0, y=-0.02,
    label="0",
    size=s, colour="#000000") +
  annotate(
    "text", x=qt(1 - alpha/2, n), y=-0.02,
    parse=T, label="+t[n-1](alpha/2)",
    size=s, colour="#000000") +
  theme(
    axis.text.y=element_blank(), 
    axis.text.x=element_blank(),
    axis.ticks=element_blank()) +
  labs(x="", y="")

svg(filename="confidence-interval.svg", width=16/2, height=9/2)
plot(p)
dev.off()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

15 April 2016

image/svg+xml

ed0c33e0d8cdbbb2ba0f69010437d1abd345407c

193,243 byte

405 pixel

720 pixel

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current12:36, 15 April 2016Thumbnail for version as of 12:36, 15 April 2016720 × 405 (189 KB)ARAKI SatoruSimplified
12:13, 15 April 2016Thumbnail for version as of 12:13, 15 April 2016720 × 405 (357 KB)ARAKI SatoruUser created page with UploadWizard

The following page uses this file:

Global file usage

The following other wikis use this file:

Metadata