File:Binomial confidence band.svg

From Wikimedia Commons, the free media repository

Jump to: navigation, search

Binomial_confidence_band.svg(SVG file, nominally 720 × 540 pixels, file size: 43 KB)

[edit] Summary

Description
English: Illustration of confidence bands using simulated data.
Date

11 April 2009(2009-04-11)

Source

Own work

Author

Skbkekas

Permission
(Reusing this image)

See below.

[edit] Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons license
Creative Commons Attribution
This file is licensed under the Creative Commons Attribution 3.0 Unported License. In short: you are free to distribute and modify the file as long as you attribute its author(s) or licensor(s).

العربية | Български | Català | Česky | Deutsch | Ελληνικά | English | Español | Eesti | Euskara | Suomi | Français | עברית | Hrvatski | Magyar | Italiano | 日本語 | 한국어 | Lietuvių | Македонски | Plattdüütsch | Nederlands | Polski | Português | Русский | Svenska | ไทย | Türkçe | Vèneto | ‪中文(简体)‬ | ‪中文(繁體)‬ | +/−

import numpy as np
import matplotlib.pyplot as plt
import scipy.special as sp
 
X = np.arange(18, 81, 2)
 
P = 1/(1+np.exp(1-0.2*np.sqrt(X-18)))
 
Y,S,n = [],[],500
for i,x in enumerate(X):
    y = 1*(np.random.uniform(size=n)<P[i])
    p = y.mean()
    Y.append(p)
    S.append(np.sqrt(p*(1-p)/n))
Y = np.array(Y)
S = np.array(S)
 
## Multiplier for 95% simultaneous confidence band using Bonferroni method.
f = -sp.ndtri(0.025/len(P))
 
plt.clf()
a = plt.plot(X, Y, '-', color='black')
plt.hold(True)
b = plt.plot(X, Y+2*S, '-', color='royalblue')
plt.plot(X, Y-2*S, '-', color='royalblue')
c = plt.plot(X, Y+f*S, '-', color='orangered')
plt.plot(X, Y-f*S, '-', color='orangered')
d = plt.plot(X, P, '-', color='green')
plt.ylim(0,1)
plt.xlim(18,80)
B = plt.legend((a,b,c,d), ('Estimate', '95% point-wise CB',\
                           '95% simultaneous CB', "True proportions"),\
                           'upper left')
B.draw_frame(False)
plt.xlabel("Age")
plt.ylabel("Proportion supporting candidate A")
plt.savefig("binomial_confidence_band.png")
plt.savefig("binomial_confidence_band.svg")
Information icon.svg The categories of this image should be checked. Check them now!
  • Remove redundant categories and try to put this image in the most specific category/categories
  • Remove this template

Afrikaans | Alemannisch | Català | Česky | Dansk | Deutsch | Deutsch (Sie-Form) | English | Español | Eesti | Suomi | Français | עברית | Հայերեն | Italiano | 日本語 | Magyar | Македонски | Malti | Plattdüütsch | Nederlands | Polski | Português | Română | Русский | Slovenčina | ไทย | Vèneto | 中文 | +/−


Usage:

File history

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

Date/TimeThumbnailDimensionsUserComment
current04:11, 11 April 2009Thumbnail for version as of 04:11, 11 April 2009720×540 (43 KB)Skbkekas (Talk | contribs) (Added the line for true proportions.)
04:02, 11 April 2009Thumbnail for version as of 04:02, 11 April 2009720×540 (41 KB)Skbkekas (Talk | contribs) ({{Information |Description={{en|1=Illustration of confidence bands using simulated data.}} |Source=Own work by uploader |Author=Skbkekas |Date=April 11, 2009 |Permission= |other_versions= }} <!--{{ImageUpload|full}}-->)

There are no pages that link to this file.

Global file usage

The following other wikis use this file: