Wikipedia:WikiProject Statistics/Manual of Style

This manual of style is a style guide for articles within the scope of WikiProject Statistics. It focuses on the notational conventions used within the project, discusses the methods of typesetting of mathematical formulas, the recommended way of organizing the references, etc. The purpose of this manual is to attempt to unify the notation used in different articles within the project, making the exposition more streamlined and easier to follow.

General advice on writing mathematical articles can be found at MOS:MATH, and even more general guide for the writing style on Wikipedia is the WP:MOS.

Mathematical formulas
From the point of view of typesetting, two types of formulas can be used in an article: displayed and inline. The “displayed” formulas are shown as a separate paragraph, indented relative to the main text. For example:

e^{i\theta} = \cos\theta + i\sin\theta\. $$ This format may be used in those cases when the formula is too large to comfortably fit inline, or when it has special importance for the exposition so that placing it in a separate paragraph provides an emphasis.

The “inline” formulas are used in case when the mathematical expression is a natural part of the text, when the formula is not very complicated, and when there is no need to emphasize it by putting into a separate paragraph. For example, in the expression above θ usually represents some angle, e is the Euler’s number, and i is the imaginary unit (in this sentence three formulas were embedded as inline expressions).

Displayed formulas
The code for displayed formulas is written in TeX and placed within the  tags. The WP:MATH guide provides an excellent reference on TeX language. To put a formula on a separate line, precede it with a colon, like this: : $$   {...formula...} $$

Although technically the colon starts a new paragraph, there should be no line breaks before or after the formula unless it logically starts or ends the paragraph (typically a formula, even if displayed, is a part of a sentence). This makes to easier to follow the structure of the article text when editing.

Make sure that the displayed formula is rendered as an image. To force a formula to render as an image, you can append any white-space character at the end (for example “ ”).

Take special care with displayed formulas in lists. In such cases, you cannot rely on Wikipedia simple bullet formatting (where each item begins on a new line with a  or a  ), because Wikipedia lists do not support multi-paragraph entries. Instead the list should be written using the HTML tags:  (for example, see the Linear regression article).

Inline formulas
Producing nice-looking inline formulas is much more difficult. There are two possible approaches here: either use inline TeX images, or write formulas using HTML + Wikicode. Generally, the second method is preferred, since it produces results consistent with the font and the size of the surrounding text. Use inline TeX only in cases when the formula is too complicated to be rendered using HTML.

Another method sometimes encountered, is to use inline  environment without forcing it to render as an image. This approach is discouraged, since it produces incorrectly typeset formulas: the font no longer matches the font of the surrounding text, the small Greek variables are rendered in upright font instead of italics, spaces are sometimes inserted in wrong places.
 * Incorrect:, which produces: $e^{-i\theta}=\cos\theta-i\sin\theta$.
 * Correct, recommended:, which produces: e−iθ = cos&thinsp;θ − i&thinsp;sin&thinsp;θ.
 * Correct, not recommended:, which produces:.

Inline formulas using TeX
This method is generally not recommended, meaning that it should only be used in cases when inline HTML cannot be. This sometimes happens if formulas contain unusual characters, hats over symbols, difficult markup, etc. The reason why this inline TeX format is not recommended is that it renders the output in a font slightly smaller than the standard font size of surrounding text.

Formulas in the inline TeX format are constructed in the same way as the displayed formulas: by placing the TeX commands inside the  tags.

To force the correct font size, start the formula with the  command. Unfortunately, this also alters TeX’s spacing algorithms, so that the spaces should be inserted manually wherever necessary. For example:
 * Incorrect:, which renders as:  $x^n+y^n=z^n\,$.
 * Correct:, which renders as:.

Secondly, the formulas produced by  tags are almost always misaligned with the text baseline. To correct this behavior, manually adjust the alignment by adding the attribute  to the   tag. For example:
 * Incorrect:, which renders as:.
 * Correct:, which renders as:.

Inline formulas using HTML
Inline HTML formulas is a preferred format, since they are rendered in a consistent font and size. Additionally, they load much faster than the formulas in image format. The only drawback of this format is that it does not allow too complicated formulas, so occasionally we have to switch to TeX.


 * HTML entities should be substituted by their corresponding symbols whenever possible: we write instead of . The possible exception to this rule are entities   (non-breaking space) and   (thin space), since the standard editbox does not distinguish them from the common whitespace and thus they could be altered inadvertently.
 * The variable names should be italicized: A, X, z, α, θ, etc.; except for the variables that use capital Greek letters — they are written in the upright font: Σ, Φ, Ω.
 * The numbers must not be italicized: 5, 1.96, −0.33, 1/2, 9.11·10−31. Also do not omit 0 before the decimal point: not .75 but 0.75.
 * Minus sign − is the symbol with Unicode code U+2212, which can be entered as an HTML entity, typed in as Alt+2212 in Windows, or inserted from the Math&Logic toolbox below the edit window. The minus sign is different from a dash  -, an n-dash –, or an m-dash —. For example, type 2 − 3 = −1 but not 2 - 3 = -1.
 * Prime sign ′ can be entered as Alt+2032, or as  HTML entity. Do not use ’ or ' in place of the prime symbol: y = x′β but not y = x’β.
 * Subscripts and superscripts can be added using the  and   tags. For example,  produces x2, and  makes yij. The difficulty arises when a symbol has to have both super- and subscripts. In those cases you can either switch to Τ Ε Χ format, or use manual kerning:, which renders as z2ij.
 * Generally one has to be careful regarding where the formula can break the line. To avoid breaks like b = (X′X)−1 X′y, put the entire formula inside the nowrap template:, which renders as . For technical reasons, if the formula contains vertical pipe “|” characters those should be replaced with , and equality signs “=” should be replaced with  . Alternatively, one can render the entire formula non-breaking by replacing all spaces with  ’s: x+y can be coded as either , or as.

Notational conventions
There are many different types of notation employed in probability theory and statistics, see the “Notation in statistics” article. On Wikipedia we want to use uniform notation across articles on closely related topics, and this section attempts to list different conventions used within the articles in wikiproject Statistics.

Probability theory

 * Random variables are denoted using lower case Latin letters from the second half of the alphabet: x, y, z.
 * Probability of an event A is denoted as Pr[A] or Pr(A) (in  mode use command  ). Do not use bold or italic P to denote probability: ℙ[A], P[A], P[A] are all incorrect. The exception to this rule are measure-theoretic articles, which explicitly define and work with the probability space (Ω, ℱ, P). In those articles P:&thinsp;ℱ&thinsp;→&thinsp;[0,1] is the probability function (other symbols may be used in place of P too, such as G or μ), so that the probability of event A should be denoted as P(A).
 * Expected value of a random variable x is denoted as E[x]. In  mode this can be typed as   or  . Use square brackets to indicate that “E” is not a function but an operator. Do not use italic E as in E(x).
 * Variance, covariance and correlation are denoted as Var[x], Cov[x,&thinsp;y], and corr[x,&thinsp;y] respectively.