8
$\begingroup$

I have the data:

numbers <- c(0.176, 0.005, 0.022, 0.016, 0.036, 0.095, 0.069 )
Inds <- as.factor(c("P06", "P07", "P08", "P09", "P10", "P12", "P13") )

and am trying to test for differences in numbers as a function of Inds. The numbers are proportions of an events success for each individual. With Inds specified as a factor, I am trying conduct an ANOVA using aov() (below)

anova(aov(numbers ~ Inds))

which results in the warning (below)

Analysis of Variance Table
Response: numbers
          Df   Sum Sq   Mean Sq F value Pr(>F)
Inds       6 0.021743 0.0036238               
Residuals  0 0.000000                         
Warning message:
In anova.lm(aov(numbers ~ Inds)) :
  ANOVA F-tests on an essentially perfect fit are unreliable

Any suggestions (changes in code or theoretical mistakes) would be appreciated.

$\endgroup$
  • 9
    $\begingroup$ This is really a statistical question rather than a programming question. If you want to do an ANOVA you need more than one observation per group. You can test equality of proportions with a single observation per group (e.g. with a binomial GLM or with a Pearson X^2 contingency table analysis), but you will need to have the total number of individuals per group, not just the proportions. $\endgroup$ – Ben Bolker Jan 15 '14 at 23:52
  • 5
    $\begingroup$ This question appears to be off-topic because it is about statistics $\endgroup$ – John Jan 15 '14 at 23:53
  • 1
    $\begingroup$ The other point to consider is that using proportions as a continuous variable obscures the underlying data which of necessity are counts. (So still evidence that you DO need statistical help.) $\endgroup$ – DWin Jan 16 '14 at 1:51
  • 2
    $\begingroup$ the F-test is essentially a ratio of standard deviations. Every factor has only one observation. Your standard deviation is zero. You get a test-statistic of infinity making it ridiculous to compare variances because there is no variance in your sample. $\endgroup$ – Hans Roggeman Jan 16 '14 at 2:08
  • 3
    $\begingroup$ I first read the title as implying that R can't be trusted here. But R's reaction to the command is undoubtedly reasonable. If anything it understates that the user asked a question that can't be answered. Otherwise put, the warning is a warning to the user, not a warning about R. $\endgroup$ – Nick Cox Jan 16 '14 at 12:03
16
$\begingroup$

The F-test is essentially a ratio of standard deviations. Every factor has only one observation in your sample data. Your standard deviation is zero. You get a test-statistic of zero because one cannot compare variances in your sample because there is no variance in your sample.

There is variance across factors but not within a factor.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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