[R] Paired sample t-test with mi.t.test

Gerrit Eichner Gerrit.Eichner at math.uni-giessen.de
Fri Apr 7 13:55:28 CEST 2017


Hi, Joel,

I think, according to the help page of mi.t.test,

mi.t.test(implist, x = "pre_test", y = "post_test",
   alternative = "greater", paired = TRUE, var.equal = TRUE,
   conf.level = 0.95)

should do it (untested).

  Hth  --  Gerrit

---------------------------------------------------------------------
Dr. Gerrit Eichner                   Mathematical Institute, Room 212
gerrit.eichner at math.uni-giessen.de   Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104          Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109            http://www.uni-giessen.de/eichner
---------------------------------------------------------------------

Am 06.04.2017 um 18:32 schrieb Joel Gagnon:
> Dear all,
>
> It is my first time posting on this list so forgive me for any rookie
> mistakes I could make.
>
> I want to conduct t-tests on a dataset that has been imputed using the mice
> package:
> imput_pps <- mice(pps, m=20, maxit=20, meth='pmm') # pps is my dataset. It
> contains items from an 11-item questionnaire gather at pre and post test.
> So the data set has 22 columns.
>
> I then proceed to compute the total scores for the pre and post test on my
> imputed datasets:
>
> long_pps <- complete(imput_pps, action ="long", include = TRUE)
> long_pps$pre_test <- rowSums(long_pps[ ,c(3:13)])
> long_pps$post_test <- rowSums(long_pps[ , c(14:24)])
>
> I then used as.mids to convert back to mids object:
> mids_pps <- as.mids(long_pps)
>
> Next, I created an imputation list object using mitools:
> implist <- lapply(seq(mids_pps$m), function(im) complete(mids_pps, im))
> implist <- imputationList(implist)
>
> Now, I want to conduct t-tests using the mi.t.test package. I tried the
> following code:
> mi.t.test(implist, implist$pre_test, implist$post_test, alternative =
> "greater", paired = TRUE, var.equal = TRUE, conf.level = 0.95)
>
> When I run this code, R tells me that Y is missing. I know this may sound
> stupid, but I thought that I specified Y with this line: implist$pre_test,
> implist$post_test - with implist$pre_test being X and implist$post_test
> being Y - like I usually do for a normal t-test using the t.test function.
>
> It seems I don't quite understand what the Y variable is supposed to
> represent. Could someone help me figure out what I am doing wrong? You
> help would be very much appreciated.
>
> Best regards,
>
> Joel Gagnon, Ph.D(c),
> Department of Psychology,
> Université du Québec à Trois-Rivières
> Québec, Canada
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list