# Check statistical significance of one observation [duplicate]

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.

set.seed(1)
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

• Could you give us more context on this? Why do you want to check for significance? Do you mean detecting outliers? – Tim Mar 25 '19 at 13:15
• 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. – Robert Jones Apr 5 '19 at 13:24

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.

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.

• 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. – whuber Mar 25 '19 at 14:02
• 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 – David Mar 25 '19 at 14:15
• thanks to all. how about boot-strapping? – aaaaa Mar 25 '19 at 15:02
• 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. – whuber Mar 25 '19 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

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

• Interesting idea--but useless, because this "X variable" will have infinite leverage and you will never be able to identify an outlier this way! – whuber Mar 25 '19 at 14:04
• 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 " ? – IrishStat Mar 25 '19 at 17:33
• The residual for the "point where the candidate fails" will always be zero. – whuber Mar 25 '19 at 17:58
• 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 ) – IrishStat Mar 25 '19 at 18:14
• 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. – whuber Mar 25 '19 at 18:50