From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/statex2/statex2-example.tex | 232 +++++++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 macros/latex/contrib/statex2/statex2-example.tex (limited to 'macros/latex/contrib/statex2/statex2-example.tex') 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} + -- cgit v1.2.3