[R] likelihood from test result

David Bickel dbickel at uottawa.ca
Wed Jan 9 16:46:29 CET 2008

Is there any automatic mechanism for extracting a likelihood or test
statistic distribution (PDF or CDF) from an object of class "htest" or
from another object of a general class encoding a hypothesis test

I would like to have a function that takes "x", an object of class
"htest", as its only argument and that returns the likelihood or test
statistic distribution that was used to compute the p-value. It seems
the only way to write such a function is to manually assign each test
its statistic's distribution, e.g., like this:

FUN <- if(names(x$statistic) == "t")
else if(names(x$statistic) == "X-squared")
# etc.

Is there a general S3 or S4 class other than "htest" that would better
accommodate such extraction of distributions or likelihoods? I would
also appreciate any suggestions for strategies or contributed packages
that may facilitate automation. For example, would the "distrTEst"
package help?


David R. Bickel
Ottawa Institute of Systems Biology

More information about the R-help mailing list