# ML | Raw and Central Moments

**Moments** are a set of statistical parameters which are used to describe different characteristics and feature of a frequency distribution i.e. central tendency, dispersion, symmetry, and peakedness (hump) of the frequency curve.

For *Ungrouped data* i.e. discrete data, observations on a variable X are obtained as , For *Grouped data* i.e. continuous data, observations on a variable X are obtained and tabulated in K class intervals in a frequency table. The mid points of the inervals are denoted by which occur with frequencies respectively and .

Class Intervals | Mid Points () | Absolute Frequency () |
---|---|---|

… | … | … |

… | … | … |

**Moments about an arbitrary point A**

The moment of a variable X about any arbitrary point A on the observations is defined as:

For ungrouped data

For grouped data

where

**Moment about any arbitrary point in Python – **

Consider the given data points. Following are the time (in hours) spent by 20 different persons at GeeksforGeeks portal every week.

15, 25, 18, 36, 40, 28, 30, 32, 23, 22, 21, 27, 31, 20, 14, 10, 33, 11, 7, 13

`# data points ` `time ` `=` `[` `15` `, ` `25` `, ` `18` `, ` `36` `, ` `40` `, ` `28` `, ` `30` `, ` `32` `, ` `23` `, ` `22` `, ` ` ` `21` `, ` `27` `, ` `31` `, ` `20` `, ` `14` `, ` `10` `, ` `33` `, ` `11` `, ` `7` `, ` `13` `] ` ` ` `# Arbitrary point ` `A ` `=` `22` ` ` `# Moment for r = 1 ` `moment ` `=` `(` `sum` `([(item` `-` `A) ` `for` `item ` `in` `time]))` `/` `len` `(time) ` |

*chevron_right*

*filter_none*

## Raw Moments –

The moment around origin A = 0 known as raw moment and is defined as:

For ungrouped data,

For grouped data,where,

**Notes: **

->We can find first raw moment () just by replacing r with 1 and second raw moment () just by replacing r with 2 and so on.

->When r = 0 the moment for both grouped and ungrouped data.

**Raw moment in Python – **

`# data points ` `time ` `=` `[` `15` `, ` `25` `, ` `18` `, ` `36` `, ` `40` `, ` `28` `, ` `30` `, ` `32` `, ` `23` `, ` ` ` `22` `, ` `21` `, ` `27` `, ` `31` `, ` `20` `, ` `14` `, ` `10` `, ` `33` `, ` `11` `, ` `7` `, ` `13` `] ` ` ` ` ` `# Moment for r = 1 ` `moment ` `=` `sum` `(time)` `/` `len` `(time) ` |

*chevron_right*

*filter_none*

## Central Moments –

The moments of a variable X about the arithmetic mean () are known as central moments and defined as:

For ungrouped data,

For grouped data,

where and

**Notes: **

->We can find first raw moment () just by replacing r with 1 and second raw moment () just by replacing r with 2 and so on.

->When r = 0 the moment , and when r = 1 the moment for both grouped and ungrouped data.

`# data points ` `time ` `=` `[` `15` `, ` `25` `, ` `18` `, ` `36` `, ` `40` `, ` `28` `, ` `30` `, ` `32` `, ` `23` `, ` `22` `, ` ` ` `21` `, ` `27` `, ` `31` `, ` `20` `, ` `14` `, ` `10` `, ` `33` `, ` `11` `, ` `7` `, ` `13` `] ` ` ` `# Mean ` `A ` `=` `sum` `(time)` `/` `len` `(time) ` ` ` `# Moment for r = 1 ` `moment ` `=` `(` `sum` `([(item` `-` `A) ` `for` `item ` `in` `time]))` `/` `len` `(time) ` |

*chevron_right*

*filter_none*

**Relationship between Raw and Central moments – **

## Recommended Posts:

- Sheppard's Correction for Moments | ML
- Python - Non-Central F-Distribution in Statistics
- Python - Non-Central T-Distribution in Statistics
- Python - Non-Central Chi-squared Distribution in Statistics
- Statistical Functions in Python | Set 1 (Averages and Measure of Central Location)
- ML | BIRCH Clustering
- What is AI(Artificial Intelligence)?
- Python program to convert any base to decimal by using int() method
- Check whether count of odd and even factors of a number are equal
- What is Information Retrieval?
- What is IBM Watson and Its Services?
- wxPython - ClearFocusedItem() method in wx.TreeCtrl
- wxPython - Collapse() method wx.TreeCtrl
- wxPython - AssignImageList() method in wx.TreeCtrl

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.