(* Demo with normal and extreme value distributions *)

areaUnderStandNormalFromMinus1To1 = N[1/Sqrt[2 Pi]Integrate[ Exp[-x^2/2],{x,-1,1}]]
(1-areaUnderStandNormalFromMinus1To1)/2

mu=3.1060764481466094`;sigma=1;
Mean[NormalDistribution[mu,sigma]]
PDF[NormalDistribution[mu,sigma],x]
Plot[PDF[NormalDistribution[mu,sigma],x],{x,-5,10},Filling->Axis]

locationParameterAlpha=2.5;
scaleParameterBeta=1.05;
Mean[ExtremeValueDistribution[locationParameterAlpha,scaleParameterBeta]]
StandardDeviation[ExtremeValueDistribution[locationParameterAlpha,scaleParameterBeta]]
PDF[ExtremeValueDistribution[locationParameterAlpha,scaleParameterBeta],x]
Plot[PDF[ExtremeValueDistribution[locationParameterAlpha,scaleParameterBeta],x],{x,-5,10}]

data = RandomVariate[ExtremeValueDistribution[locationParameterAlpha,scaleParameterBeta],10^4];

Show[
Histogram[data,20,"ProbabilityDensity"],
Plot[PDF[ExtremeValueDistribution[locationParameterAlpha,scaleParameterBeta],x],{x,-5,10},PlotStyle->Thick]]

Plot[f[k],{k,-100,1000}]

(* Homework problem in Intro to Bioinf *)

(* p-value that corresponds to Z-score of 2 *)

N[1-CDF[NormalDistribution[0,1],2]]
N[Integrate[PDF[NormalDistribution[0,1],x],{x,2,Infinity}]]
mu=3.1060764481466094`;sigma=1;
Mean[NormalDistribution[mu,sigma]]
PDF[NormalDistribution[mu,sigma],x]

(* p-value corresponding to 6 for normal with mu=3.1060764481466094`;sigma=1; *)


mu=3.1060764481466094`;sigma=1;
N[1-CDF[NormalDistribution[mu,sigma],6]]
N[Integrate[PDF[NormalDistribution[mu,sigma],x],{x,6,Infinity}]]

(* p-value corresponding to 6 for extreme value distribution with given location and scale parameter *)

locationParameterAlpha=2.5;
scaleParameterBeta=1.05;

F=PDF[ExtremeValueDistribution[2.5,1.05],x]
N[Integrate[F,{x,6,Infinity}]]
1-CDF[ExtremeValueDistribution[2.5,1.05],6]
N[Integrate[PDF[ExtremeValueDistribution[2.5,1.05],x],{x,6,Infinity}]]

N[Integrate[ PDF[ExtremeValueDistribution[2.5,1.05],x],{x,4,Infinity}]]

0.21309758657445263`
N[Pi]