Debian Codegraph @

texmf-dist/doc/latex/statex/statex-example.tex

raw
1 \documentclass[dvipsnames,usenames]{report}
2 \usepackage{statex}
3 \usepackage{shortvrb}
4 \MakeShortVerb{@}
5 % Examples
6 \begin{document}
7 Many accents have been re-defined
8
9 @ c \c{c} \pi \cpi@ $$ c \c{c} \pi \cpi$$ %upright constants like the speed of light and 3.14159...
10
11 @int \e{\im x} \d{x}@ $$\int \e{\im x} \d{x}$$ %\d{x}; also note new commands \e and \im
12
13 @\^{\beta_1}=b_1@ $$\^{\beta_1}=b_1$$
14
15 @\=x=\frac{1}{n}\sum x_i@ $$\=x=\frac{1}{n}\sum x_i$$ %also, \b{x}, but see \ol{x} below
16
17 @\b{x} = \frac{1}{n} \wrap[()]{x_1 +\.+ x_n}@ $$\b{x} = \frac{1}{n} \wrap[()]{x_1 +\.+ x_n}$$
18
19 Sometimes overline is better: @\b{x}\ vs.\ \ol{x}@ $$\b{x}\ vs.\ \ol{x}$$
20
21 And, underlines are nice too: @\ul{x}@ $$\ul{x}$$
22
23 A few other nice-to-haves:
24
25 @\Gamma[n+1]=n!@ $$\Gamma[n+1]=n!$$
26
27 @\binom{n}{x}@ $$\binom{n}{x}$$ %provided by amsmath package
28
29 @\e{x}@ $$\e{x}$$
30
31 %$\H_0: \mu_\ij=0$ vs. $\H_1: \mu_\ij \neq 0$ %\ijk too
32
33 @\logit \wrap{p} = \log \wrap{\frac{p}{1-p}}@ $$\logit \wrap{p} = \log \wrap{\frac{p}{1-p}}$$
34 \pagebreak
35 Common distributions along with other features follows:
36
37 Normal Distribution
38
39 @Z ~ \N{0}{1}, \where \E{Z}=0 \and \V{Z}=1@ $$Z ~ \N{0}{1}, \where \E{Z}=0 \and \V{Z}=1$$
40
41 @\P{|Z|>z_\ha}=\alpha@ $$\P{|Z|>z_\ha}=\alpha$$
42
43 @\pN[z]{0}{1}@ $$\pN[z]{0}{1}$$
44
45 or, in general
46
47 @\pN[z]{\mu}{\sd^2}@ $$\pN[z]{\mu}{\sd^2}$$
48
49 Sometimes, we subscript the following operations:
50
51 @\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$$
52
53 Multivariate Normal Distribution
54
55 @\bm{X} ~ \N[p]{\bm{\mu}}{\sfsl{\Sigma}}@ $$\bm{X} ~ \N[p]{\bm{\mu}}{\sfsl{\Sigma}}$$ %\bm provided by the bm package
56
57 Chi-square Distribution
58
59 @Z_i \iid \N{0}{1}, \where i=1 ,\., n@ $$Z_i \iid \N{0}{1}, \where i=1 ,\., n$$
60
61 @\chisq = \sum_i Z_i^2 ~ \Chi{n}@ $$\chisq = \sum_i Z_i^2 ~ \Chi{n}$$
62
63 @\pChi[z]{n}@ $$\pChi[z]{n}$$
64
65 t Distribution
66
67 @\frac{\N{0}{1}}{\sqrt{\frac{\Chisq{n}}{n}}} ~ \t{n}@ $$\frac{\N{0}{1}}{\sqrt{\frac{\Chisq{n}}{n}}} ~ \t{n}$$
68 \pagebreak
69 F Distribution
70
71 @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$$%\XY too
72
73 @\chisq_x = \sum_i X_i^2 ~ \Chi{n}@ $$\chisq_x = \sum_i X_i^2 ~ \Chi{n}$$
74
75 @\chisq_y = \sum_{\~i} Y_{\~i}^2 ~ \Chi{m}@ $$\chisq_y = \sum_{\~i} Y_{\~i}^2 ~ \Chi{m}$$
76
77 @\frac{\chisq_x}{\chisq_y} ~ \F{n, m}@ $$\frac{\chisq_x}{\chisq_y} ~ \F{n, m}$$
78
79 Beta Distribution
80
81 @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}}$$
82
83 @\pBet{\alpha}{\beta}@ $$\pBet{\alpha}{\beta}$$
84
85 Gamma Distribution
86
87 @G ~ \Gam{\alpha, \beta}@ $$G ~ \Gam{\alpha, \beta}$$
88
89 @\pGam{\alpha}{\beta}@ $$\pGam{\alpha}{\beta}$$
90
91 Cauchy Distribution
92
93 @C ~ \Cau{\theta, \nu}@ $$C ~ \Cau{\theta, \nu}$$
94
95 @\pCau{\theta}{\nu}@ $$\pCau{\theta}{\nu}$$
96
97 Uniform Distribution
98
99 @X ~ \U{0, 1}@ $$X ~ \U{0, 1}$$
100
101 @\pU{0}{1}@ $$\pU{0}{1}$$
102
103 or, in general
104
105 @\pU{a}{b}@ $$\pU{a}{b}$$
106
107 Exponential Distribution
108
109 @X ~ \Exp{\lambda}@ $$X ~ \Exp{\lambda}$$
110
111 @\pExp{\lambda}@ $$\pExp{\lambda}$$
112
113 Hotelling's $T^2$ Distribution
114
115 @X ~ \Tsq{\nu_1, \nu_2}@ $$X ~ \Tsq{\nu_1, \nu_2}$$
116
117 Inverse Chi-square Distribution
118
119 @X ~ \IC{\nu}@ $$X ~ \IC{\nu}$$
120
121 Inverse Gamma Distribution
122
123 @X ~ \IG{\alpha, \beta}@ $$X ~ \IG{\alpha, \beta}$$
124
125 Pareto Distribution
126
127 @X ~ \Par{\alpha, \beta}@ $$X ~ \Par{\alpha, \beta}$$
128
129 @\pPar{\alpha}{\beta}@ $$\pPar{\alpha}{\beta}$$
130
131 Wishart Distribution
132
133 @\sfsl{X} ~ \W{\nu, \sfsl{S}}@ $$\sfsl{X} ~ \W{\nu, \sfsl{S}}$$
134
135 Inverse Wishart Distribution
136
137 @\sfsl{X} ~ \IW{\nu, \sfsl{S^{-1}}}@ $$\sfsl{X} ~ \IW{\nu, \sfsl{S^{-1}}}$$
138
139 Binomial Distribution
140
141 @X ~ \Bin{n, p}@ $$X ~ \Bin{n, p}$$
142
143 @\pBin{n}{p}@ $$\pBin{n}{p}$$
144
145 Bernoulli Distribution
146
147 @X ~ \B{p}@ $$X ~ \B{p}$$
148
149 Beta-Binomial Distribution
150
151 @X ~ \BB{p}@ $$X ~ \BB{p}$$
152
153 @\pBB{n}{\alpha}{\beta}@ $$\pBB{n}{\alpha}{\beta}$$
154
155 Negative-Binomial Distribution
156
157 @X ~ \NB{n, p}@ $$X ~ \NB{n, p}$$
158
159 Hypergeometric Distribution
160
161 @X ~ \HG{n, M, N}@ $$X ~ \HG{n, M, N}$$
162
163 Poisson Distribution
164
165 @X ~ \Poi{\mu}@ $$X ~ \Poi{\mu}$$
166
167 @\pPoi{\mu}@ $$\pPoi{\mu}$$
168
169 Dirichlet Distribution
170
171 @\bm{X} ~ \Dir{\alpha_1 \. \alpha_k}@ $$\bm{X} ~ \Dir{\alpha_1 \. \alpha_k}$$
172
173 Multinomial Distribution
174
175 @\bm{X} ~ \M{n, \alpha_1 \. \alpha_k}@ $$\bm{X} ~ \M{n, \alpha_1 \. \alpha_k}$$
176
177 \pagebreak
178
179 To compute critical values for the Normal distribution, create the
180 NCRIT program for your TI-83 (or equivalent) calculator. At each step, the
181 calculator display is shown, followed by what you should do (\Rect\ is the
182 cursor):\\
183 \Rect\\
184 \Prgm\to@NEW@\to@1:Create New@\\
185 @Name=@\Rect\\
186 NCRIT\Enter\\
187 @:@\Rect\\
188 \Prgm\to@I/O@\to@2:Prompt@\\
189 @:Prompt@ \Rect\\
190 \Alpha[A],\Alpha[T]\Enter\\
191 @:@\Rect\\
192 \Distr\to@DISTR@\to@3:invNorm(@\\
193 @:invNorm(@\Rect\\
194 1-(\Alpha[A]$\div$\Alpha[T]))\Sto\Alpha[C]\Enter\\
195 @:@\Rect\\
196 \Prgm\to@I/O@\to@3:Disp@\\
197 @:Disp@ \Rect\\
198 \Alpha[C]\Enter\\
199 @:@\Rect\\
200 \Quit\\
201
202 Suppose @A@ is $\alpha$ and @T@ is the number of tails. To run the program:\\
203 \Rect\\
204 \Prgm\to@EXEC@\to@NCRIT@\\
205 @prgmNCRIT@\Rect\\
206 \Enter\\
207 @A=?@\Rect\\
208 0.05\Enter\\
209 @T=?@\Rect\\
210 2\Enter\\
211 @1.959963986@
212 \end{document}