Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In[1]:= NumLessThan[x_, data_] := (i = 1;
- For[i := 1, x > data[[i]] && i <= Length[data], i++, i]; i - 1)
- In[2]:= CDFDisc[x_, data_] := NumLessThan[x, Sort[data]]/Length[data]
- In[3]:= data =
- RandomVariate[NormalDistribution[],
- 2]; Plot[{CDF[NormalDistribution[], x], CDFDisc[x, data]}, {x, -5,
- 4}]
- In[4]:= NIntegrate[
- Abs[CDF[NormalDistribution[], x] - CDFDisc[x, data]], {x, -10, 10}]
- Out[4]= 10.
- In[5]:= Plot[
- Abs[CDF[NormalDistribution[-0.5, 1], x] - CDFDisc[x, data]], {x, -10,
- 10}, PlotRange -> Full]
- In[6]:= NIntegrate[CDF[NormalDistribution[], x], {x, -10, 10}]
- Out[6]= 10.
Add Comment
Please, Sign In to add comment