[R] t.test() with missing values

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Fri Sep 14 10:26:16 CEST 2007


Birgit Lemcke wrote:
> Thanks for your answer.
>
> First I will show you both vectors:
>   [...]
>
> I tried this (complete.cases(Fem66, Mal66)) and you are right, it
> gives me back:
>
> (complete.cases(Fem66, Mal66))
>   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> FALSE FALSE FALSE
[....]
> I thought the t.test is a comparison of means and why can I not use it
> if I have a lot of missing values. Is the reason that I use the paired
> option?
> What is different in the calculation using paired?
>
> Ah ja this seems to be the case:
>
> T66<-t.test(Mal66, Fem66, alternative= "two.sided")
> > T66
>
>
> Welch Two Sample t-test
>
> data:  Mal66 and Fem66
> t = -0.4881, df = 49.229, p-value = 0.6277
> alternative hypothesis: true difference in means is not equal to 0
> 95 percent confidence interval:
> -1.4637045  0.8915906
> sample estimates:
> mean of x mean of y
> 5.096552  5.382609
>
> I use the paired option because may plants (male and female) belong to
> the same species (and because may boss said that I have to use paired
> in this case)
Don't do what your boss says, do what is right! (It might of course be
the same thing). So pair #1 is one species, pair #2 another species, up
to 331 different species?

> So what can I do now to solve my problem?
>
> Do you think I should not use paired=TRUE?
You *can* only use it when you have pairs, and you must do it then, to
correct for intra-pair correlation. The drawback is that it looks only
at complete pairs, throwing away all the singlets. It is possible to
recover the information from the singlets , basically by combining a
paired test for the pairs and an unpaired one for the singlets. (Someone
must have written this down, but I'm afraid I don't have a nice reference).

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list