SCM

SCM Repository

[depmix] View of /trunk/R/llratio.R
ViewVC logotype

View of /trunk/R/llratio.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 66 - (download) (annotate)
Fri Mar 7 13:45:15 2008 UTC (11 years, 7 months ago) by ingmarvisser
File size: 542 byte(s)
Moved necessary files into R directory
setClass("llratio",
	representation(
		value="numeric",
		df="numeric"
	)
)

llratio <- function(basemodel,constrainedmodel,...) {
	llbase <- logLik(basemodel)
	llcon <- logLik(constrainedmodel)
	llr <- -2*(llbase-llcon)
	df <- attributes(llbase)$df-attributes(llcon)$df
	return(new("llratio",value=as.numeric(llr),df=df))
}

setMethod("show","llratio",
	function(object) {
		pvalue=round(pchisq(object@value,object@df,lower=FALSE),3)
		cat("log Likelihood ratio: ", round(object@value,3), " (df=",object@df,"), p=",pvalue,"\n",sep="")
	}
)

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge