Created
August 5, 2025 17:42
-
-
Save louismeunier/a8199ce43dea4152d1f35fd526f59d88 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % interactive normal distribution plot, playing around with manipulate function | |
| Manipulate[ | |
| Show[ | |
| Plot[ | |
| PDF[NormalDistribution[\[Mu], \[Sigma]], x], | |
| {x, -10, 10}, | |
| AxesOrigin -> {0, 0}, | |
| PlotRange -> {-0.1, 0.5}, | |
| PlotLabel -> | |
| "\[ScriptCapitalN](" <> ToString[\[Mu]] <> "," <> | |
| ToString[\[Sigma]] <> ")", | |
| PlotStyle -> Directive[Gray, Thickness[0.007]] | |
| ], | |
| Plot[ | |
| {PDF[NormalDistribution[\[Mu], \[Sigma]], x], 0}, | |
| {x, T, 10}, | |
| Filling -> 1 -> {2}, | |
| FillingStyle -> RGBColor[255/255, 148/255, 112/255, 0.8], | |
| PlotRange -> {-0.1, 0.5}, | |
| PlotStyle -> None | |
| ] | |
| ], | |
| {{\[Mu], 0., Dynamic["\[Mu]=" <> ToString[\[Mu]]]}, -10., 10., 0.2}, | |
| {{\[Sigma], 1., Dynamic["\[Sigma]=" <> ToString[\[Sigma]]]}, 1., 5., | |
| 0.1}, | |
| {{T, \[Mu], Dynamic["T=" <> ToString[T]]}, \[Mu] - 2.5*\[Sigma], | |
| 2.5*\[Sigma] + \[Mu], 0.1}, | |
| Delimiter, | |
| Item[Dynamic[Style["p-value=" <> ToString[Round[ | |
| NIntegrate[ | |
| PDF[NormalDistribution[\[Mu], \[Sigma]], x] // Evaluate, {x, | |
| T, Infinity}] | |
| , 0.001]], FontSize -> 15]], Alignment -> Center] | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment