Dear Dr. Eichner and Dr. Kohl, First, thank you for your response. I tried your code and R it worked perfectly I just had to add: mi.t.test(implist*$imputation,* "pre_test", "post_test", alternative = "greater", paired = TRUE, var.equal = TRUE, conf.level = 0.95) for the code to run.
Thank you very much again for taking the time. Best, Joel On Fri, Apr 7, 2017 at 3:26 PM, Prof. Dr. Matthias Kohl < matthias.k...@stamats.de> wrote: > Dear Joel, > > are you trying to apply function mi.t.test from my package MKmisc? > > Could you please try: > mi.t.test(implist, "pre_test", "post_test", alternative = > "greater", paired = TRUE, var.equal = TRUE, conf.level = 0.95) > > x and y are the names of the variables, not the variables themselves. > > Best > Matthias > > 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@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/posti >> ng-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> > -- > Prof. Dr. Matthias Kohl > www.stamats.de > [[alternative HTML version deleted]] ______________________________________________ R-help@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.