richarddmorey / BayesFactor

BayesFactor R package for Bayesian data analysis with common statistical models.
https://richarddmorey.github.io/BayesFactor/
132 stars 49 forks source link

ttestBF(1) throws cryptic error #36

Closed jonathon-love closed 9 years ago

jonathon-love commented 9 years ago
> ttestBF(1)
Error in integrate(meta.t.like, lower, upper, t = t, N = N, df = df, rscale = rscale,  : non-finite function value`
richarddmorey commented 9 years ago

OK, I'll prevent people from trying a t test with one observation...(sigh)

jonathon-love commented 9 years ago

Is it possible for these to be made consistent? We examine the error strings, so it makes it easier on us.

> a <- data.frame(f=c(1,1), g=c(1,2))
> ttestBF(formula=f~g, data=a)
Error in t.test.default(x = 1, y = 1, var.eq = TRUE) : 
  not enough observations

> a <- data.frame(f=c(2,1,3), g=c(1,1,2))
> ttestBF(formula=f~g, data=a)
Error in ttest.tstat(t = t, n1 = ns[1], n2 = ns[2], nullInterval = nullInterval,  : 
  Insufficient sample size for t analysis.
richarddmorey commented 9 years ago

Hmm, one is the result of an error in an R function, and the other is my error. But I can just copy the R function error string. Is that what you want?

[Edit: I did it and committed the changes as 28258cbf825f987cb1dc3ad2cf06b3eb706b883a]