Help with calculate median, first quartile, second quartile and third quartile
Input file:
Desired output file:
I wanna to calculate 25th percentile/first quartile (Q1), 50th percentile/second quartile (Q2)/median, 75th percentile/third quartile (Q3) from the input file.
It is also acceptable to calculate Q1,Q2,Q3 separately.
Based on my understanding of quartile, 8.6 is the Q1, 12.2 is Q2, 20.65 is Q3.
The way I calculate Q1,Q2,Q3 is based on the following criteria:
sort the figure from smallest to largest
The median is the (15 + 1) ÷ 2 = 8th value = 12.2;
I take the 8th value as the center. Split the data into lower and upper part
In lower part, the lower quartile (Q1) is the (7 + 1) ÷ 2 = 4th value = 8.6;
In upper part, the upper quartile is the 3 (7 + 1) ÷ 2 = 12th value = 20.65.
Thanks in advance.
Last edited by perl_beginner; 06-06-2011 at 03:09 AM..
I am trying to calculate the median of a column of numbers if they match an ID type on a different column. The input file has 3 columns. The column that has the ID is column 1 and the column with the values I'd like to find the median for is column 3. The file does not need to be sorted.
What I... (9 Replies)
Hi all,
plz help me with this, I want to to extract the duplicate rows (column 1) in a file which at least repeat 4 times. then I want to summarize them by getting the max , mean, median and min. The file is sorted by column 1, all the repeated rows appear together.
If number of elements is... (5 Replies)
Hello,
I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes...
I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes.
To do... (10 Replies)
Hi,
I know this question has been asked before, but I'd like to ask for some explanation rather than solution regarding finding median in unix.
I've got a simple one column file with over 2 million numbers and I need to find its median. The file looks like this:
0.123
0.235
0.890
0.000 etc... (11 Replies)
Hi all,
I have a data range as follow:
28
33
42
12
9
68
81
55
6
47
Since I want to create Box & Whisker Plot, I need to calculate the median, first quartile and third quartile of above data using AWK.( so far I can only writing a code for determine smallest value & largest value... (4 Replies)
hi!
i have a file like the attachement.
you can see on the last column, there is a marker from 1 to 64 for each time.
I'd like to have the median for each marker: i want to get a median every 128 values
the result is : for an hour and marker x, i have the median value
thank you for... (5 Replies)