1

I have been trying to plot the cdf (commulative density function) of a binomial distribution - in the easiest way possible (is there a package i could use?)

I would be glad if somebody already stumbled across this problem and solved it for him/her and would share his thoughts on this.

I tried to implement RStudio plots but this doesn't quite give me the appeareance I aim for - because R-Plots can't be changed that much.

Thank you very much in advance!

manuel459
  • 319

1 Answers1

0

With XeLaTeX or LuaLaTeX you can compile (for example in OVerleaf):

% Requires XeLaTeX, LuaLaTeX, LaTeX compiler!!!!!
% Is not compatible with the pdfLaTeX compiler !!!!
\documentclass[11pt]{article}
\usepackage{pst-func}

\newcommand{\rightEndPlot}{6.8} \newcommand{\BinomialN}{4} \newcommand{\Binomialp}{0.5} \begin{document}

% See https://mirror.foobar.to/CTAN/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.pdf \psset{xunit=0.8cm,yunit=8cm}% \begin{pspicture}showgrid=false(\rightEndPlot,1.2)% \psset{arrowscale=1.3,arrowinset=0.05,arrowlength=1.9,comma}% \psaxes[labelFontSize=\scriptstyle,xticksize=0 1.07,yticksize=0 \rightEndPlot,tickcolor=gray!50, Dy=0.1,dy=0.1,Dx=1,dx=1,Ox=0]{->}(0,0)(-0.9,0)(\rightEndPlot,1.1) %\uput-90{$z$}\uput0{$P_{0,15}^{100}(Z=z)$} \psBinomialF[linecolor=red,fillstyle=solid,fillcolor=yellow,barwidth=0.4,opacity=0.5,LineEndColorL=red,rightEnd=\rightEndPlot]{\BinomialN}{\Binomialp} \end{pspicture} \end{document}

enter image description here

Jakob
  • 993
  • Note that this also works with pdfLaTeX if you load the package auto-pst-pdf and compile with shell-escape (which is the default in Overleaf). – Marijn Mar 24 '24 at 17:44