Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding confidence intervals to a qq plot?

Is there a way to add confidence intervals to a qqplot?

I have a dataset of gene expression values, which I've visualized using PCA:

pca1 = prcomp(data, scale. = TRUE)

I'm now looking for outliers by checking the distribution of the data against the normal distribution through:

qqnorm(pca1$x,pch = 20, col = c(rep("red", 73), rep("blue", 33)))

qqline(pca1$x)

This is my data:

data = [2.48 104 4.25 219 0.682 0.302 1.09 0.586 90.7 344 13.8 1.17 305 2.8 79.7 3.18 109 0.932 562 0.958 1.87 0.59 114 391 13.5 1.41 208 2.37 166 3.42]

I would now like to plot 95% confidence intervals to check which data points lie outside. Any tips on how to do this?

like image 405
user2846211 Avatar asked Oct 11 '13 11:10

user2846211


People also ask

How do you normality a Q-Q plot?

If the data is normally distributed, the points in a Q-Q plot will lie on a straight diagonal line. Conversely, the more the points in the plot deviate significantly from a straight diagonal line, the less likely the set of data follows a normal distribution.

What if your Q-Q plot is not normal?

If the data is non-normal, the points form a curve that deviates markedly from a straight line. Possible outliers are points at the ends of the line, distanced from the bulk of the observations.


1 Answers

The library car provides the function qqPlot(...) which adds a pointwise confidence envelope to the normal qq-plot by default:

library(car)
qqPlot(pca1$x)
like image 138
sieste Avatar answered Oct 18 '22 18:10

sieste