Stata notes for Wild and Seber: Chance encounters

Nicholas J. Cox, University of Durham, UK, July 2003

General notes

1. The website for Stata is http://www.stata.com

2. In Stata 8, dialog boxes for any command can be obtained by typing db cmdname where cmdname is the first word of each command. For example, for sample type db sample; for graph box type db graph and follow links. At the time of writing, there is no dialog box for the user-written commands below.

3. User-written software mentioned can be installed in up-to-date web-aware Stata by ssc install cmdname

Specific commands

p.7 sample draws a sample without replacement

pp.48, 118 onewayplot (user-written, Stata 8); graph, oneway (previous versions)

p.52 stem

p.57 histogram (Stata 8); graph, histogram (previous versions)

pp.61, 69 summarize, detail is the nearest equivalent of this Minitab command

pp.73, 122 graph box (vertical) and graph hbox (horizontal) (Stata 8); graph, box (previous versions)

p.79 graph bar (vertical) and graph hbar (horizontal) for bar charts in general; histogram with the discrete option for histograms of discrete variables and catplot for bar charts showing frequencies of categorical data (user-written, either vertical or horizontal) (all Stata 8); graph, bar and hist (previous versions)

pp.79, 125 tabulate and table for tables of frequencies

p.103 scatter and other twoway types (Stata 8); graph, twoway (previous versions)

p.207ff use the display command for individual probability calculations

p.207 display Binomial(n,x,p) gives pr(X ≥ x) given n trials and probability of success p for a binomial

p.208 display 1 - Binomial(1500,325,0.2) gives 0.94205228

p.241 display norm((x - mean) / sd) gives pr(X ≥ x) given mean and sd for a normal distribution

p.245 display 162.7 + 6.2 * invnorm(0.8) gives 167.91805

p.288 display invnorm((3.55 - 3) / 0.18805)

p.310 display ttail(7,1.5) returns .08864924; display 1 - ttail(7,1.5) returns .91135076; hence the number of degrees of freedom is the first argument

p.312 display invttail(7,0.05) returns 1.8945786; hence the number of degrees of freedom is the first argument

pp.335-6 ci produces t-based confidence intervals

p.410 ttest produces t-tests

pp.413-4 qnorm produces normal probability plots; swilk what Stata calls the Shapiro-Wilk test

p.425 signtest for sign test and signrank for signed ranks test

p.432 ttest allows unequal and welch as options (unequal by itself uses Satterthwaite's approximation)

p.433 ranksum for Wilcoxon-Mann-Whitney test

p.437 various multiple comparison procedures (but not Fisher or Tukey) available after oneway

p.438 anova (general) or oneway (one-way)

p.441 kwallis for Kruskal-Wallis and robvar for Levene's test

p.470 display chiprob(5,7.54) gives P-value directly; hence the number of degrees of freedom is the first argument

p.471 chitesti 26 40 37 26 43 38 gives this test directly (chitesti is a user-written program, which may be installed by ssc install tab_chi)

pp.486-487 tabulate will give the chi-square test for a two-way table of counts

p.510 lowess (version 8); ksm (previous versions)

p.519 regress for numeric output (all versions); twoway lfit in conjunction with twoway scatter for graph output (Stata 8)

p.534 twoway lfitci shows a graph with prediction intervals (Stata 8)

p.537 rvfplot for residual vs fitted plot, rvpplot for residual vs predictor plot; other residual plots also available

p.541 correlate shows the correlation