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.

1286 questions
-3
votes
2 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
  • 3
-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
  • 1
-3
votes
1 answer

Calculating median of column "Balance" from table "Marketing"

I have a spark (scala) dataframe "Marketing" with approx 17 columns with 1 of them as "Balance". The data type of this column is Int. I need to find the median Balance. I can do upto arranging it in ascending order, but how to proceed after that? I…
-3
votes
1 answer

Is it possible to aggregate or summarize dataset in R with median?

I am trying to aggregate dataset in R with median. d <- aggregate(c(d$user_reported_percent, d$machine_percent), by = list(d$day), FUN=median, simplify = TRUE, drop = TRUE) But R keeps complaining, and I am not sure if it…
-3
votes
1 answer

Finding median for given range of indices of an array

Given an array of integers, we have to answer certain queries where each query has 2 integers. These 2 integers are the 2 indices of the given array and we have to find the median of the numbers present between the 2 indices (inclusive of the given…
P3A
  • 141
  • 9
-3
votes
3 answers

How to find the median for an array of numbers for java?

public double median(){ double input =0; double answer =sum() * (input) / data.length; return answer; } This is my code I have for median but it keeps returning as zero when I run the program. The array of numbers are: {3.0, 15.0, 7.0,…
Min Park
  • 1
  • 1
  • 1
-3
votes
1 answer

Stuck at What is the median UVa 10107

I am stuck at this uva problem i think my algorithm is right but the program crashes on running , I can't figure out where the problem is but i think it is with the iterator ??! Any help please !!! Code: #include #include…
-3
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
  • 11
  • 3
-3
votes
1 answer

Function that return the median

I want to create a function that returns the median of a field. I'm working with sql 2000. I wrote: create function mediana (@tabla, @campo) returns int as begin declare @Median integer return @Median = ( (SELECT MAX(@campo) FROM …
GabyLP
  • 3,218
  • 5
  • 40
  • 58
-3
votes
2 answers

Median Filtering, window size 3,5,7 with C

I want to apply Median Filtering on a black & white 256x256 image with window size 3, 5 and 7... I can't find a sort algorithm with which I can work with. Can you help me and give me some ideas?
-4
votes
2 answers

What is the shortest way to calculate running median in python?

I need to calculate a running median in python. Currently I do it like this: med_y = [] med_x = [] for i in numpy.arange(240, 380, 1): med_y.append(numpy.median(dy[(dx > i)*(dx < i+20)])) med_x.append(i + 10) Here the data is stored in dx…
Juha
  • 1,945
  • 20
  • 38
1 2 3
85
86