FAQ Database Discussion Community


MySQL Select Results Excluding Outliers Using AVG and STD Conditions

mysql,statistics,standard-deviation
I'm trying to write a query that excludes values beyond 6 standard deviations from the mean of the result set. I expect this can be done elegantly with a subquery, but I'm getting nowhere and in every similar case I've read the aim seems to be just a little different....

Calculating Standard Deviation of Array Recursively

java,recursion,arraylist,standard-deviation,helper-functions
My assignment is to use recursion to calculate the standard deviation of an Arraylist. I understand how to calculate standard deviation as I have done it without recursion I just need help implementing recursion. I would like to use a helper function if possible. This is the recursive method and...

Calculate standard deviation for each variable given in a vector

r,standard-deviation
When I have a vector of strings, and each string corresponds to a variable in a dataframe, how can I easily receive a vector of corresponding standard deviations? Is there something better than a loop? Below an example using mtcars: attach(mtcars) string_vector <- ("mpg", "cyl", "disp") I know how to...

Adding Array in Standard Deviation

java,arrays,add,standard-deviation
I'm doing Standard Deviation with 10 random numbers. I have to find the average of the 10 numbers. I then subtract the average and square it. I then have to find the average again and find the square root of the average. For example: 2, 4, 4, 4, 5, 5,...

Image Parameters (Standard Deviation, Mean and Entropy) of an RGB Image

matlab,image-processing,rgb,entropy,standard-deviation
I couldn't find an answer for RGB image. How can someone get a value of SD,mean and Entropy of RGB image using MATLAB? From http://airccse.org/journal/ijdms/papers/4612ijdms05.pdf TABLE3, it seems he got one answer so did he get the average of the RGB values? Really in need of any help....

Standard Deviation calculation error

python,math,standard-deviation
I am trying to figure out why this process gives me a wrong answer. For [1,2,3,4,5] I am getting 1.2 instead of 1.414 def standard_deviation(number_list): average = sum(number_list) / float(len(number_list)) stdev = 0 for value in number_list: stdev += math.sqrt((average - value)**2) / float(len(number_list)) return stdev standard_deviation([1,2,3,4,5]) ...

Three-way graph (variable, mean, sd) with ggplot2

r,ggplot2,mean,facet,standard-deviation
I think I have an error in my logic while reproducing a graph I found in this pdf here. It should be fairly easy to do, but I have issues to plot a variable with its mean and standard deviation each in their own graph together, as can be seen...

Removing a prior sample while using Welford's method for computing single pass variance

algorithm,math,statistics,variance,standard-deviation
I'm successfully using Welford's method to compute running variance and standard deviation as described many times on Stack Overflow and John D Cook's excellent blog post. However in the stream of samples, sometimes I encounter a "rollback", or "remove sample" order, meaning that a previous sample is no longer valid...

Entity Framework - How to get Standard Deviation using GroupBy?

.net,entity-framework,aggregation,standard-deviation
I'm using entity framework 5, code first fluent API. I've built a simple query with a GroupBy for aggregation: var query = context.Table1 .GroupBy(g => new { Prop1= g.Prop1, Prop2 = g.Prop2 }) .Select(s => new { Prop1= s.Key.Prop1, Prop2= s.Key.Prop2, Avg = s.Average(m => m.Minutes), Min = s.Min(m =>...

How do I calculate the standard deviation between weighted measurements?

statistics,standard-deviation,weighted-average
I have several weighted values for which I am taking a weighted average. I want to calculate a weighted standard deviation using the weighted values and weighted average. How would I modify the typical standard deviation to include weights on each measurement? This is the standard deviation formula I am...

Calculate the 3rd standard deviation for an array

python,numpy,standard-deviation
Say, I have an array: import numpy as np x = np.array([0, 1, 2, 5, 6, 7, 8, 8, 8, 10, 29, 32, 45]) How can I calculate the 3rd standard deviation for it, so I could get the value of +3sigma as shown on the picture below? Typically, I...

Looping through a method and using the results

java,loops,methods,average,standard-deviation
I am trying to loop through this method 10 times that searches an array of numbers captures the run time in nano seconds and prints the results. I then want t take the 10 run times and find the average and standard deviation. Is there a way to capture the...