File:P-value vs SN.gif

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

P-value_vs_SN.gif(576 × 229 pixels, file size: 1.35 MB, MIME type: image/gif, looped, 101 frames)

Captions

Captions

P-value vs S/N

Summary

[edit]
Description
English: If one wants to decide if there is a signal hidden in the noise, the p-value will drop sharply around S/N=1, and then keep decreasing exponentially. In this example p=0.05 happens just before the curve tails to zero.
Date
Source https://twitter.com/j_bertolotti/status/1183715504185397248
Author Jacopo Bertolotti
Permission
(Reusing this file)
https://twitter.com/j_bertolotti/status/1030470604418428929

Mathematica 11.0 code

[edit]
n = 5 10^3;
noise = RandomVariate[NormalDistribution[0, 1], {n}];
signal = Table[E^(-((x - n/2)^2/(2 (n/100)^2))), {x, 1, n}];
pvssn = Reap[For[a = 0, a <= 5, a = a + 0.05,
     data = a signal + noise;
     \[Chi]2 = Total[data^2];
     p = NIntegrate[PDF[ChiSquareDistribution[n], x], {x, \[Chi]2, \[Infinity]}];
     Sow[{a, p}];
     ];][[2, 1]]
p1 = Table[
   GraphicsRow[{
     ListPlot[pvssn[[j, 1]]*signal + noise, PlotRange -> All, Joined -> True, PlotStyle -> {Thick, Black}, LabelStyle -> {Black, Bold}, Axes -> False]
     ,
     ListPlot[pvssn[[1 ;; j]], Joined -> True, PlotStyle -> {Thick, Black}, LabelStyle -> {Black, Bold}, AxesLabel -> {"S/N", "p-value"}, PlotRange -> {{0, 5}, {0, 1}}]
     }, ImageSize -> Large, PlotLabel -> Style[StringForm["\!\(\*SubscriptBox[\(H\), \(0\)]\): the data is just Gaussian random noise.\nNull hypothesis rejected with p=``", ScientificForm[pvssn[[j, 2]], 3] ]], 
    LabelStyle -> {Black, Bold}]
   , {j, 1, Dimensions[pvssn][[1]], 1}];
ListAnimate[p1]

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

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

Date/TimeThumbnailDimensionsUserComment
current12:18, 16 October 2019Thumbnail for version as of 12:18, 16 October 2019576 × 229 (1.35 MB)Berto (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

Metadata