I have got a dataset and I need to check if one specific observation within the dataset is significantly different from the dataset's mean.

data = rnorm(20) #this is my dataset

my_ob = 1.59528080 #this is my observation taken from the dataset

What kind of statistical test can I use to check if my_ob is significantly different from the mean of data?

Any suggestion? Thanks

  • $\begingroup$ Could you give us more context on this? Why do you want to check for significance? Do you mean detecting outliers? $\endgroup$
    – Tim
    Mar 25, 2019 at 13:15
  • $\begingroup$ Without in any way contradicting Whuber's response, box plots can be a more discriminating way of detecting unusual and potentially suspect values, they will also work with skewed samples, and up to a point with multi-mode samples. Having done a box plot with the full sample, it can then be repeated without the suspect outlier. $\endgroup$ Apr 5, 2019 at 13:24

3 Answers 3


If your sample is approximately normally distributed, you could calculate the standard deviation. Then if the observation is greater than two standard deviations away from the mean it is about 95% likely that the difference is significant.

If the sample is not reasonably normally distributed then you need to ask a statistician and provide the sample so that the type of distribution can be assessed in order to determine the statistical test that would be appropriate.

  • 3
    $\begingroup$ The points made in my comment to another question apply here, too: this is a poor procedure. $\endgroup$
    – whuber
    Mar 25, 2019 at 14:03
  • $\begingroup$ Thank you Whuber $\endgroup$ Mar 26, 2019 at 20:58

With only 1 observation, it is quite easy. Look how many standard deviations out of the mean your new data point is (this is, subtract the "data" mean and divide by the "data" standard deviation)

Now check the result against a standard normal distribution (for a 5% threshold, the boundary is close to 1.96 (or -1.96), so "my_ob" is pretty much in the limit.

  • 1
    $\begingroup$ Although sometimes we find people using this procecure, it is an extremely poor one. At the very minimum, the mean and SD should be computed with the putative outlier removed from the dataset. The values of $\pm1.96$ are inappropriately small, too. $\endgroup$
    – whuber
    Mar 25, 2019 at 14:02
  • $\begingroup$ That is due to real-life data having very high kurtosis, which is not the case in the example presented. The outlier removal is only sometimes justified $\endgroup$
    – David
    Mar 25, 2019 at 14:15
  • $\begingroup$ thanks to all. how about boot-strapping? $\endgroup$
    – aaaaa
    Mar 25, 2019 at 15:02
  • $\begingroup$ aaaaa, Here's a better idea that won't require waiting for someone to suggest a good answer: read some of our threads about outliers. $\endgroup$
    – whuber
    Mar 25, 2019 at 18:08

My comments here do not assume any time series data ...just a collection of observations that are being scrutinized for anomalies.

An even easier method is to construct an X variable with all zeroes except for the point where the candidate falls. Run a regression (including a constant) and examine the t value for the X variable. If the residuals from this simple regression model are normal and independent then the t value can be interpreted in the standard way.

You can scan the opportunity space by separetely trying different observational points to determine the most significant (if any !) deviant observations form the mean.

I modified my answer to include the concept of scanning in order to rank the observations in terms of exceptional values.

EDITED to illustrate how cross-sectional data is a particular subset of an ARIMAX MODEL

ARIMAX MODEL enter image description here

If we specify t=i that b=0 and W(l)=1.0 and delete all reference to I ( the anomalies) and any coloring of the error process we get a model for i observations ..using 1 X ... 29 "0"'s . 1 "1" and 10 "0"'s in my example of 40 observations

enter image description here

  • 2
    $\begingroup$ Interesting idea--but useless, because this "X variable" will have infinite leverage and you will never be able to identify an outlier this way! $\endgroup$
    – whuber
    Mar 25, 2019 at 14:04
  • $\begingroup$ My regression coefficient for X is simply the difference between the candidate value and the mean of the remaining values. Can you please explain via a numerical example that this reflects "infinite leverage " ? $\endgroup$
    – IrishStat
    Mar 25, 2019 at 17:33
  • $\begingroup$ The residual for the "point where the candidate fails" will always be zero. $\endgroup$
    – whuber
    Mar 25, 2019 at 17:58
  • $\begingroup$ If I have 40 observational data points and i construct an X predictor that has 29 0's followed by a "1" and then 10 0's , the residual will be 0.0 for time period 30 BUT my test is not on the residual but the regression coefficient ( observed y at period 30 minus the mean of the remaining 39 ) $\endgroup$
    – IrishStat
    Mar 25, 2019 at 18:14
  • $\begingroup$ I see. Yes, that's a standard t test. It has several problems. One of the subtler ones is that usually one does not nominate, say, the value at period 30 a priori as a potential outlier: one chooses this value because it is extreme. This determination of the "X variable" based on the data values destroys most of the implicit assumptions behind your test. $\endgroup$
    – whuber
    Mar 25, 2019 at 18:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.