summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/statex2/statex2-example.tex
blob: c640bbefcc157949899ab9bba8ceb75b2785bd80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
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}