Questions tagged [median]

The median is the 'middle' value from a set of values. If the number of values is an even number, the median is the mean of the 'middle' values.

The median is generally used in programming in the sense of the term that comes from statistics. In simple terms it means the number that has half the values above it and half the values below it in the range. It is different than average in that an average can be influenced by extremes on either end of the spectrum. If a few numbers are a lot greater or a lot smaller than the rest, the average will be significantly different from the median. Median can give you a better sense of where the typical middle case is than the average.

The median is also very useful in signal and image processing, in the context of a moving median filter. This filter is usually used to reduce "salt and pepper" type noise, as well as spikes, because each output pixel or element contains the median value of the m-by-n neighborhood around that corresponding pixel in the data.

For a more statistically and technically correct and thorough explanation, see Wikipedia.

In scientific software for statistical computing and graphics, the median of a numeric vector can be found by function median, or quantile with prob = 0.5.

1504 questions
-2
votes
1 answer

Python27 - Windows error or my python coding? strange message from function determine median

# testing entry of multiple numbers into a list. from collections import Counter s = raw_input("Please enter your numbers: ") numbers = map(int, s.split()) print 'this is what you entered' print "how many entries? ", len(numbers) mean =…
-2
votes
2 answers

C program doesn't print out the values

I have a program that is looking for a total numbers and what is the middle number in a linked list. The question that I have is why it doesn't print out the values? Here is the code: int count(list values){ if(values == NULL) return…
edge
  • 11
  • 5
-2
votes
1 answer

How do I find the median of an unsorted array of integers in Java?

I have to find the sum of the elements before and after the median, that are close as possible. For example: Input: {4,5,99,-1,5,6} Output: 3 (element with index 3) //we start counting from 1 public int median(int[] array) { int index = 0; …
P.Peev
  • 13
  • 1
  • 3
-2
votes
1 answer

Mean, Median, and Mode - Newb - Java

We had a lab in Comsci I couldn't figure out. I did a lot of research on this site and others for help but they were over my head. What threw me off were the arrays. Anyway, thanks in advance. I already got my grade, just want to know how to do this…
Beasto
  • 9
  • 3
-2
votes
2 answers

find median in R

socialsec 411223 420211 420604 430404 431030 440127 910415 950110 740505 910101 This is a number column of Swedish social security number, in the format yymmdd I want to find the median year for them. ( If the person then is above the…
PerkinsN
  • 49
  • 2
  • 6
-2
votes
1 answer

Return sorted array with void function to find median

so I am writing this program that reads user input into an array and then finds the mean and median. I have three different files that I am going to compile together in unix: 1) stats.h, which contains the prototypes that I was given for my mean,…
mch5904
  • 21
  • 3
-2
votes
1 answer

Finding the median and max value of an array in java

I used this code to calculate the max value and the median element in an array of integers, but when I call the methods in my client class, both of these two methods produce an output of zero. The name of the array is "grades" and it is made of…
mcolston
  • 3
  • 5
-2
votes
3 answers

Find the median of N^2 elements( large scale )

The question is like this: Assume we have N machines, and each machine store and can manipulate its N elements, then, how can we find the median of all the N^2 elements in the lowest cost? It really bothers me much, hope to get answer from you guys,…
Ragnarök
  • 47
  • 6
-3
votes
2 answers

Spotfire Weighted Median value

Is there any function which returns weighted Median value? Input 2 columns like weight = [100,210,30,50] values = [1, 2, 3, 4] and maybe function like WeightedMedian(w = weight, v = values) or can you help me to construct code for that, Data-->Data…
Easyhyum
  • 307
  • 1
  • 3
  • 5
-3
votes
3 answers

median IF in excel

looking for similar option for conditional average : =AVERAGEIF(A:A,A2,B:B) but this time for Median in excel. I want to generate Median per IDs in column 1 for large number of subjects thanks
motor 30
  • 19
  • 4
-3
votes
1 answer

What is the median value is decimal?

I'm writing a program to find the median of an array in CPP. I am not sure if I have a clear idea about what a median is. As far as I know, I've written my program to find median but when the array is even-numbered, I'm confused whether I should…
Dev_noob
  • 53
  • 1
  • 9
-3
votes
2 answers

Median in 500GB file java

Find median of all numbers in the given 500GB file at the command prompt. File format eg: 12 4 98 3 with one number in each line(numbers can be repeated).Can anyone please help on how to approach on this in JAVA? if we have to split the file and…
Siri
  • 15
  • 1
-3
votes
2 answers

Median is not being calculated correctly with the apply function in R

I have genetic data for SNPs that has been divided into 5 quantiles. I want to find the median of these quantiles for each SNP (i.e. each person). I used this command to create a column for median values: data$median<-apply(data[,2:181],1, median,…
-3
votes
1 answer

how to find the median of 7 numbers? (without any using of Math Methods)

How to find the median of 7 or 9 numbers? (without any using of Math Methods) I have already found one way but it's too long but I can't find any other way to solve it. (I swapped the numbers with each other and forced one value to be the…
Buff
  • 11
  • 1
-3
votes
1 answer

Trying to return the average ages of all the folks in this array who has an age is greater than the median value

I am attemping to return the average ages of all the folks in this array who has an age is greater than the median value. var data = { users: [{ first_name: "Mikey", last_name: "Mouse", age: 24 }, { first_name: "Donald", lastName: "Duck", age:…
flashdev
  • 1
  • 2
1 2 3
99
100