2
$\begingroup$

I have 123 samples total. 116 samples are of sample size 3; 7 samples are of sample size 2. They definitely have different population means, but may or may not have a common population variance.

If I were to hypothesise that each originates from an identical normal distribution except for different means, is there a way (possibly assuming a common population variance) to do a single assessment (with the result in the form of a likelihood or a test result) for whether this is the case or not?

(This, testing the normality of lots of samples from a common measurement procedure with a small sample size each, being in contrast with testing the normality of a single sample with a large sample size.)

Edit: Relevant regarding my statistics comprehension: the below webpage looks relevant to my question, but when I try to read and understand the answer my mind goes blank. How to test for normality of growth disturbances in chemo treatment?

$\endgroup$
5
  • $\begingroup$ I your first sentence. "... are sample size 3 and 7 are sample size 2." makes no sense. Please revise. // If I have mainly understood anyhow, maybe consider doing a huge one-way ANOVA with 123 levels of the factor, ostensibly to test whether all means are equal. Then MS(Resid) is estimate of common variance. Also, you can do a normality test on the residuals as a somewhat imperfect test of normality of the samples. $\endgroup$
    – BruceET
    Sep 6, 2020 at 15:27
  • $\begingroup$ @BruceET , Sentence revised to '116 samples are of sample size 3; 7 samples are of sample size 2.'. May I ask the nature and process of obtaining 'MS(Resid)'? Is this dependent on having carried out an ANOVA, or separate from the ANOVA? Also, is 'a normality test on the residuals' a single assessment or 123 separate assessments (and if a single assessment, is it dependent on having done an ANOVA)? Thank you for your time! $\endgroup$
    – MCC
    Sep 6, 2020 at 15:41
  • $\begingroup$ A further question--when I read about residuals, I come across descriptions of linear regression: having a linear equation that predicts a dependent variable from an independent variable, then calculating the residual in terms of its distance from the predicted value. For my samples, the only estimate I have for each sample is each sample's mean, rather than a linear equation. Is there still a link between population distribution normality and distance-from-sample-mean normality? (Whether there is or isn't, is there something published I can cite that states it clearly?) $\endgroup$
    – MCC
    Sep 6, 2020 at 15:58
  • $\begingroup$ The sample mean is linear. Your situation is that of ANOVA and constitutes an ordinary least squares problem. The challenging aspect of the question concerns testing the hypotheses of Normality and homescedasticity. $\endgroup$
    – whuber
    Sep 6, 2020 at 17:07
  • $\begingroup$ @whuber , I am simultaneously intrigued and confused by 'the sample mean is linear': if the samples are of different categories A/B/C/D et cetera rather than representing a numeric independent variable ('discrete rather than continuous'?) is this phrase still applicable, and if so then how so? (Edit: Now staring at and contemplating BruceET's answer, which I believe may address the same concept.) $\endgroup$
    – MCC
    Sep 7, 2020 at 2:48

1 Answer 1

2
$\begingroup$

I don't think you will get much information from the datasets with only two observations. Here is an example with six datasets with three replications (instead of your 116).

set.seed(1234)
x1 = rnorm(3, 100, 15);  x2 = rnorm(3, 104, 15)
x3 = rnorm(3,  90, 15);  x4 = rnorm(3, 102, 15)
x5 = rnorm(3, 100, 15);  x6 = rnorm(3, 105, 15)
x = c(x1,x2,x3,x4,x5,x6)
g = as.factor(rep(1:6, each=3))

In the ANOVA table below MS(Resid) = 186.8 estimates the common variance $\sigma^2 = 15^2 = 256.$ With so little data, this is not a very good estimate, but it should be a better estimate for your more extensive data.

aov.out = aov(x ~ g)
summary(aov.out)
            Df Sum Sq Mean Sq F value Pr(>F)
g            5  853.6   170.7   0.914  0.504
Residuals   12 2241.1   186.8 

We can obtain the residuals and test them for normality as follows: A Shapiro-Wilk test of normality does not reject the null hypothesis that data are from a normal distribution. A normal probability plot of the residuals is reasonably close to linear.

r = aov.out$resi
shapiro.test(r)

        Shapiro-Wilk normality test

data:  r
W = 0.95288, p-value = 0.4719

qqnorm(r); qqline(r)

enter image description here

Most intermediate-level statistics texts discuss testing residuals from an ANOVA model for normality. The model for a one-way ANOVA is $$Y_{ij} = \mu + a_i + e_{ij},$$ where $i = 1,2 \dots, G,$ for $G$ groups (6 above) and $j=1,2,3$ (above). The $e_{ij} \stackrel{}{\sim} \mathsf{Norm}(0, \sigma),$ where $\sigma^2$ is the common group variance. Residuals are $r_{ij} = Y_{ij} - \bar Y_i,$ where $\bar Y_i$ are the $G$ group sample means. The residuals $r_{ij}$ emulate the normal random errors $e_{ij},$ except that residuals in each group must add to $0,$ so that the $r_{ij}$ are not exactly independent.

$\endgroup$
2
  • 1
    $\begingroup$ Thank you very much for this. The R code is presently beyond me (and I must understand , but the input data and output results seem exactly what I was looking for. I believe I understand what is done by rnorm(), c(), and rep(). I do not understand the as.factor() or aov.out (or summary()) parts. I am delighted by shapiro.test(r), qqnorm(r), and qqline(r)! I am currently hoping that I can calculate all the residuals (by subtracting each sample's mean from its measurements) in a spreadsheet, then use shapiro.test()/qqnorm()/qqline() directly on the copied data. Thank you again! $\endgroup$
    – MCC
    Sep 7, 2020 at 3:15
  • $\begingroup$ In R, some versions of ANOVA require the variable (here g) that specifies Groups to be declared as a (categorical) factor variable, otherwise the 1s, 2s, etc, in g will be treated as numbers (as for a regression). aov.out is just a list to hold all the results of the ANOVA: the summary(aov.out) gives the ANOVA table; later aov.out$resi gives resids; other info available in aov.out not shown here. Your method in last sentence should work in spreadsheet, if spreadsheet can make ANOVA table. // R is indeed worth learning--gradually. Lots of online demos Start with one thing at a time. $\endgroup$
    – BruceET
    Sep 7, 2020 at 5:58

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.