1
$\begingroup$

I plotted normal probability plot in R using qqnorm and qqline. I want some help on:

  1. How to estimate "probability" that a data has normal distribution? (I read in a paper that a probability of 0.10 is required to assume that a data is normally distributed).
  2. Also, how to calculate correlation coefficient for a normal probability plot in R?
  3. Is the normality test valid for nonlinear regression too? (This might be a silly question, excuse me for that!)

Thanks!

$\endgroup$

2 Answers 2

3
$\begingroup$

I plotted normal probability plot in R using qqnorm and qqline.

Great. If you need to assess normality of something, that's a good way to do it.

How to estimate "probability" that a data has normal distribution?

Unless you want to treat this as a Bayesian problem, you don't. If you're doing a hypothesis test, the p-value is not the probability that the data has a normal distribution.

(I read in a paper that a probability of 0.10 is required to assume that data is normally distributed).

a) Either the paper didn't quite say what you think it did, or it's basically wrong. It might have said something about a p-value of 0.1, but if it says that you need a p-value of 0.1 to assume normality, at best it's an unsupportable generalization that might be suitable for some people in some particular circumstances.

b) Even leaving that aside, you probably don't want to do a formal hypothesis test of normality. (Why are you checking normality?)

Edit: responding to a Q in comments (wording slightly reordered here so it doesn't lose clarity out of context.)

[I'm] testing normality in a nonlinear regression model for microbial growth, because if residuals are not normally distributed, what other distribution or pattern they are following?

The question isn't "are they normal?" (that's essentially never going to be true). The question is more like "does the degree of non-normality we have impact the inference so much we wouldn't be prepared to assume normality?"

-- See this answer starting at "But given that real data..." onward, skipping the two paragraphs starting at "Similar considerations..." but then reading to the end.

Also, how to calculate correlation coefficient for a normal probability plot in R?

If your data is in y, you'd do it like this:

 cor(y,qnorm(ppoints(length(y)))[order(order(y))])

Is the normality test valid for nonlinear regression too?

Almost as valid as it is in linear regression. (Which is to say, I'd generally advise against formal testing of regression assumptions in either case.)

Computing the correlation is fine as far as it goes. If you want to use that in a test, that's already implemented in R (it's the Shapiro-Francia test), the function is sf.test in package nortest. It's nearly as powerful as the Shapiro-Wilk.

$\endgroup$
6
  • $\begingroup$ (Sorry, I am unable to format a comment properly so couldn't place a link to the paper) 1. The paper says "For n = 11, r = 0.961, and the probability that the data are normally distributed is approximately 0.3" AND "...typically a probability of less than 0.10, or perhaps even less than 0.05, is required before rejecting the hypothesis of normality" I understood that it means there is a measure of "probability" of normality. 2. I am checking normality of residuals from a model fit as a part of residual analysis. Contd... $\endgroup$
    – Learner
    Commented Sep 4, 2014 at 20:19
  • $\begingroup$ 3. The script isn't working for me, giving "incompatible dimensions" error. $\endgroup$
    – Learner
    Commented Sep 4, 2014 at 20:20
  • $\begingroup$ Just give the URL for the paper (paste it in). If context doesn't change things, that first comment appears to be nonsense. The second might not be wrong, depending on how it's justified, but the comment in my answer would still apply. 2. What model? Why test normality? 3. The code works but it expects a vector. What are you passing it? $\endgroup$
    – Glen_b
    Commented Sep 4, 2014 at 21:26
  • $\begingroup$ 1. Here is the link: (researchgate.net/publication/…) Page 4 under Test for Normality of Data. 2. A nonlinear regression model for microbial growth. Testing because if residuals are not normally distributed, what other distribution or pattern they are following. 3. I was passing it a data frame. Vector solved the problem! $\endgroup$
    – Learner
    Commented Sep 4, 2014 at 22:25
  • $\begingroup$ On 2., I've written some more in my answer, under (b). $\endgroup$
    – Glen_b
    Commented Sep 4, 2014 at 22:48
1
$\begingroup$

Your data are either Normal (in which case the probability that the data have a Normal distribution is 1) or they are not Normal (in which case said probability is 0). If you'd like to test the null hypothesis that the data are Normal, against the alternative that the data follow some other distribution, you can consider using a Shapiro-Wilk test of Normality. But the observed significance level (OSL) for that (p-value) is not a probability in the sense you desire: you probably want $P\{$Underlying Normal | Data$\}.$ The OSL is the probability a random sample from a Normal would be that extreme or more extreme.

The choice of a critical value is dependent on the situation. Ten percent might be reasonable, or it might be too low (or even too high) depending on circumstances.

The Shapiro-Wilk statistic is more-or-less the correlation coefficient you seek. Strictly speaking, a product-moment correlation coefficient is inappropriate -- by using the order statistics you have induced a correlation.

Again, strictly speaking, tests of Normality are not appropriate for use on residuals because the assumption in the test derivation is i.i.d. observations and ordinary residuals are necessarily correlated. For large samples, though, the correlation is usually small (of order $n^{-1}$) and generally ignored. So the tests are as applicable to nonlinear least squares (or maximum likelihood) residuals as they are to linear least squares residuals.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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