File:Confidence-interval.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

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

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

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
 
The SVG code is valid.
 
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[edit]

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.

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 Satoru (talk | contribs)Simplified
12:13, 15 April 2016Thumbnail for version as of 12:13, 15 April 2016720 × 405 (357 KB)ARAKI Satoru (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata