Debian Codegraph @

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

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