daily pastebin goal
36%
SHARE
TWEET

PMF and CDF

a guest Apr 26th, 2016 39 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. \documentclass[tikz,convert={outfile=\weibull_PMF.svg}]{standalone}
  2. \usepackage{tikz}
  3. \usepackage{pgfplots}
  4. \pgfplotsset{compat=1.7}
  5.  
  6. \begin{document}
  7.  
  8. \begin{tikzpicture}
  9. [
  10.    declare function={weibullpmf(\x,\a,\b) = \a^(\x^\b)-\a^((\x+1)^\b);}
  11. ]
  12.  
  13. \begin{axis}[
  14.    axis lines=left,
  15.    enlargelimits=upper,
  16.     smooth,
  17.     line width=1pt,
  18.     samples at={-0.000000000000001,0.01,...,4},
  19.    legend entries=
  20. {  
  21.    $q=0.5 \quad\, \beta = 0.75$,
  22.    $q=0.5 \quad\, \beta = 1   $,
  23.    $q=0.5 \quad\, \beta = 2   $,
  24.    $q=0.75\quad   \beta = 2  $
  25. },  
  26.    legend cell align=left,
  27.    ylabel={$\Pr\left(\mathbf{X}=x\right)$},
  28.    xlabel={$x$}
  29. ]
  30. \definecolor{color1}{RGB}{215,25,28  };
  31. \definecolor{color2}{RGB}{253,174,97 };
  32. \definecolor{color3}{RGB}{171,221,164};
  33. \definecolor{color4}{RGB}{43,131,186 };
  34.  
  35. \addplot[draw=color1,dashed,forget plot]{weibullpmf(x, 0.5 , 0.75  )};
  36. \addplot[draw=color1,
  37.         fill=color1,
  38.         only marks,
  39.         samples at = {0,1,...,4},
  40.         samples = 5,mark=*]            {weibullpmf(x, 0.5 , 0.75  )};
  41.  
  42. \addplot[draw=color2,dashed,forget plot]{weibullpmf(x, 0.5 , 1  )};
  43. \addplot[draw=color2,
  44.         fill=color2,
  45.         only marks,
  46.         samples at = {0,1,...,4},
  47.         samples = 5,mark=*]            {weibullpmf(x, 0.5 , 1  )};
  48.  
  49. \addplot[draw=color3,dashed,forget plot]{weibullpmf(x, 0.5 , 2  )};
  50. \addplot[draw=color3,
  51.         fill=color3,
  52.         only marks,
  53.         samples at = {0,1,...,4},
  54.         samples = 5,mark=*]            {weibullpmf(x, 0.5 , 2  )};
  55.  
  56. \addplot[draw=color4,dashed,forget plot]{weibullpmf(x, 0.75, 2  )};
  57. \addplot[draw=color4,
  58.         fill=color4,
  59.         only marks,
  60.         samples at = {0,1,...,4},
  61.         samples = 5,mark=*]            {weibullpmf(x, 0.75, 2  )};
  62. \end{axis}
  63. \end{tikzpicture}
  64.  
  65. \begin{tikzpicture}
  66. [
  67.    declare function={weibullcmf(\x,\a,\b) = 1-\a^((\x+1)^\b);}
  68. ]
  69.  
  70. \begin{axis}[
  71.    axis lines=left,
  72.    enlargelimits=upper,
  73.    smooth,
  74.    line width=1pt,
  75.    samples at={-0.000000000000001,0.01,...,4},
  76.    legend entries=
  77. {  
  78.    $q=0.5 \quad\, \beta = 0.75$,
  79.    $q=0.5 \quad\, \beta = 1   $,
  80.    $q=0.5 \quad\, \beta = 2   $,
  81.    $q=0.75\quad   \beta = 2  $
  82. },  
  83.    legend cell align=left,
  84.    legend style={at={(0.98,0.02)},anchor=south east},
  85.    ylabel={$\Pr\left(\mathbf{X}\leq x\right)$},
  86.    xlabel={$x$}
  87. ]
  88. \definecolor{color1}{RGB}{215,25,28  };
  89. \definecolor{color2}{RGB}{253,174,97 };
  90. \definecolor{color3}{RGB}{171,221,164};
  91. \definecolor{color4}{RGB}{43,131,186 };
  92.  
  93. \addplot[draw=color1,dashed,forget plot]{weibullcmf(x, 0.5 , 0.75  )};
  94. \addplot[draw=color1,
  95.         fill=color1,
  96.         only marks,
  97.         samples at = {0,1,...,4},
  98.         samples = 5,mark=*]            {weibullcmf(x, 0.5 , 0.75  )};
  99.  
  100. \addplot[draw=color2,dashed,forget plot]{weibullcmf(x, 0.5 , 1  )};
  101. \addplot[draw=color2,
  102.         fill=color2,
  103.         only marks,
  104.         samples at = {0,1,...,4},
  105.         samples = 5,mark=*]            {weibullcmf(x, 0.5 , 1  )};
  106.  
  107. \addplot[draw=color3,dashed,forget plot]{weibullcmf(x, 0.5 , 2  )};
  108. \addplot[draw=color3,
  109.         fill=color3,
  110.         only marks,
  111.         samples at = {0,1,...,4},
  112.         samples = 5,mark=*]            {weibullcmf(x, 0.5 , 2  )};
  113.  
  114. \addplot[draw=color4,dashed,forget plot]{weibullcmf(x, 0.75, 2  )};
  115. \addplot[draw=color4,
  116.         fill=color4,
  117.         only marks,
  118.         samples at = {0,1,...,4},
  119.         samples = 5,mark=*]            {weibullcmf(x, 0.75, 2  )};
  120. \end{axis}
  121. \end{tikzpicture}
  122. \end{document}
  123.  
  124. % ragulpr
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top