Mean, Median, Variance and Standard Deviation

Quantitative finance is deeply rooted in statistics. Mean, median, variance and standard deviation are the most fundamental concepts to bear in mind. The calculation is easily done by Python.

📝Mean

The mean, often referred to as the average, is a fundamental statistical measure. It is calculated by summing up all the values in a data set and then dividing by the number of values. For example, if we have a data set {2, 4, 6, 8, 10}, the sum of these values is 2 + 4 + 6 + 8 + 10 = 30. There are 5 values, so the mean is 30 / 5 = 6.

📌The mean provides a measure of the central tendency of the data. It gives an overall idea of where the data is centered, but it is easily affected by extreme values (outliers).

📝Median

The median is another measure of central tendency. To find the median, we first need to arrange the data set in ascending or descending order.

If the number of values in the data set is odd, the median is the middle value. For example, in a data set {3, 5, 7, 9, 11}, n = 5 (odd), and the median is 7.

If n is even, the median is the average of the two middle values. For example, in a data set {2, 4, 6, 8},  n = 4 (even). The two middle values are 4 and 6, and the median is (4 + 6) / 2 = 5.

📌The median is less sensitive to outliers compared to the mean. It represents the value that separates the data set into two equal halves.

📝Variance

Variance is a statistical measure that quantifies the dispersion or spread of a set of data points. It provides valuable information about how much the individual data values deviate from the mean (average) of the data set.

There are data set A = {1, 3, 5} and data set B = {1, 1, 9}.

The mean of data set A is (1 + 3 + 5) / 3 = 3. The variance of data set A is ((1 - 3)^2 + (3 - 3)^2 + (5-3)^ 2) / (3 - 1) = 2.

The mean of data set B is (1 + 1 + 9) / 3 = 11 / 3. The variance of data set B is ((1 - 11 / 3)^2 + (1 - 11 / 3)^2 + (9 - 11 / 3)^2) / (3 - 1) = 32 / 3, approximately 10.67.

Data set B has a much larger variance than data set A, showing that its data points are more dispersed from the mean.

📌In finance, variance is used to measure the risk associated with an investment. A portfolio with a higher variance of returns is considered more risky because the returns are more spread out and less predictable.

📝Standard Deviation

The standard deviation measures the amount of variation or dispersion in a set of data. A low standard deviation indicates that the data points tend to be close to the mean, while a high standard deviation indicates that the data points are spread out over a wider range.

The standard deviation is the square root of the variance. They are used in very similar way. So why do we need them both at the same time?

📌Variance is expressed in squared units of the original data. For example, if the data represents lengths measured in centimeters, the variance will be in square centimeters. It is a bit less intuitive to interpret patterns shown in a data set.

📌Standard deviation, however, is in the same unit as the original data. It provides a more straightforward measure of how much the data points differ from the mean. For instance, if the data is about the scores of students in a test (ranging from 0 - 100), the standard deviation will also be in the score units, say 10 points, which gives a more direct demonstration of how much the scores vary around the average score.

💻Try it out in Python

I have a data set with 465 entries. It has two columns: date and value. I use numpy (referred to as ‘np’ in my code) to calculate the mean, median, variance and standard deviation of the data set. Those are simple and direct commands in Python. The results are shown in the last picture.

Hope you know a bit more about statistics and Python after reading this. Please feel free to leave a comment to share your thoughts.

#statistics #python #pythonprogramming #finance #trading

2024/11/8 Edited to

... Read moreIn quantitative finance, understanding statistical concepts like mean, median, variance, and standard deviation is essential for data analysis. The mean, often called the average, provides insight into the central tendency of data. However, it is sensitive to outliers, making the median, which is less influenced by extreme values, a valuable alternative. The median indicates the middle point in an ordered data set, whereas the variance measures how far each number in the set is from the mean, providing a clearer picture of volatility in investment returns. Standard deviation, the square root of variance, offers a more interpretable measure of risk, as it reflects fluctuations within the same units as the original data. For instance, in financial contexts, standard deviation can express the risk level of an investment portfolio. A higher standard deviation indicates greater variability in returns, equating to higher investment risk. To effectively harness these statistical tools, Python programming assists in automating calculations, enhancing accuracy, and enabling quick analysis of large datasets. Incorporating libraries like NumPy can simplify complex computations, providing finance professionals with real-time insights into market trends and potential investment risks. By understanding these statistical measures and their applications, investors can make better-informed decisions.

Related posts

Prompts for high demand skills in 2025
Want to earn more in 2025? Master the right skills with AI-powered learning plans! Here are some prompts “What are the most in-demand skills for [specific industry] in 2025? “ And “Create a 6-month learning plan for mastering [specific skill].” #highincomeskills #learnwithai #chatgpttips
AI for Income & Productivity

AI for Income & Productivity

29 likes

A study desk setup featuring a laptop displaying statistics notes, a physical sheet of handwritten notes, and a pencil case. The background includes a white pegboard with small decorative items, creating a clean study aesthetic.
Handwritten statistics notes covering descriptive statistics concepts like mean, median, mode, range, midrange, and variance. It also includes a stem and leaf plot example, calculations for percentiles (P30, P85) and quartiles (Q3, D4), and relative score analysis.
Handwritten statistics notes detailing the construction of relative and cumulative frequency tables. It shows calculations for mean, variance, and standard deviation from a frequency distribution, along with applications and examples of Chebyshev's Theorem.
steal my college stats notes! pt. 3💯📉📊
steal my college stats notes! pt. 3 💯📉📊 hello friends! here are my notes from my first week of intro to stats, so if you’re struggling to grasp the beginning concepts of the course this is for you! i actually took this class twice: once in high school and once in college. my college didn’t le
lia 💗

lia 💗

125 likes

Data analyst - what to study? 📚
Becoming a data analyst requires mastering a mix of technical, analytical, and communication skills. Here are five essential areas to study: 1. Data Analysis Tools and Software - Excel: Learn advanced features like pivot tables, VLOOKUP, and data visualization. - SQL: Master database querying t
vedha | career tips (tech) 👩‍

vedha | career tips (tech) 👩‍

1505 likes

A study setup with a laptop displaying Google, a water bottle, and an open notebook with the text "KAPLAN's MCAT Quicksheets Physics" overlaid, indicating study materials.
A page from Kaplan MCAT Quicksheets covering Physics and Math topics like Kinematics, Work and Energy, Newton's Laws, and Thermodynamics, with formulas and diagrams.
A page from Kaplan MCAT Quicksheets detailing Hydrostatics & Fluid Dynamics, Electrostatics, and Circuits, including formulas for density, pressure, electric fields, and circuit laws.
MCAT PHYSICS📒
Kaplan Physics quick sheets #premed #MCAT #college #lemon8bookclub #studies #Lemon8Diary #doctor
Future Dr. 🥼🩺

Future Dr. 🥼🩺

25 likes

Probability & Statistics is rough!
#statistics #understandthis #studytips #nursingstudent #lemon8challenge
Elaina

Elaina

27 likes

AI Analyst in demand role
#aieducator #aiadvancements #aiconsultant #tech #cybersecurity
Quanahmichelle

Quanahmichelle

26 likes

Future Nursing students Notes ✨Part 2
#nursingstudent #nursingcollege #unfiltered #Lemon8Diary
Anastacia

Anastacia

4 likes

MEDICAL ASSISTANCE NOTES 👩🏽‍⚕️💕
Here is what I learned in class today I hope my notes help another beginner medical assistant or phlebotomy student !💉🩷 #futurephlebotimist #medicalassistant #medicalstudent
Alhamdulillah 🎀

Alhamdulillah 🎀

497 likes

How I actually study effectively
dear students, study isn’t just your assignments When I was younger, I used to think studying meant sitting at a desk, taking notes, turning in assignments, and chasing deadlines. And while yes, that’s part of it… I realized that wasn’t the whole picture. College taught me something: Going
Meredith Jao

Meredith Jao

19 likes

🤭✨✨
Martadunia Lemus

Martadunia Lemus

1 like

MORE BONES 🦴🩻
making these helps a lotttt #anatomyandphysiology #anatomy #collegelife #medicalschool #nursing
kendra 🖤

kendra 🖤

108 likes

An anchor chart defining variance and standard deviation, showing their formulas and explaining the symbols used, with the question 'How can you use standard deviation to represent the spread of data?' at the top.
Algebra 2 anchor charts
Some of my anchor charts for my class #algebra #algebraconfidence #math #tutor
Kwanjalein Jack

Kwanjalein Jack

8 likes

Medical statistics 📈😵‍💫
#lemon8challenge #lemon8badgehunt #medicalstudent #medicalstudents #fashion
Kassyrosas

Kassyrosas

2 likes

✨Remote Jobs✨ Currently Hiring 💻
I post remote jobs that are hiring everyday 💻 Give me a follow so you don't miss any of the remote job leads that I post 🤍 #workfromhomejobs #wfhjobs #remotejobs #wfh #remotework #wfhtips #jobsearch #greenscreen
Ana Grace

Ana Grace

577 likes

The TEA on free study resources
Hey everyone, I have some TEA 🍵 on free study resources I have found throughout PA school! The resources outlined above are very visual, interactive, and most importantly, free to access! All of these websites do you have paid programs to sign up for, but I have found The free resources to be mo
bea_studies_PA

bea_studies_PA

244 likes

A woman in a pink striped shirt and white pants stands on a paved path in a park with a gazebo, holding a small paper bag. An overlay reads, "I WAS TOLD TO 'GO TOUCH SOME GRASS' ...AND I DID IT."
Three people and a dog walk down a paved road lined with houses and greenery. Overlays state, "Been told to touch grass? Honey, don't take it personally. Don't take it seriously. ✨Take it scientifically✨" and "Not an insult. It's actually a free productivity booster backed by science."
A laptop screen displays neuroscience data, including ERP waveforms, scalp maps, and bar graphs, with red circles highlighting specific data points. Overlays read, "green space - brain space" and "Nature reduces stress + boosts memory, focus, and clarity. Great for mid-study burnout."
Touching grass is my ultimate study hack
“touch some grass” is actually good for studying (no seriously…) If you’ve ever been told to “go touch grass” by someone on the internet, don’t take it personally. Don’t even take it seriously. ✨Take it scientifically✨ Because, weirdly enough, that insult is actually a medical-grade tip fo
Meredith Jao

Meredith Jao

16 likes

Needed this study hack last semester 😭
#study #studyhacks #studytips
Study Lyfe

Study Lyfe

37 likes

A shared dorm room with two lofted beds, desks, and chairs on either side, separated by a central rug. The room features neutral tones and curtains for privacy, with the text "MAJOR DORM ROOMS" overlaid.
A dorm room for a Hospitality major, featuring a lofted bed above a desk area with plants, a cozy papasan chair, and a wall decorated with ivy and various posters and photos.
A dorm room for a Music Education major, featuring a lofted bed, several guitars, a rolling cart with snacks, and music-themed posters on the wall, including one for Peach Pit.
MAJOR DORM ROOMS
I’m backkkk! all credit to those who took the pics! #LOOKBOOK #dormdecor #dormroominspo #collegedormroomideas #lemon8creator #fypシ #Major #aesthetic #shareyourthoughts #design
Maria

Maria

1178 likes

🎀 💰 How to track finances in notion!
‧°𐐪♡𐑂°‧₊ Hey 👋🏼 I wanted to share a really simple & easy way to keep track of your income, expenses and/or savings using notion! Notion is a flexible tool that can really do anything you want, if you make it! To create a finance tracker, I usually create 3 separate tables for expenses, income
peachiesuga ♡

peachiesuga ♡

204 likes

Study while snacking
#study #notes
Zen

Zen

153 likes

A top-down view of a study setup featuring a spiral-bound notebook with handwritten notes and a printed study guide with annotations. A blue pen rests on the papers, and the text overlays "study time" and "HOW TO TAKE NOTES" are prominently displayed, reflecting the article's focus on effective textbook studying and note-taking.
study tips for textbook studying
i have to use a textbook for one of my classes this semester but i’ve never really learned from one during college. usually lecture and practice problems are enough for me. here’s what i try to do - divide pages of each chapter into a a couple days of reading (ex, 4 pages a day for ch 3) -ta
Emily Gonzalez

Emily Gonzalez

22 likes

Stop asking accepted students for their med lists
Start asking how they built it. A school list is personal math. It reflects someone’s stats, residency status, financial reality, long-term goals, and support system. Copying it without context is like borrowing someone else’s prescription. Better questions to ask: How did you decide which sta
Tyra-Lee 🩺

Tyra-Lee 🩺

7 likes

The image features the title 'top 5 STEM Careers' in yellow text on a blue background. Below, a book or card displays an inspirational quote: 'TO A SMART, STRONG, UNSTOPPABLE WOMAN GO FORTH & RUN THE WORLD.'
This image lists 'Fastest-Growing STEM Careers' including data scientist and web developer, and 'High-Earning STEM Careers' such as computer and information research scientist and software developer, set against a background of fountains and trees with a graduate.
The image displays a digital screen showing 'Top STEM Careers' with their median annual salaries, including Computer and Information Research Scientist ($130K), Computer Network Architect ($120K), Data Scientist ($110K), Software Developer ($127K), and Information Security Analyst ($110K).
Top 5 STEM Careers to pursue
Hello everyone! I wanted to share insights on top STEM careers that are both fastest growing and high earning. Data scientists and information security analysts are in high demand due to the expanding need for data analysis and cybersecurity. Software developers and web developers continue to see s
Yun Jung

Yun Jung

19 likes

A home office desk with a monitor displaying the title '3 best COURSE PLATFORMS TO LEVEL UP YOUR CAREER', introducing the article's topic.
Two laptop screens showcase Codecademy for tech topics and Coursera for various subjects, including career paths like Project Manager with salary details, as featured in the article.
A laptop screen features the LinkedIn Learning logo, representing its focus on a wide range of subjects for professional development, as discussed in the article.
3 Best Course Platforms
Are you interested in gaining skills and building your resume? Courses are a great way to do this without breaking the bank. Some of these course platforms are a subscription and some are a per-course pay. The subscriptions can be worth it if you work on your courses often! Here are some popular
Itsleilahclaire

Itsleilahclaire

162 likes

Top Earning Majors for Students 🤑🎓
The top-earning majors often fall within the STEM (Science, Technology, Engineering, and Mathematics) fields. However, it's important to note that salary can also depend on factors like experience, location, and specific job role. Here are some of the top-earning majors, based on data from sou
Joy 📚

Joy 📚

394 likes

A title slide on an orange background with abstract shapes, displaying 'Types of Data Analysis' and the website 'WWW.ANALYST-JOURNEY.COM', with a right arrow indicating more content.
A slide detailing 'Descriptive Analysis' and 'Exploratory Analysis' with their definitions, accompanied by images of data visualizations and a person observing a flowchart on a screen.
A slide explaining 'Inferential Analysis' and 'Predictive Analysis' with their definitions, featuring images of people collaborating on a laptop and a laptop displaying charts.
Types of Data Analysis
To comprehend data analysis effectively, it is essential to understand the various types of data analysis. While some textbooks may mention only three types, I will provide you with five current types of data analysis. 🤓 Here are the five types: 1. Descriptive Analysis 📊 2. Exploratory Analy
Lucky Girl 🥰

Lucky Girl 🥰

22 likes

Picking a College Major & Neurodivergence
As a person who went back for a career change, I can attest how hard it is to pick a college major, add in your neurodivergent needs and it's much trickier. Looking back, my biggest mistake was to ignore my neurodivergent needs. Originally, I majored in social work and psychology with the g
C. Jazmin

C. Jazmin

45 likes

CloverBoyz Magazine Signing #brooklyn #nyc #punga #tylil #dezz @
KatsShopnyc

KatsShopnyc

15 likes

Struggling to start studying?
Procrastination happens to the best of us, but it doesn’t have to derail your goals! 💪✨ Here’s how to stay on track: 👉 Break your work into small, manageable tasks. 👉 Use the 5-minute rule—just start for 5 minutes, and momentum will follow. 👉 Eliminate distractions and set a timer to focus.
Tyra-Lee 🩺

Tyra-Lee 🩺

98 likes

Susan Collins sided with billionaires instead of lowering bills for Maine families 😡
Meredith Steele

Meredith Steele

10 likes

in this house every photocard has a purpose outside of a binder 😝 #kpop #kpopphotocards #photocardcollection #kpopfyp #hobonichi
dawn’s pov ꒰ᐢ. .ᐢ꒱₊˚⊹

dawn’s pov ꒰ᐢ. .ᐢ꒱₊˚⊹

41 likes

Well the radial, median and ulnar nerves are gone now.. so you definitely won’t
feel it 😂 #stretchpad
Stretch_pad

Stretch_pad

1 like

Do Black men actually make MORE money in nursing than women? 👀 A debate breaks out over whether patriarchy gives Black men higher pay in healthcare… or if the data tells a completely different story. What do YOU think? @DAILYRAPUPCREW™️ | PODCAST
DAILYRAPUPCREW™️ | PODCAST

DAILYRAPUPCREW™️ | PODCAST

4 likes

My week at school as a medical student
My week at school consisted of comps in Anatomy and physiology, 3 quizzes and lots of quit time to study.
BigAnita

BigAnita

3 likes

#mtg #cedh #proxy #art #tcg
FUNDeckBuildingMTG

FUNDeckBuildingMTG

1 like

Self-care , Beauty + Baby Girl Finds 🩷
Sunday reset = Amazon haul 🤭🛍️ A mix of beauty finds + the CUTEST baby girl pieces 🎀👶🏽 I’m already obsessed with everything, especially the tiny pearl hangers 🥹🤍 Mom era is getting real!! #fyp #beautyfinds #amazonhaul #selfcaresunday #elfmakeup
Kail 🎀

Kail 🎀

25 likes

The standard deviation
I love science!

I love science!

1 like

I got a memory collage in the Diary Challenge!
I completed Day 7 in the Diary Challenge and got this memory collage! Join the challenge to get yours! #lemon8diarychallenge
Capital&Crypto

Capital&Crypto

2 likes

New ioni makeup finds at dollar tree
I love everything about Ioni Cosmetics. Especially the lashes. Always different styles. Doesn’t hurt my eyes. Lip Balm : Bunny Fushsia Lip Balm : Bunny Coral Lashes- Wispy Fishtail Cateye : Peaches Wispy Smokey Cateye : Mabel Wispy Natural Doll Medium: Briar Strawberry Swirl Gloss : Red
cristal.rose

cristal.rose

17 likes

A Dollar Tree display featuring the Ioni 'Glow Getter' collection, showcasing various lashes, makeup, and nail bar products, all priced at $1.25.
A close-up of the Ioni 'Glow Getter' collection display at Dollar Tree, highlighting false eyelashes with diverse styles and packaging, alongside some lip and nail products.
A detailed view of the lower sections of the Ioni 'Glow Getter' display, featuring lip glazes, lip & cheek tints, nail art supplies, and lip balms in various fruit-inspired shades.
New Ioni Finds for $1.25 🩷
🌸✨ The new Glow-Getter collection by Ioni hit my local Dollar Tree and the display is packed with lashes, glosses, nail stuff, lip oils ….. you name it & all for just $1.25 👀✨ I grabbed the Peach 🍑 and Grape 🍇 Fruit Extract Lip Oils and I’m OBSESSED. They’re hydrating, shiny, and smell l
6xmoee

6xmoee

505 likes

Follow my @Discogs journey #vinylrecords #vinylcollection #recordcollection #belleandsebastian #discogs @Belle and Sebastian
Bob the gilder

Bob the gilder

0 likes

See more