skip to main | skip to sidebar

Useful functions and commands

Thursday, December 3, 2009

likelihood ratio test

> logLik.test
function(fit0,fit)
{
  l0 = logLik(fit0)
  l1 = logLik(fit)
  lratio = abs(as.numeric(l0)-as.numeric(l1))
  df = abs( attr(l1,'df') - attr(l0,'df') )
  pval = 1-pchisq( 2*lratio, df)
  return(pval)
}

Posted by Haky at 12:10 PM
Labels: R-code

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2015 (1)
    • ►  July (1)
  • ►  2014 (19)
    • ►  October (1)
    • ►  August (3)
    • ►  July (3)
    • ►  June (4)
    • ►  May (1)
    • ►  March (5)
    • ►  February (2)
  • ►  2012 (9)
    • ►  July (1)
    • ►  April (3)
    • ►  February (2)
    • ►  January (3)
  • ►  2010 (5)
    • ►  June (1)
    • ►  March (2)
    • ►  February (2)
  • ▼  2009 (15)
    • ▼  December (4)
      • pvalue plot vs uniform; FDR
      • imagesc in CDAT
      • likelihood ratio test
      • log likelihood from lm, glm, polr
    • ►  November (2)
    • ►  October (6)
    • ►  September (2)
    • ►  April (1)
  • ►  2007 (14)
    • ►  July (2)
    • ►  June (4)
    • ►  May (3)
    • ►  March (2)
    • ►  February (3)
  • ►  2006 (7)
    • ►  December (6)
    • ►  November (1)
  • ►  2004 (4)
    • ►  December (3)
    • ►  June (1)

Contributors

  • Haky
  • Yarko

google