summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/statex2
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/statex2
Initial commit
Diffstat (limited to 'macros/latex/contrib/statex2')
-rw-r--r--macros/latex/contrib/statex2/statex2-example.pdfbin0 -> 175639 bytes
-rw-r--r--macros/latex/contrib/statex2/statex2-example.tex232
-rw-r--r--macros/latex/contrib/statex2/statex2.sty483
3 files changed, 715 insertions, 0 deletions
diff --git a/macros/latex/contrib/statex2/statex2-example.pdf b/macros/latex/contrib/statex2/statex2-example.pdf
new file mode 100644
index 0000000000..2553881f28
--- /dev/null
+++ b/macros/latex/contrib/statex2/statex2-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/statex2/statex2-example.tex b/macros/latex/contrib/statex2/statex2-example.tex
new file mode 100644
index 0000000000..c640bbefcc
--- /dev/null
+++ b/macros/latex/contrib/statex2/statex2-example.tex
@@ -0,0 +1,232 @@
+\documentclass[dvipsnames,usenames]{report}
+%\documentclass[dvipsnames,usenames,autobold]{report}
+\usepackage{statex2}
+\usepackage{shortvrb}
+\MakeShortVerb{@}
+% Examples
+\begin{document}
+
+Many accents have been re-defined
+
+@ c \c{c} \pi \cpi@ $$ c \c{c} \pi \cpi$$ %upright constants like the speed of light and 3.14159...
+
+@int \e{\im x} \d{x}@ $$\int \e{\im x} \d{x}$$ %\d{x}; also note new commands \e and \im
+
+@\^{\beta_1}=b_1@ $$\^{\beta_1}=b_1$$
+
+@\=x=\frac{1}{n}\sum x_i@ $$\=x=\frac{1}{n}\sum x_i$$ %also, \b{x}, but see \ol{x} below
+
+@\b{x} = \frac{1}{n} \wrap[()]{x_1 +\.+ x_n}@ $$\b{x} = \frac{1}{n} \wrap[()]{x_1 +\.+ x_n}$$
+
+Sometimes overline is better: @\b{x} \vs \ol{x}@ $$\b{x} \vs \ol{x}$$
+
+And, underlines are nice too: @\ul{x}@ $$\ul{x}$$
+
+Derivatives and partial derivatives:
+
+@\deriv{x}{x^2+y^2}@ $$\deriv{x}{x^2+y^2}$$
+@\pderiv{x}{x^2+y^2}@ $$\pderiv{x}{x^2+y^2}$$
+
+Or, rather, in the order of @\frac@:
+
+@\derivf{x^2+y^2}{x}@ $$\derivf{x^2+y^2}{x}$$
+@\pderivf{x^2+y^2}{x}@ $$\pderivf{x^2+y^2}{x}$$
+
+A few other nice-to-haves:
+
+@\chisq@ $$\chisq$$
+
+@\Gamma[n+1]=n!@ $$\Gamma[n+1]=n!$$
+
+@\binom{n}{x}@ $$\binom{n}{x}$$ %provided by amsmath package
+
+@\e{x}@ $$\e{x}$$
+
+@\H_0: \mu=0 \vs \H_1: \mu \neq 0 (\neg \H_0) @ $$\H_0: \mu=0 \vs \H_1: \mu \neq 0 (\neg \H_0) $$
+
+@\logit \wrap{p} = \log \wrap{\frac{p}{1-p}}@ $$\logit \wrap{p} = \log \wrap{\frac{p}{1-p}}$$
+\pagebreak
+Common distributions along with other features follows:
+
+Normal Distribution
+
+@Z ~ \N{0}{1}, \where \E{Z}=0 \and \V{Z}=1@ $$Z ~ \N{0}{1}, \where \E{Z}=0 \and \V{Z}=1$$
+
+@\P{|Z|>z_\ha}=\alpha@ $$\P{|Z|>z_\ha}=\alpha$$
+
+@\pN[z]{0}{1}@ $$\pN[z]{0}{1}$$
+
+or, in general
+
+@\pN[z]{\mu}{\sd^2}@ $$\pN[z]{\mu}{\sd^2}$$
+
+Sometimes, we subscript the following operations:
+
+@\E[z]{Z}=0, \V[z]{Z}=1, \and \P[z]{|Z|>z_\ha}=\alpha@
+$$\E[z]{Z}=0, \V[z]{Z}=1, \and \P[z]{|Z|>z_\ha}=\alpha$$
+
+Multivariate Normal Distribution
+
+@\bm{X} ~ \N[p]{\bm{\mu}}{\sfsl{\Sigma}}@ $$\bm{X} ~ \N[p]{\bm{\mu}}{\sfsl{\Sigma}}$$
+%\bm provided by the bm package
+
+Chi-square Distribution
+
+@Z_i \iid \N{0}{1}, \where i=1 ,\., n@ $$Z_i \iid \N{0}{1}, \where i=1 ,\., n$$
+
+@\chisq = \sum_i Z_i^2 ~ \Chi{n}@ $$\chisq = \sum_i Z_i^2 ~ \Chi{n}$$
+
+@\pChi[z]{n}@ $$\pChi[z]{n}$$
+
+t Distribution
+
+@\frac{\N{0}{1}}{\sqrt{\frac{\Chisq{n}}{n}}} ~ \t{n}@
+$$\frac{\N{0}{1}}{\sqrt{\frac{\Chisq{n}}{n}}} ~ \t{n}$$
+\pagebreak
+F Distribution
+
+@X_i, Y_{\~i} \iid \N{0}{1} \where i=1 ,\., n; \~i=1 ,\., m \and \V{X_i, Y_{\~i}}=\sd_{xy}=0@
+$$X_i, Y_{\~i} \iid \N{0}{1} \where i=1 ,\., n; \~i=1 ,\., m \and \V{X_i, Y_{\~i}}=\sd_{xy}=0$$
+
+@\chisq_x = \sum_i X_i^2 ~ \Chi{n}@ $$\chisq_x = \sum_i X_i^2 ~ \Chi{n}$$
+
+@\chisq_y = \sum_{\~i} Y_{\~i}^2 ~ \Chi{m}@ $$\chisq_y = \sum_{\~i} Y_{\~i}^2 ~ \Chi{m}$$
+
+@\frac{\chisq_x}{\chisq_y} ~ \F{n}{m}@ $$\frac{\chisq_x}{\chisq_y} ~ \F{n}{m}$$
+
+Beta Distribution
+
+@B=\frac{\frac{n}{m}F}{1+\frac{n}{m}F} ~ \Bet{\frac{n}{2}}{\frac{m}{2}}@
+$$B=\frac{\frac{n}{m}F}{1+\frac{n}{m}F} ~ \Bet{\frac{n}{2}}{\frac{m}{2}}$$
+
+@\pBet{\alpha}{\beta}@ $$\pBet{\alpha}{\beta}$$
+
+Gamma Distribution
+
+@G ~ \Gam{\alpha}{\beta}@ $$G ~ \Gam{\alpha}{\beta}$$
+
+@\pGam{\alpha}{\beta}@ $$\pGam{\alpha}{\beta}$$
+
+Cauchy Distribution
+
+@C ~ \Cau{\theta}{\nu}@ $$C ~ \Cau{\theta}{\nu}$$
+
+@\pCau{\theta}{\nu}@ $$\pCau{\theta}{\nu}$$
+
+Uniform Distribution
+
+@X ~ \U{0, 1}@ $$X ~ \U{0, 1}$$
+
+@\pU{0}{1}@ $$\pU{0}{1}$$
+
+or, in general
+
+@\pU{a}{b}@ $$\pU{a}{b}$$
+
+Exponential Distribution
+
+@X ~ \Exp{\lambda}@ $$X ~ \Exp{\lambda}$$
+
+@\pExp{\lambda}@ $$\pExp{\lambda}$$
+
+Hotelling's $T^2$ Distribution
+
+@X ~ \Tsq{\nu_1}{\nu_2}@ $$X ~ \Tsq{\nu_1}{\nu_2}$$
+
+Inverse Chi-square Distribution
+
+@X ~ \IC{\nu}@ $$X ~ \IC{\nu}$$
+
+Inverse Gamma Distribution
+
+@X ~ \IG{\alpha}{\beta}@ $$X ~ \IG{\alpha}{\beta}$$
+
+Pareto Distribution
+
+@X ~ \Par{\alpha}{\beta}@ $$X ~ \Par{\alpha}{\beta}$$
+
+@\pPar{\alpha}{\beta}@ $$\pPar{\alpha}{\beta}$$
+
+Wishart Distribution
+
+@\sfsl{X} ~ \W{\nu}{\sfsl{S}}@ $$\sfsl{X} ~ \W{\nu}{\sfsl{S}}$$
+
+Inverse Wishart Distribution
+
+@\sfsl{X} ~ \IW{\nu}{\sfsl{S^{-1}}}@ $$\sfsl{X} ~ \IW{\nu}{\sfsl{S^{-1}}}$$
+
+Binomial Distribution
+
+@X ~ \Bin{n}{p}@ $$X ~ \Bin{n}{p}$$
+
+%@\pBin{n}{p}@ $$\pBin{n}{p}$$
+
+Bernoulli Distribution
+
+@X ~ \B{p}@ $$X ~ \B{p}$$
+
+Beta-Binomial Distribution
+
+@X ~ \BB{p}@ $$X ~ \BB{p}$$
+
+%@\pBB{n}{\alpha}{\beta}@ $$\pBB{n}{\alpha}{\beta}$$
+
+Negative-Binomial Distribution
+
+@X ~ \NB{n}{p}@ $$X ~ \NB{n}{p}$$
+
+Hypergeometric Distribution
+
+@X ~ \HG{n}{M}{N}@ $$X ~ \HG{n}{M}{N}$$
+
+Poisson Distribution
+
+@X ~ \Poi{\mu}@ $$X ~ \Poi{\mu}$$
+
+%@\pPoi{\mu}@ $$\pPoi{\mu}$$
+
+Dirichlet Distribution
+
+@\bm{X} ~ \Dir{\alpha_1 \. \alpha_k}@ $$\bm{X} ~ \Dir{\alpha_1 \. \alpha_k}$$
+
+Multinomial Distribution
+
+@\bm{X} ~ \M{n}{\alpha_1 \. \alpha_k}@ $$\bm{X} ~ \M{n}{\alpha_1 \. \alpha_k}$$
+
+\pagebreak
+
+To compute critical values for the Normal distribution, create the
+NCRIT program for your TI-83 (or equivalent) calculator. At each step, the
+calculator display is shown, followed by what you should do (\Rect\ is the
+cursor):\\
+\Rect\\
+\Prgm\to@NEW@\to@1:Create New@\\
+@Name=@\Rect\\
+NCRIT\Enter\\
+@:@\Rect\\
+\Prgm\to@I/O@\to@2:Prompt@\\
+@:Prompt@ \Rect\\
+\Alpha[A],\Alpha[T]\Enter\\
+@:@\Rect\\
+\Distr\to@DISTR@\to@3:invNorm(@\\
+@:invNorm(@\Rect\\
+1-(\Alpha[A]$\div$\Alpha[T]))\Sto\Alpha[C]\Enter\\
+@:@\Rect\\
+\Prgm\to@I/O@\to@3:Disp@\\
+@:Disp@ \Rect\\
+\Alpha[C]\Enter\\
+@:@\Rect\\
+\Quit\\
+
+Suppose @A@ is $\alpha$ and @T@ is the number of tails. To run the program:\\
+\Rect\\
+\Prgm\to@EXEC@\to@NCRIT@\\
+@prgmNCRIT@\Rect\\
+\Enter\\
+@A=?@\Rect\\
+0.05\Enter\\
+@T=?@\Rect\\
+2\Enter\\
+@1.959963986@
+\end{document}
+
diff --git a/macros/latex/contrib/statex2/statex2.sty b/macros/latex/contrib/statex2/statex2.sty
new file mode 100644
index 0000000000..74c085d48b
--- /dev/null
+++ b/macros/latex/contrib/statex2/statex2.sty
@@ -0,0 +1,483 @@
+%%
+%% This is file `statex2.sty'.
+%%
+%% Copyright (C) 2008-2011 by Rodney A Sparapani <rsparapa@mcw.edu>
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.2
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.2 or later is part of all distributions of LaTeX
+%% version 1999/12/01 or later.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{statex2}[2011/09/14 v2.1 a statistics style for latex]
+\RequirePackage{ifthen}
+\RequirePackage{amsmath}
+\RequirePackage{amssymb}
+\RequirePackage{bm}
+\RequirePackage{color}
+%\RequirePackage[dvipsnames,usenames]{color}
+
+%begin: borrowed from upgreek; thanks to Walter Schmidt <was@VR-Web.de>
+%use Adobe Symbol for upright pi (constant)
+ \DeclareSymbolFont{ugrf@m}{U}{psy}{m}{n}
+ \DeclareMathSymbol{\cpi}{\mathord}{ugrf@m}{`p}
+%to use Euler Roman comment previous lines and uncomment rest of block
+% \DeclareFontFamily{U}{eur}{\skewchar\font'177}
+% \DeclareFontShape{U}{eur}{m}{n}{%
+% <-6> eurm5 <6-8> eurm7 <8-> eurm10}{}
+% \DeclareFontShape{U}{eur}{b}{n}{%
+% <-6> eurb5 <6-8> eurb7 <8-> eurb10}{}
+% \DeclareSymbolFont{ugrf@m}{U}{eur}{m}{n}
+% \SetSymbolFont{ugrf@m}{bold}{U}{eur}{b}{n}
+% \DeclareMathSymbol{\cpi}{\mathord}{ugrf@m}{"19}
+%end
+
+%option(s);
+%autobold: presentations look better and now easier to create;
+
+%\let\usc@dischyph\@dischyph
+%\DeclareOption{nohyphen}{\def\usc@dischyph{\discretionary{}{}{}}}
+
+\newif\if@manualbold
+\DeclareOption{manualbold}{\@manualboldtrue}
+\DeclareOption{autobold}{\@manualboldfalse}
+\ExecuteOptions{manualbold}
+\ProcessOptions\relax
+
+%new commands
+\DeclareMathAlphabet{\sfsl}{OT1}{cmss}{m}{sl}
+%the next command seems to have no effect when used in conjunction with bm!?!
+\SetMathAlphabet{\sfsl}{bold}{OT1}{cmss}{bx}{sl}
+
+\DeclareRobustCommand*{\mb}[1]{\if@manualbold{#1}\else\bm{#1}\fi}
+
+%\DeclareMathOperator{\diag}{diag}
+%\DeclareMathOperator{\blockdiag}{blockdiag}
+%\DeclareMathOperator{\erf}{erf}
+%\DeclareMathOperator{\logit}{logit}
+
+\DeclareRobustCommand*{\diag}{\mb{\mathrm{diag}}}
+\DeclareRobustCommand*{\blockdiag}{\mb{\mathrm{blockdiag}}}
+\DeclareRobustCommand*{\erf}{\mb{\mathrm{erf}}}
+\DeclareRobustCommand*{\logit}{\mb{\mathrm{logit}}}
+\DeclareRobustCommand*{\trace}{\mb{\mathrm{trace}}}
+
+\DeclareRobustCommand*{\chisq}{\ifmmode\mb{\chi^2}\else$\mb{\chi^2}$\fi}
+\DeclareRobustCommand*{\deriv}[2]{\mb{\frac{\d{}}{\d{#1}}}\wrap{\mb{#2}}}
+\DeclareRobustCommand*{\derivf}[2]{\mb{\frac{\d{}}{\d{#2}}}\wrap{\mb{#1}}}
+\DeclareRobustCommand*{\e}[1]{\mb{\mathrm{e}^{#1}}}
+\DeclareRobustCommand*{\E}[2][]{\mb{\mathrm{E}}\ifthenelse{\equal{#1}{}}{}{_{\mb{#1}}} \wrap{\mb{#2}}}
+\DeclareRobustCommand*{\ha}{{\mb{\frac{\alpha}{2}}}}
+\DeclareRobustCommand*{\I}[2][]{\mb{\mathrm{I}}\ifthenelse{\equal{#1}{}}{}{_{\mb{#1}}} \wrap[()]{\mb{#2}}}
+\DeclareRobustCommand*{\IBeta}[2]{\mb{\frac{\Gamma[#1+#2]}{\Gamma[#1]\Gamma[#2]}}}
+\DeclareRobustCommand*{\If}{\;\mb{\mathrm{if}}\;}
+\DeclareRobustCommand*{\im}{\mb{\mathrm{i}}}
+\DeclareRobustCommand*{\ol}{\overline}
+\DeclareRobustCommand*{\ow}{\;\mb{\mathrm{otherwise}}\;}
+\DeclareRobustCommand*{\pderiv}[2]{\mb{\frac{\partial}{\partial #1}}\wrap{\mb{#2}}}
+\DeclareRobustCommand*{\pderivf}[2]{\mb{\frac{\partial}{\partial #2}}\wrap{\mb{#1}}}
+\DeclareRobustCommand*{\sd}{\mb{\sigma}}
+\DeclareRobustCommand*{\ul}{\underline}
+\DeclareRobustCommand*{\V}[2][]{\mb{\mathrm{V}}\ifthenelse{\equal{#1}{}}{}{_{\mb{#1}}} \wrap{\mb{#2}}}
+\DeclareRobustCommand*{\vs}{\;\mb{\mathrm{vs.}}\;}
+\DeclareRobustCommand*{\where}{\;\mb{\mathrm{where}}\;}
+\DeclareRobustCommand*{\wrap}[2][]%
+{\ifthenelse{\equal{#1}{}}{\left[ #2 \right]}%
+{\ifthenelse{\equal{#1}{()}}{\left( #2 \right)}%
+{\ifthenelse{\equal{#1}{\{\}}}{\left\{ #2 \right\}}%
+%{\ifthenelse{\equal{#1}{(.}}{\left( #2 \right.}%
+%{\ifthenelse{\equal{#1}{[.}}{\left[ #2 \right.}%
+{\ifthenelse{\equal{#1}{\{.}}{\left\{ #2 \right.}{}}}}}
+
+%old commands that may be of historical interest
+%\newcommand*{\ij}{{i,j}}
+%\newcommand*{\xy}{{xy}}
+%\newcommand*{\XY}{{XY}}
+%\newcommand*{\n}[1][]{_{n #1}}
+%\def\bp(#1){\left(#1\right)}
+%\def~{\relax\ifmmode\sim\else\nobreakspace{}\fi}
+
+%re-definitions
+\renewcommand*{~}{\relax\ifmmode\mb{\sim}\else\nobreakspace{}\fi}
+
+\DeclareRobustCommand*{\iid}{\;\stackrel{\mb{\mathrm{iid}}}{~}\;}
+\DeclareRobustCommand*{\ind}{\;\stackrel{\mb{\mathrm{ind}}}{~}\;}
+\DeclareRobustCommand*{\indpr}{\;\stackrel{\mb{\mathrm{ind}}}{\stackrel{\mb{\mathrm{prior}}}{~}}\;}
+\DeclareRobustCommand*{\post}{\;\stackrel{\mb{\mathrm{post}}}{~}\;}
+\DeclareRobustCommand*{\prior}{\;\stackrel{\mb{\mathrm{prior}}}{~}\;}
+
+%\let\STATEXi=\i
+%\renewcommand*{\i}[1][]{\ifthenelse{\equal{#1}{}}{\STATEXi}{_{i #1}}}
+
+\let\STATEXGamma=\Gamma
+\renewcommand*{\Gamma}[1][]{\mb{\STATEXGamma}\ifthenelse{\equal{#1}{}}{}{\wrap[()]{\mb{#1}}}}
+
+\let\STATEXand=\and
+\renewcommand*{\and}{\relax\ifmmode\expandafter\;\mb{\mathrm{and}}\;\else\expandafter\STATEXand\fi}
+
+\let\STATEXH=\H
+\renewcommand*{\H}{\relax\ifmmode\expandafter\mb{\mathrm{H}}\else\expandafter\STATEXH\fi}
+
+\let\STATEXP=\P
+\renewcommand*{\P}[2][]{\ifthenelse{\equal{#2}{}}{\STATEXP}%
+{\mb{\mathrm{P}}\ifthenelse{\equal{#1}{}}{}{_{\mb{#1}}}\wrap{\mb{#2}}}}
+
+\renewcommand*{\|}{\relax\ifmmode\expandafter\mb{\mid}\else\expandafter$\mb{\mid}$\fi}
+
+%%Discrete distributions
+%declarations
+\DeclareRobustCommand*{\B}[1]{\mb{\mathrm{B}}\wrap[()]{\mb{#1}}}
+\DeclareRobustCommand*{\BB}[1]{\mb{\mathrm{BetaBin}}\wrap[()]{\mb{#1}}}
+\DeclareRobustCommand*{\Bin}[2]{\mb{\mathrm{Bin}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\Dir}[1]{\mb{\mathrm{Dirichlet}}\wrap[()]{\mb{#1}}}
+\DeclareRobustCommand*{\HG}[3]{\mb{\mathrm{Hypergeometric}}\wrap[()]{\mb{#1,\ #2,\ #3}}}
+\DeclareRobustCommand*{\M}[2]{\mb{\mathrm{Multinomial}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\NB}[2]{\mb{\mathrm{NegBin}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\Poi}[1]{\mb{\mathrm{Poisson}}\wrap[()]{\mb{#1}}}
+\let\Poisson=\Poi
+
+%probability mass functions
+\DeclareRobustCommand*{\pBB}[4][x]{\mb{\frac{\Gamma[#2+1]\Gamma[#3+#1]\Gamma[#2+#4-#1]\Gamma[#3+#4]}%
+{\Gamma[#1+1]\Gamma[#2-#1+1]\Gamma[#2+#3+#4]\Gamma[#3]\Gamma[#4]}%
+\I[#1]{\{0, 1,\., #2\}}, \where #3>0,\; #4>0 \and n=1, 2,\.}}
+\DeclareRobustCommand*{\pBin}[3][x]{\mb{\binom{#2}{#1}#3^#1} \wrap[()]{\mb{{1-#3}^{#2-#1}}}%
+\mb{\I[#1]{\{0,1,\.,#2\}}, \where p \in (0, 1) \and n=1, 2,\.}}
+\DeclareRobustCommand*{\pPoi}[2][x]{\mb{\frac{1}{#1!}#2^{#1}\e{-#2}\I[#1]{\{0, 1,\.\}}, \where #2>0}}
+
+%%Continuous distributions
+%declarations
+\DeclareRobustCommand*{\Cau}[2]{\mb{\mathrm{Cauchy}}\wrap[()]{\mb{#1,\ #2}}}
+\let\Cauchy=\Cau
+\DeclareRobustCommand*{\Chi}[2][]{\chisq\ifthenelse{\equal{#1}{}}{}{_\mb{#1}}\wrap[()]{\mb{#2}}}
+%\DeclareRobustCommand*{\Chi}[1]{\chisq\wrap[()]{\mb{#1}}}
+\let\Chisq=\Chi
+\DeclareRobustCommand*{\Bet}[2]{\mb{\mathrm{Beta}}\wrap[()]{\mb{#1,\ #2}}}
+\let\Beta=\Bet
+\DeclareRobustCommand*{\Exp}[1]{\mb{\mathrm{Exp}}\wrap[()]{\mb{#1}}}
+\DeclareRobustCommand*{\F}[2]{\mb{\mathrm{F}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\Gam}[2]{\mb{\mathrm{Gamma}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\IC}[1]{\mb{\mathrm{\chi^{-2}}}\wrap[()]{\mb{#1}}}
+\DeclareRobustCommand*{\IG}[2]{\mb{\mathrm{Gamma^{-1}}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\IW}[2]{\mb{\mathrm{Wishart^{-1}}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\Log}[2]{\mb{\mathrm{Logistic}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\LogN}[2]{\mb{\mathrm{Log\!-\!N}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\N}[3][]{\mb{\mathrm{N}}\ifthenelse{\equal{#1}{}}{}{_{\mb{#1}}}\wrap[()]{\mb{#2,\ #3}}}
+\DeclareRobustCommand*{\Par}[2]{\mb{\mathrm{Pareto}}\wrap[()]{\mb{#1,\ #2}}}
+\let\Pareto=\Par
+\DeclareRobustCommand*{\Tsq}[2]{\mb{\mathrm{T^2}}\wrap[()]{\mb{#1,\ #2}}}
+\DeclareRobustCommand*{\U}[1]{\mb{\mathrm{U}}\wrap[()]{\mb{#1}}}
+\DeclareRobustCommand*{\W}[2]{\mb{\mathrm{Wishart}}\wrap[()]{\mb{#1,\ #2}}}
+
+\let\STATEXt=\t
+\renewcommand*{\t}[1]{\relax\ifmmode\expandafter\mb{\mathrm{t}}\wrap[()]{\mb{#1}}%
+\else\expandafter\STATEXt{#1}\fi}
+
+%probability density functions
+\DeclareRobustCommand*{\pBet}[3][x]{\IBeta{#2}{#3}%
+#1^{#2-1}\wrap[()]{1-#1}^{#3-1}\I[#1]{0,\ 1}, \where #2>0 \and #3>0}
+\DeclareRobustCommand*{\pCau}[3][x]{\ifthenelse{\equal{#2, #3}{0, 1}}{\frac{1}{\cpi\wrap[()]{1+#1}^2}}%
+{\frac{1}{#3\cpi\left\{1+\wrap{\wrap[()]{x-#2}/#3}^2\right\}}, \where #3>0}}
+\DeclareRobustCommand*{\pChi}[2][x]{\frac{2^{-#2/2}}{\Gamma[#2/2]}#1^{#2/2-1}\e{-#1/2}%
+\I[#1]{0,\infty}, \where #2>0}
+\DeclareRobustCommand*{\pExp}[2][x]{\frac{1}{#2}\e{-#1/#2}\I[#1]{0,\infty},%
+\where #2>0}
+\DeclareRobustCommand*{\pGam}[3][x]{\frac{#3^{#2}}{\Gamma[#2]}#1^{#2-1}\e{-#3#1}%
+\I[#1]{0,\infty}, \where #2>0 \and #3>0}
+\DeclareRobustCommand*{\pN}[3][x]{\ifthenelse{\equal{#2, #3}{0, 1}}%
+{\frac{1}{\sqrt{2\cpi}}\e{-#1^2/2}}%
+{\frac{1}{\sqrt{2\cpi#3}}\e{-\wrap[()]{#1-#2}^2/2#3}}}
+\DeclareRobustCommand*{\pPar}[3][x]{\frac{#3}{#2\wrap[()]{1+#1/#2}^{#3+1}}\I[#1]{0,\infty},%
+\where #2>0 \and #3>0}
+\DeclareRobustCommand*{\pU}[3][x]{\ifthenelse{\equal{#2, #3}{0, 1}}{\I[#1]{0,\ 1}}%
+{\frac{1}{#3-#2}\I[#1]{#2,\ #3}, \where #2<#3}}
+
+%re-define other accents
+\let\STATEXequal=\=
+\renewcommand*{\=}{\relax\ifmmode\expandafter\bar\else\expandafter\STATEXequal\fi}
+\let\STATEXhat=\^
+\renewcommand*{\^}{\relax\ifmmode\expandafter\widehat\else\expandafter\STATEXhat\fi}
+\let\STATEXtilde=\~
+\renewcommand*{\~}{\relax\ifmmode\expandafter\widetilde\else\expandafter\STATEXtilde\fi}
+\let\STATEXsinglequote=\'
+\renewcommand*{\'}[1]{\relax\ifmmode\expandafter{\wrap[()]{\mb{#1}}}\else\expandafter\STATEXsinglequote{#1}\fi}
+\let\STATEXb=\b
+\renewcommand*{\b}{\relax\ifmmode\expandafter\bar\else\expandafter\STATEXb\fi}
+\let\STATEXc=\c
+\renewcommand*{\c}[1]{\relax\ifmmode\expandafter\mb{\mathrm{#1}}\else\expandafter\STATEXc{#1}\fi}
+\let\STATEXd=\d
+\renewcommand*{\d}[1]{\relax\ifmmode\expandafter\,\mb{\mathrm{d}\ifthenelse{\equal{#1}{}}{}{#1}}\else\expandafter\STATEXd{#1}\fi}
+\let\STATEXdot=\.
+\renewcommand*{\.}{\relax\ifmmode\expandafter\mb{\ldots}\else\expandafter\STATEXdot\fi}
+% warning: \dots is not a replacement for \ldots since \bm{\dots} creates an error
+
+%commands to create documentation for TI-83 calculators
+\newcommand*{\Alpha}[1][]{{\fcolorbox{black}{ForestGreen}{\color{white}\textsf{ALPHA}}}\textbf{\color{ForestGreen}\textsf{#1}}}
+\newcommand*{\Alock}{\Snd[A-LOCK]}
+\newcommand*{\Blackbox}{\relax\ifmmode\expandafter\blacksquare\else\expandafter$\blacksquare$\fi}
+\newcommand*{\Distr}{\Snd[DISTR]}
+\newcommand*{\Down}{\framebox{\footnotesize$^\Downarrow$}}
+\newcommand*{\EE}{\Snd[EE]}
+\newcommand*{\Enter}{\framebox{\textsf{ENTER}}}
+\newcommand*{\Graph}{\framebox{\textsf{GRAPH}}}
+\newcommand*{\List}[1]{\textbf{\color{Dandelion}\textsf{$\text{L}_#1$}}}
+\newcommand*{\Left}{\framebox{$^\Leftarrow$}}
+\newcommand*{\Math}{\framebox{\textsf{MATH}}}
+\newcommand*{\Matrx}{\Snd[MATRX]}
+\newcommand*{\Prgm}{\framebox{\textsf{PRGM}}}
+\newcommand*{\Quit}{\Snd[QUIT]}
+\newcommand*{\Rect}{\rule{4pt}{6pt}}
+\newcommand*{\Right}{\framebox{$^\Rightarrow$}}
+\newcommand*{\Snd}[1][]{{\fcolorbox{black}{Dandelion}{\color{white}\textsf{2nd}}}\textbf{\color{Dandelion}\textsf{#1}}}
+\newcommand*{\Solve}{\Alpha[SOLVE]}
+\newcommand*{\Stat}{\framebox{\textsf{STAT}}}
+\newcommand*{\Statplot}{\Snd[STAT PLOT]}
+\newcommand*{\Sto}{\framebox{\textsf{STO}$\Rightarrow$}}
+\newcommand*{\Signm}{\framebox{\textsf{(-)}}}
+\newcommand*{\Up}{\framebox{\footnotesize$^\Uparrow$}}
+\newcommand*{\Window}{\framebox{\textsf{WINDOW}}}
+
+\let\STATEXBox=\Box
+\renewcommand*{\Box}{\relax\ifmmode\expandafter\STATEXBox\else\expandafter$\STATEXBox$\fi}
+
+\let\STATEXto=\to
+\renewcommand*{\to}{\relax\ifmmode\expandafter\STATEXto\else\expandafter$\STATEXto$\fi}
+
+\endinput
+
+\documentclass[dvipsnames,usenames]{report}
+%\documentclass[dvipsnames,usenames,autobold]{report}
+\usepackage{statex2}
+\usepackage{shortvrb}
+\MakeShortVerb{@}
+% Examples
+\begin{document}
+
+Many accents have been re-defined
+
+@ c \c{c} \pi \cpi@ $$ c \c{c} \pi \cpi$$ %upright constants like the speed of light and 3.14159...
+
+@int \e{\im x} \d{x}@ $$\int \e{\im x} \d{x}$$ %\d{x}; also note new commands \e and \im
+
+@\^{\beta_1}=b_1@ $$\^{\beta_1}=b_1$$
+
+@\=x=\frac{1}{n}\sum x_i@ $$\=x=\frac{1}{n}\sum x_i$$ %also, \b{x}, but see \ol{x} below
+
+@\b{x} = \frac{1}{n} \wrap[()]{x_1 +\.+ x_n}@ $$\b{x} = \frac{1}{n} \wrap[()]{x_1 +\.+ x_n}$$
+
+Sometimes overline is better: @\b{x} \vs \ol{x}@ $$\b{x} \vs \ol{x}$$
+
+And, underlines are nice too: @\ul{x}@ $$\ul{x}$$
+
+Derivatives and partial derivatives:
+
+@\deriv{x}{x^2+y^2}@ $$\deriv{x}{x^2+y^2}$$
+@\pderiv{x}{x^2+y^2}@ $$\pderiv{x}{x^2+y^2}$$
+
+Or, rather, in the order of @\frac@:
+
+@\derivf{x^2+y^2}{x}@ $$\derivf{x^2+y^2}{x}$$
+@\pderivf{x^2+y^2}{x}@ $$\pderivf{x^2+y^2}{x}$$
+
+A few other nice-to-haves:
+
+@\chisq@ $$\chisq$$
+
+@\Gamma[n+1]=n!@ $$\Gamma[n+1]=n!$$
+
+@\binom{n}{x}@ $$\binom{n}{x}$$ %provided by amsmath package
+
+@\e{x}@ $$\e{x}$$
+
+@\H_0: \mu=0 \vs \H_1: \mu \neq 0 (\neg \H_0) @ $$\H_0: \mu=0 \vs \H_1: \mu \neq 0 (\neg \H_0) $$
+
+@\logit \wrap{p} = \log \wrap{\frac{p}{1-p}}@ $$\logit \wrap{p} = \log \wrap{\frac{p}{1-p}}$$
+\pagebreak
+Common distributions along with other features follows:
+
+Normal Distribution
+
+@Z ~ \N{0}{1}, \where \E{Z}=0 \and \V{Z}=1@ $$Z ~ \N{0}{1}, \where \E{Z}=0 \and \V{Z}=1$$
+
+@\P{|Z|>z_\ha}=\alpha@ $$\P{|Z|>z_\ha}=\alpha$$
+
+@\pN[z]{0}{1}@ $$\pN[z]{0}{1}$$
+
+or, in general
+
+@\pN[z]{\mu}{\sd^2}@ $$\pN[z]{\mu}{\sd^2}$$
+
+Sometimes, we subscript the following operations:
+
+@\E[z]{Z}=0, \V[z]{Z}=1, \and \P[z]{|Z|>z_\ha}=\alpha@
+$$\E[z]{Z}=0, \V[z]{Z}=1, \and \P[z]{|Z|>z_\ha}=\alpha$$
+
+Multivariate Normal Distribution
+
+@\bm{X} ~ \N[p]{\bm{\mu}}{\sfsl{\Sigma}}@ $$\bm{X} ~ \N[p]{\bm{\mu}}{\sfsl{\Sigma}}$$
+%\bm provided by the bm package
+
+Chi-square Distribution
+
+@Z_i \iid \N{0}{1}, \where i=1 ,\., n@ $$Z_i \iid \N{0}{1}, \where i=1 ,\., n$$
+
+@\chisq = \sum_i Z_i^2 ~ \Chi{n}@ $$\chisq = \sum_i Z_i^2 ~ \Chi{n}$$
+
+@\pChi[z]{n}@ $$\pChi[z]{n}$$
+
+t Distribution
+
+@\frac{\N{0}{1}}{\sqrt{\frac{\Chisq{n}}{n}}} ~ \t{n}@
+$$\frac{\N{0}{1}}{\sqrt{\frac{\Chisq{n}}{n}}} ~ \t{n}$$
+\pagebreak
+F Distribution
+
+@X_i, Y_{\~i} \iid \N{0}{1} \where i=1 ,\., n; \~i=1 ,\., m \and \V{X_i, Y_{\~i}}=\sd_{xy}=0@
+$$X_i, Y_{\~i} \iid \N{0}{1} \where i=1 ,\., n; \~i=1 ,\., m \and \V{X_i, Y_{\~i}}=\sd_{xy}=0$$
+
+@\chisq_x = \sum_i X_i^2 ~ \Chi{n}@ $$\chisq_x = \sum_i X_i^2 ~ \Chi{n}$$
+
+@\chisq_y = \sum_{\~i} Y_{\~i}^2 ~ \Chi{m}@ $$\chisq_y = \sum_{\~i} Y_{\~i}^2 ~ \Chi{m}$$
+
+@\frac{\chisq_x}{\chisq_y} ~ \F{n}{m}@ $$\frac{\chisq_x}{\chisq_y} ~ \F{n}{m}$$
+
+Beta Distribution
+
+@B=\frac{\frac{n}{m}F}{1+\frac{n}{m}F} ~ \Bet{\frac{n}{2}}{\frac{m}{2}}@
+$$B=\frac{\frac{n}{m}F}{1+\frac{n}{m}F} ~ \Bet{\frac{n}{2}}{\frac{m}{2}}$$
+
+@\pBet{\alpha}{\beta}@ $$\pBet{\alpha}{\beta}$$
+
+Gamma Distribution
+
+@G ~ \Gam{\alpha}{\beta}@ $$G ~ \Gam{\alpha}{\beta}$$
+
+@\pGam{\alpha}{\beta}@ $$\pGam{\alpha}{\beta}$$
+
+Cauchy Distribution
+
+@C ~ \Cau{\theta}{\nu}@ $$C ~ \Cau{\theta}{\nu}$$
+
+@\pCau{\theta}{\nu}@ $$\pCau{\theta}{\nu}$$
+
+Uniform Distribution
+
+@X ~ \U{0, 1}@ $$X ~ \U{0, 1}$$
+
+@\pU{0}{1}@ $$\pU{0}{1}$$
+
+or, in general
+
+@\pU{a}{b}@ $$\pU{a}{b}$$
+
+Exponential Distribution
+
+@X ~ \Exp{\lambda}@ $$X ~ \Exp{\lambda}$$
+
+@\pExp{\lambda}@ $$\pExp{\lambda}$$
+
+Hotelling's $T^2$ Distribution
+
+@X ~ \Tsq{\nu_1}{\nu_2}@ $$X ~ \Tsq{\nu_1}{\nu_2}$$
+
+Inverse Chi-square Distribution
+
+@X ~ \IC{\nu}@ $$X ~ \IC{\nu}$$
+
+Inverse Gamma Distribution
+
+@X ~ \IG{\alpha}{\beta}@ $$X ~ \IG{\alpha}{\beta}$$
+
+Pareto Distribution
+
+@X ~ \Par{\alpha}{\beta}@ $$X ~ \Par{\alpha}{\beta}$$
+
+@\pPar{\alpha}{\beta}@ $$\pPar{\alpha}{\beta}$$
+
+Wishart Distribution
+
+@\sfsl{X} ~ \W{\nu}{\sfsl{S}}@ $$\sfsl{X} ~ \W{\nu}{\sfsl{S}}$$
+
+Inverse Wishart Distribution
+
+@\sfsl{X} ~ \IW{\nu}{\sfsl{S^{-1}}}@ $$\sfsl{X} ~ \IW{\nu}{\sfsl{S^{-1}}}$$
+
+Binomial Distribution
+
+@X ~ \Bin{n}{p}@ $$X ~ \Bin{n}{p}$$
+
+%@\pBin{n}{p}@ $$\pBin{n}{p}$$
+
+Bernoulli Distribution
+
+@X ~ \B{p}@ $$X ~ \B{p}$$
+
+Beta-Binomial Distribution
+
+@X ~ \BB{p}@ $$X ~ \BB{p}$$
+
+%@\pBB{n}{\alpha}{\beta}@ $$\pBB{n}{\alpha}{\beta}$$
+
+Negative-Binomial Distribution
+
+@X ~ \NB{n}{p}@ $$X ~ \NB{n}{p}$$
+
+Hypergeometric Distribution
+
+@X ~ \HG{n}{M}{N}@ $$X ~ \HG{n}{M}{N}$$
+
+Poisson Distribution
+
+@X ~ \Poi{\mu}@ $$X ~ \Poi{\mu}$$
+
+%@\pPoi{\mu}@ $$\pPoi{\mu}$$
+
+Dirichlet Distribution
+
+@\bm{X} ~ \Dir{\alpha_1 \. \alpha_k}@ $$\bm{X} ~ \Dir{\alpha_1 \. \alpha_k}$$
+
+Multinomial Distribution
+
+@\bm{X} ~ \M{n}{\alpha_1 \. \alpha_k}@ $$\bm{X} ~ \M{n}{\alpha_1 \. \alpha_k}$$
+
+\pagebreak
+
+To compute critical values for the Normal distribution, create the
+NCRIT program for your TI-83 (or equivalent) calculator. At each step, the
+calculator display is shown, followed by what you should do (\Rect\ is the
+cursor):\\
+\Rect\\
+\Prgm\to@NEW@\to@1:Create New@\\
+@Name=@\Rect\\
+NCRIT\Enter\\
+@:@\Rect\\
+\Prgm\to@I/O@\to@2:Prompt@\\
+@:Prompt@ \Rect\\
+\Alpha[A],\Alpha[T]\Enter\\
+@:@\Rect\\
+\Distr\to@DISTR@\to@3:invNorm(@\\
+@:invNorm(@\Rect\\
+1-(\Alpha[A]$\div$\Alpha[T]))\Sto\Alpha[C]\Enter\\
+@:@\Rect\\
+\Prgm\to@I/O@\to@3:Disp@\\
+@:Disp@ \Rect\\
+\Alpha[C]\Enter\\
+@:@\Rect\\
+\Quit\\
+
+Suppose @A@ is $\alpha$ and @T@ is the number of tails. To run the program:\\
+\Rect\\
+\Prgm\to@EXEC@\to@NCRIT@\\
+@prgmNCRIT@\Rect\\
+\Enter\\
+@A=?@\Rect\\
+0.05\Enter\\
+@T=?@\Rect\\
+2\Enter\\
+@1.959963986@
+\end{document}
+