Percentiles

The program calculates the median and the lower- and upper quartile for a set of data plus - if you want - one extra where you choose the percentage.

The methos is explained with an example in the section Calculation of percentiles .

Use of the program is described in the manual


Manual

In this electronic manual you can read about

Introduction

Calculation of percentiles

Data input

Type data directly

Read data from a file

Options

Results


Introduction

The program calculates the median and the lower- and upper quartile.

Besides those 3 values you can ask for a single percentile corresponding to at selected percentage.

To calculate a percentile can be a nasty process. The percentile value depends of the precision of the measurements. Because of that you can set the precision by giving the interval length between the (theoretically) closest values. The default value is 1. You can select another value and this value is kept - also next time you use the program - until you select another value.

An example: You measure temperature and use integer values. So the interval length (precision) is 1. If the real temperature is (almost exactly) 23.488232112543 you will observe the value 23.

But if you measue the temperature with one decimal the interval length (precision) is 0.1. If the real temperature is as above you will observe 23.5

Look at an example of calculation .

Another problem is that a percentile is not nessarely precisely defined. If you for instance have two observations, 1 and 9 (and the precision is 1) then the median is usually defined as the midpoint, that is 5. But any value between 1.5 and 8.5 could be said to be a median. You could say, that the uncertainty is 8.5-1.5 = 7. This value is by the program called Delta and it is printet in the output.


Calculation of percentiles

Example:

For the 10 observations, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3 with the precision 1 you get the median 2.30 but if the precision is 0.1 the median is 2.03

Here the precision is 1:

                         ___________________

                        |___________________|____________________

                        |___________________|____________________|

                        |___________________|____________________|

    ____________________|___________________|____________________|

  _|____________________|___________________|____________________|__

            1         1.5         2       2.5        3

The median is the point where you have 5 observations below and 5 above the median. One observation is less than 1.5 so you need 4 more to have 5 below the median. That is, you "need" 4/5 of the 5 observations between 1.5 and 2.5 , so

Median = 1.5 + 4/5 * (2.5 - 1.5) = 1.5 + 0.8 *1 = 2.3

Now, here the precision is 0.1:

                                  __

                                 |__|                __

                                 |__|               |__|

                                 |__|               |__|

            __                   |__|               |__|

   ________|__|__________________|__|_______________|__|_________

             1                     2                  3

                              1.95  2.05

The median is still the middle, so

Median = 1.95 + 4/5 * (2.05 - 1.95) = 1.95 + 4/5 * 0.1 = 1.95 + 0.08 = 2.03

Read also about Delta


Delta

Delta: specification of the uncertainty of a percentile

Example: two observations, 1 and 3 with precision=1

   ____________________                     ____________________

_|____________________|___________________|____________________|_________

            1         1.5         2       2.5        3

                       |<---  Delta  ----->|

Median: midpoint between 1.5 and 2.5 = 2.0 with a Delta= (2.5 - 1.5) = 1.0

The same data with precision 0.1

            __                                       __

      _____|__|_____________________________________|__|_______

            1                                        3

       0.95  1.05                                2.95  3.05

              |<------------  Delta --------------->|

Median = (1.05 + 2.95)/2 = 2.0 with Delta = 2.95 - 1.05 = 1.9


Data input

The program can recieve data in three different ways:

1.You can type the data directly to the program. Explained in Type data .

2.You can - using another program like Notepad- make a file with one set of data

3.You can - using another program like Notepad - make a file with severel sets of data (a data matrix)


Type data

You have two possibilities for typing data directly:

1.

You can type the data in a spreadsheet like the following

Obs Number

10 1

11 4

12 3

13 2

the first columd is the observation (midpoint of the intervals containing the observations), and the second column is the number of observations in the intervals.

2.

You can type the data in a way where you type the interval endpoints and the number of observations inthe intervals like the following

low high number

0.5 1.5 4

1.5 2.5 8

2.5 3.5 11

3.5 4.5 7

4.5 5.5 5

5.5 6.5 1


Format of data file

The first line in a data file may contain name of the variables, but it is not nessessary. If no names is given the program gives names to the variables.

The following lines must contain the numbers/observations separated with a tabulator, like this:

string [\t string [\t string]] \n

float [\t float [\t float]] \n

float [\t float [\t float]] \n

An example:

age hight weight

23 180 63

32 190 81

41 178 74


Read

If you have a lot of data it's an advantage to have the numbers in a file.

1.One file with one set of data (or variable)

2.One file with data for many variables

Notice the format of the file: You must save your data in a text format - not a document format as word processors usually does. When you save the data you'll have to choose 'Save as' and select a 'Text' format. Or you can use Notepad which uses a text format automatically. (If you have used a word processor to prepare your file and you experience problems, you may read the data using Notepad to check that the data has the right format).

You may also have your data as a database in a statistical program such as R, SPSS or STATA or in a spreadsheet program. Using such programs you can (usually) save your data in at tab-delimited version maybe even with the variable names as the first line in the file.

Read more about reading data


Read one

Using Notepad - or another word processor which can save the data in a text format - you can prepare files with a contents like the following:

10 1

11 4

12 3

13 2

or - equivalent with the data set above

10

11

11

11

11

12

12

12

13

13

The format of the file must be

<number>[<tab><number>]

<number>[<tab><number>}

. . .

<number>[<tab><number>]

<number>[<tab><number>]

that is, one or two numbers on each line where the first is an observation and the second is the number of that observation and they must be separated by a tabulator symbol. A single number on a line means only one observation of that size.

The order of the observations is irrelevant so the following is equivalent with the above set

11

12

13 1

11

10

11

11

12 2

13


Read variables

You can have your data in two different formats:

With or without variable names in the first line.

Names and numbers must be delimited by either tab or semicolon. A space/blank or the text NA indicates a missing value.

So an example of a dataset with variable names in first line could be

a b c

2 3

3 2 3

2

4 3 2

3 4

2 4 3

2 3 3

In this table you can not distinguis between tabulator and space/blank so using \t as tabulator, \b as blank and \n as new-line the data can be presented as

a\t\b\tc\n

2\t\b\t3\n

3\t2\t3\n

\b\t\b\t2\n

4\t3\t2\n

3\t4\t\b\n

2\t4\t3\n

2\t3\t3\n


Options

You have three options

1.You can ask for a percentile corresponding to a percent which you must specify.

2.You can set the precision of your observations. Read about the significance of precision

3.You can choose to print a table of the data together with the percentiles.


Results

You can clear the window, that is remove all the results, or the results can be either printed to the standard printer or saved to a file.


Selection variable

You can select a variable to use for selection of observations to include in the analysis. Connected to the selection variable is selection value which must be an integer greater than -1.

Cases where the value of the seletion variable is equal to the selection value is included in the analysis.