Questions tagged [standard-deviation]

Standard deviation (represented by the symbol sigma, σ) shows how much variation or "dispersion" exists from the average (mean, or expected value).

The standard deviation of a random variable, statistical population, data set, or probability distribution is the square root of its . A standard deviation close to 0 indicates that the data points tend to be very close to the mean (also called the expected value) of the set, while a high standard deviation indicates that the data points are spread out over a wider range of values.

The standard deviation of X is the quantity

enter image description here

870 questions
6
votes
1 answer

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

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…
6
votes
3 answers

mean(rnorm(100,mean=0,sd=1)) is not 0; and sd(rnorm(100,mean=0,sd=1)) is not 1. Why?

(Reproducible example added.) I am little bit confused about rnorm function. I expected mean(rnorm(100,mean=0,sd=1)) to be 0; and sd(rnorm(100,mean=0,sd=1)) to be 1. But gave different results. Where am I wrong? Reproducible Example:…
Erdogan CEVHER
  • 1,788
  • 1
  • 21
  • 40
6
votes
2 answers

Pandas Dataframe.describe() : Which kind of standard deviation?

Using python's Pandas library, the Dataframe.describe() function prints the standard deviation of the dataset. However, the documentation page doesn't specify whether this standard deviation is the "uncorrected" standard deviation or the "corrected"…
hlin117
  • 20,764
  • 31
  • 72
  • 93
6
votes
2 answers

Rolling Standard Deviation in a Matrix in R

Bellow is a stock daily returns matrix example (ret_matriz) IBOV PETR4 VALE5 ITUB4 BBDC4 PETR3 [1,] -0.040630825 -0.027795652 -0.052643733 -0.053488685 -0.048455772 -0.061668282 [2,] -0.030463489…
RiskTech
  • 1,135
  • 3
  • 13
  • 19
6
votes
2 answers

quick standard deviation with weights

I wanted to use a function that would quickly give me a standard deviation of a vector ad allow me to include weights for elements in the vector. i.e. sd(c(1,2,3)) #weights all equal 1 #[1] 1 sd(c(1,2,3,3,3)) #weights equal 1,1,3…
user1320502
  • 2,510
  • 5
  • 28
  • 46
5
votes
2 answers

Excel Graph with custom standard deviation

I have 2 columns, one with my data points, other with the standard deviation for each data point. How do I make a line plot on excel with error bars equal to each point's perspective standard deviation? e.g. Col-1 Col-2 1 0.1 2 0.2 3 …
Tony Stark
  • 3,353
  • 7
  • 26
  • 30
5
votes
1 answer

Python np.lognormal gives infinite results for big average and St Dev

I am trying to draw the lognormal distribution for my data. using the following code: mu, sigma = 136519., 50405. # mean and standard deviation hs = np.random.lognormal(mu, sigma, 1000) #mean, s dev , Size count, bins, ignored = plt.hist(hs, 100,…
FabioSpaghetti
  • 790
  • 1
  • 9
  • 35
5
votes
2 answers

Standard Deviation coming up NA when using summarise() function

I am trying to calculate descriptive statistics for the birthweight data set (birthwt) found in RStudio. However, I'm only interested in a few variables: age, ftv, ptl and lwt. This is the code I have so…
Angus
  • 65
  • 1
  • 3
5
votes
2 answers

Power BI: Calculating STDEVX.P over 6-Month period

I am attempting to calculate the most recent 6-Month STDEVX.P (not including the current month; so in May 2017, I'd like to the STDEVX.P for periods Nov 2016 - Apr 2017) for sales by product in order to further calculate variation in sales orders. …
Epicleo
  • 74
  • 5
5
votes
2 answers

Calculate a moving Standard Deviation

i found the following code snippet here on stackoverflow, but i have the problem that the stdev becomes NaN. Any ideas how to fix this? public static void AddBollingerBands(ref SortedList> data, int period, int…
endeffects
  • 431
  • 4
  • 15
5
votes
2 answers

Change row values to zero if less than row standard deviation

I want to change all values of a row to zero if they are less than the standard deviation of that row. set.seed(007) X <- data.frame(matrix(sample(c(5:50), 100, replace=TRUE), ncol=10)) X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 1 37 10 43 45 11 17 39 13…
Ben
  • 41,615
  • 18
  • 132
  • 227
5
votes
2 answers

postgres STDDEV aggregate behavior when n<2

My Postgres query calculates statistical aggregate from a bunch of sensor readings: SELECT to_char(ipstimestamp, 'YYYYMMDDHH24') As row_name, to_char(ipstimestamp, 'FMDD mon FMHH24h') As hour_row_name, varid As category,…
aag
  • 680
  • 2
  • 12
  • 33
4
votes
1 answer

Sample Standard Deviation in JQ

I've an array of numbers and I need to calculate the Sample Standard Deviation using jq. Sample Standard Deviation formula (credits): I've tried splitting the code into multiple pieces (length, mean), but none of my attempts worked because I don't…
Carlo Corradini
  • 2,927
  • 2
  • 18
  • 24
4
votes
2 answers

Retrieving the average of averages in Python DataFrame

I have a mass pandas DataFrame df: year count 1983 5 1983 4 1983 7 ... 2009 8 2009 11 2009 30 and I aim to sample 10 data points per year 100 times and get the mean and standard…
jstaxlin
  • 517
  • 4
  • 18
4
votes
2 answers

What can I apply numpy.std() to?

I have very little knowledge of statistics, so forgive me, but I'm very confused by how the numpy function std works, and the documentation is unfortunately not clearing it up. From what I understand it will compute the standard deviation of a…
Petra
  • 195
  • 1
  • 1
  • 10