
Order statistics 
[Notation] 
Posted on February 16, 2008 @ 01:36:53 PM by Paul Meagher
Order statistics are statistics derived from data ordered from smallest to largest. I've recently come across a nice notation for representing order statistics which I thought deserved a blog entry.
The notation involves putting a subscripted bracket around a positional index. Using this scheme, all the measurements in our ordered sample would be denoted as y_{[1]},...,y_{[n]}. In other words, the brackets around the subscripts tips us off that the elements denoted by these indexed y values are not simply the raw sample values in whatever order they were collected, but rather the sample values ordered from smallest to largest.
As an example of how this notation can be used, consider how we might express the formula for computing the first, second and third quartiles (Q_{1}, Q_{2}, Q_{3}). Recall that Q_{1} is the value that 25% of our values are less than or equal to. Q_{2} is the value that 50% of our values are less than or equal to and Q_{3} is the value that 75% of our values are less than or equal to. Or, using our notation:
Q_{1} = y_{[(n+1)/4]}
Q_{2} = y_{[(n+1)/2]}
Q_{3} = y_{[3(n+1)/4]}
If the subscripts are not integers, we average the two closest order statisitcs to obtain the quartile value.
The minimum value y_{[1]} , the three quartiles (Q_{1}, Q_{2}, Q_{3} ), and the maximum value y_{[n]} are often reported together and are called the five number summary. The boxandwhisker plot is a graphical way to depict the five number summary.
As a final example of how our order notation can be used consider the formula for the trimmed mean. In the formula below m_{k} is the trimmed mean with k values trimed from the top and bottom of an ordered list of numbers:
m_{k} = ∑_{i=k+1 to nk} x _{[ i ]} / (n  2k)
Here is some PHP code for computing a trimmed mean where we remove the top and bottom 2 values from our computed mean (i.e., k=2):
<?php
function trimmed_mean($X, $k) { $n = count($X); sort($X, SORT_NUMERIC); for($i=$k; $i < $n$k; $i++) $sum += $X[$i]; $mean = $sum / ($n  2 * $k); return $mean; }
$X = array(55, 15, 20, 1, 2, 25, 50); echo "Trimmed mean is ".trimmed_mean($X, 2).".";
// Output: Trimmed mean is 20.
?>
The next time you compute a mean you might want to consider computing a trimmed mean using a few different values of k to see how affected by outliers your computed mean is.

Permalink 
Superscripts and subscripts 
[Notation] 
Posted on July 27, 2007 @ 03:31:20 AM by Paul Meagher
Today I spent some time trying to explain to my daughter (going into grade 5)
what an exponent is. She knows multiplication, subtraction, addition and some division but does not yet know what an exponent is. I tried to explain/motivate what an exponent was in the context of viewing the decimal system as a polynomial sum (which I discussed in my last blog). I was surprised to learn that a major block which she experienced in trying to learn this concept was viewing a superscripted number as having special notational meaning.
If you add a superscripted 2 to the right of a 4 (i.e., 4^{2}) she views this as meaning 4 x 2 and can't see why it should mean 4 x 4. Note: She wrote out the exponent/power notation herself under instruction (i.e., "write a small 2 above the 4") without seeing a nicely rendered version of the notation. Perhaps this prop would have helped.
The next math lesson with my daughter may involve discussing the purposes behind using superscipts and subscripts in math notation.

Permalink 
Estimating Water Flow: Theory 
[Notation] 
Posted on July 11, 2007 @ 04:44:55 PM by Paul Meagher
We can denote the area under a simple curve from a to b (i.e., the definite integral) as:
_{a}I^{b} f(x)d(x)
We can use _{a}I^{b} to express the idea that the area under the curve from a to b (i.e., curve(a, b) ) can be computed as the sum of curves from a to m (i.e., curve(a, m) ) and m to b (i.e., curve(m, b) ):
_{a}I^{b} f(x)d(x) = _{a}I^{m} f(x)d(x) + _{m}I^{b} f(x)d(x)
We can use the trapezoid rule to approximate (denoted by ~=) the definite integral from a to b:
_{a}I^{b} f(x)d(x) ~= h/2 * [f(a) + f(b)]
Where h = (ba)/2 .
Here is the delta version of the trapezoid rule which discards "b" in exchange for "a+h":
_{a}I^{a+h} f(x)d(x) ~= h/2 * [f(a) + f(a+h)]
The area under the trapezoid from a to b (i.e., trap(a, b) ) can be computed as the sum of the trapezoids from a to m (i.e., trap(a, m) ) and from m to b (i.e., trap(m, b) ):
_{a}I^{b} f(x)d(x) ~= h/2 * [f(a) + f(m)] + h/2 * [f(m) + f(b)]

Permalink 
Standard Basis Vector for R^{3} 
[Notation] 
Posted on September 25, 2006 @ 03:03:02 AM by Paul Meagher
Behold the standard basis vector for R^{3}:
v = x(1, 0, 0) + y(0, 1, 0) + z(0, 0, 1) = xi + yj + zk
To register a threecolum row of interval or ratioscaled data (1, 5, 3) as a location in 3D space, we can reexpress the data using standard basis vector notation as 1i + 5j + 3k.

Permalink 
phpSyntaxTree 
[Notation] 
Posted on May 21, 2006 @ 04:15:19 PM by Paul Meagher
phpSyntaxTree is a neat web application:
phpSyntaxTree allows you to generate graphical syntax trees from labelled bracket notation phrases. You can then include the graphics into your homework or assignments.

Permalink 
PhpMathPublisher 
[Notation] 
Posted on May 21, 2006 @ 01:00:12 AM by Paul Meagher
Discovered the PhpMathPublisher package tonight:
With PhpMathPublisher, you can publish mathematical documents on the web by using only a php script (no latex programs on the server, no mathml...).
This looks like it might be a useful class/package to embed into my news publishing system. I've used Latex in the past to generate some of my math graphics. To do this I extended the XML_Transform package developed by Sebastian Bergman so that it would parse latex content embeded in XML tags and hand it off to latex to render. I never had time/motivation to master Latex or perfect the process so am open to alternative approaches such as PhpMathPublisher is taking.
I've recently set up an Ubuntu desktop system and hope to explore the Open Office Math app as well.
While it is nice to have these apps which will generateprinter ready math notation, when you are publishing math on the web there is nothing wrong with using some of the math notation provided by standard HTML as well. The HTML codes for the greek alphabet, for example, renders on all modern browsers and if you need to mix some greek notation into your blog it will often be just as easy and faster to render if you use the standard HTML codes for the greek alphabet. PhpMathPublisher will come in handy, however, if you have to build a more complex formula involving greek alphabet symbols.

Permalink 

php/Math Project
© 2011. All rights reserved.
