Search code examples
rt-test

Why when I run the ggttest there is an error?


When I run the t-test for a numeric and a dichotomous variable there in no problem and I can see the results. The problem is when I run the ggttest of the same t-test. There is an error and says that one of my variable is not found. I do not why that happens. The aml dataset I used is from package boot. Below you can see the code:

https://i.sstatic.net/7kuaA.png

library(gginference)
time_group.test16537 = t.test(formula = time~group,
                              data = aml,
                              alternative = "two.sided",
                              paired = FALSE,
                              var.equal = FALSE,
                              conf.level = 0.95)
    time_group.test16537


    ggttest(time_group.test16537,
            colaccept="lightsteelblue1", 
            colreject="gray84", 
            colstat="navyblue")

Solution

  • The problem comes with these lines of code in ggttest:

    datnames <- strsplit(t$data.name, splitter)
    len1 <- length(eval(parse(text = datnames[[1]][1])))
    len2 <- length(eval(parse(text = datnames[[1]][2])))
    

    It tries to find the len of group and time, but it doesn't see that it came from a data.frame. Pretty bad bug...

    For your situation, supposedly you have less than 30 in each group and it plots a t-distribution, so do:

    library(gginference)
    library(boot)
    gginference:::normt(t.test(time~group,data=aml),
    colaccept = "lightsteelblue1",colreject = "grey84", 
    colstat = "navyblue")
    

    enter image description here