Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Calculate Mean absolute Deviation

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 01-25-2013   -   Original Discussion by Diya123
Diya123 Diya123 is offline
Registered User
Join Date: May 2011
Last Activity: 21 May 2014, 3:07 PM EDT
Posts: 139
Thanks: 7
Thanked 1 Time in 1 Post
Calculate Mean absolute Deviation


I am trying to use an statistical formula. I tried in excel, but I get different values when I use calculator.

The formula is
(1/n) ∑|x – mean|
n=no. of observations
x=each individual expression value
mean is median of all observations

I have a file with 1000 rows.. So it needs to calculate the MAD for each row..


12.8165	12.86361	12.65535	12.75554	12.88999	13.12837	13.05147	13.18671	13.2494	13.2906	13.16096	13.04806	12.49505	13.27213	13.13943
12.93171	13.41074	12.16979	13.01464	13.10369	13.78584	13.36401	13.3254	13.20534	13.16263	13.32761	13.27332	13.39617	13.44481	13.3401

I want to give it a try in awk

Sponsored Links
Old Unix and Linux 01-25-2013   -   Original Discussion by Diya123
Yoda's Unix or Linux Image
Yoda Yoda is offline Forum Advisor  
Jedi Master
Join Date: Jan 2012
Last Activity: 18 November 2017, 10:00 PM EST
Location: Galactic Empire
Posts: 3,601
Thanks: 253
Thanked 1,315 Times in 1,232 Posts
What formula did you use in Excel?

Did you try using AVEDEV
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
AWK script for standard deviation / root mean square deviation chrisjorg Shell Programming and Scripting 12 01-18-2012 12:30 PM
Standard deviation in awk gd9629 Shell Programming and Scripting 11 08-24-2011 01:40 PM
Calculate age of a file | calculate time difference worm Shell Programming and Scripting 10 02-15-2011 06:59 AM
Calculating the Standard Deviation for a column kylle345 UNIX for Dummies Questions & Answers 1 05-18-2009 05:58 PM
Mean and Standard deviation lakshmikanth.pg Shell Programming and Scripting 4 04-27-2009 04:04 PM

All times are GMT -4. The time now is 10:20 AM.