Simple and Complicated Expressions Used in Biostatistics
Simple expressions (also called formulas) have one or two numbers and only one mathematical operator (for example, 5 + 3). But most of the formulas you’ll encounter in biostatistics are more complicated, with two or more operators.
You need to know the order in which to do calculations, because using different sequences of operations produces different results. Generally, the order in which you carry out the various operations appearing in a complicated formula is governed by the interplay of several rules, according to a set of priority rules referred to as a hierarchy.
Most computer programs try to follow the customary priority conventions that have been established over the years for typeset formulas, but some programs differ, so check the software’s documentation.
Here’s a typical set of operator hierarchy rules. Within each hierarchical level, operations are carried out from left to right in the expression:

Evaluate anything within parentheses (or brackets or curly braces or absolutevalue bars) first.
This includes the parentheses that follow the name of a function.

In a typeset fraction, evaluate the numerator (everything above the horizontal bar) and the denominator (everything below the bar); then divide the value of the numerator by the value of the denominator.

Evaluate negation, factorials, powers, and roots.

Evaluate multiplication and division.

Evaluate addition and subtraction.
Here’s an example of how the expression 5 * ( 2 + 10 ) / 6! + sqrt(16) would be evaluated, according to the hierarchy rules given above:
Applying Rule 1 gives: 5 * 12 / 3! + 7, because ( 2 + 10 ) = 12, and sqrt(16) = 4
Applying Rule 2: Doesn’t come into play for this example.
Applying Rule 3 gives: 5 * 12 / 6 + 7, because 3! = 1*2*3, which = 6
Applying Rule 4 gives: 10 + 7, because 5 * 12 / 6 = 60 / 6, which = 10
Applying Rule 5 gives: 17