[R] likelihood from test result

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Wed Jan 9 17:22:59 CET 2008


David Bickel wrote:
> 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
> result?
>
> 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")
>   dt
> else if(names(x$statistic) == "X-squared")
>   dchisq
> # etc.
>
>   
Just take the p-value itself as the test statistic and use dunif.

I think doing this may also show you that you have a conceptual problem....
(What would you do with the likelihood?)

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list