testlik.fun: Likelihood ratio test to compare two nested models

Description Usage Arguments Details Value References See Also Examples

View source: R/testlik.fun.r

Description

This function performs a likelihood ratio test, a test to compare the fit of two models, where the first one (the null model ModR) is a particular case of the other (the alternative model ModG).

Usage

1
 testlik.fun(ModG, ModR) 

Arguments

ModG

An object of class mlePP-class; usually, the output from fitPP.fun.

ModR

An object of class mlePP-class; usually, the output from fitPP.fun.

Details

The test statistic is twice the difference in the log-likelihoods of the models. Under the null, the statistic follows a χ^2 distribution with degrees of freedom df2-df1,the number of parameters of modG and modR respectively.

Value

A list with elements

pv

P-value of the likelihood ratio test.

ModG

Input argument.

ModR

Input argument.

References

Casella, G. and Berger, R.L., (2002). Statistical inference. Brooks/Cole.

See Also

fitPP.fun,LRTpv.fun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##The alternative model modB is specified  by the output fitPP.fun
##The null model modBR is specified  by a list with elments llik and npar


data(BarTxTn)

covB<-cbind(cos(2*pi*BarTxTn$dia/365), sin(2*pi*BarTxTn$dia/365), 
	BarTxTn$TTx,BarTxTn$Txm31,BarTxTn$Txm31**2)


modB<-fitPP.fun(tind=TRUE,covariates=covB, 
	POTob=list(T=BarTxTn$Tx, thres=318),
	tim=c(1:8415), tit="BAR Tx; cos, sin, TTx, Txm31, Txm31**2", 
	start=list(b0=-100,b1=1,b2=10,b3=0,b4=0,b5=0),dplot=FALSE,modCI=TRUE,	modSim=TRUE)



modBR<-fitPP.fun(tind=TRUE,covariates=covB[,1:4], 
	POTob=list(T=BarTxTn$Tx, thres=318),
	tim=c(1:8415), tit="BAR Tx; cos, sin, TTx, Txm31", 
	start=list(b0=-100,b1=1,b2=10,b3=0,b4=0),dplot=FALSE,modCI=TRUE,	modSim=TRUE)


aux<-testlik.fun(ModG=modB,ModR=modBR)

NHPoisson documentation built on Feb. 19, 2020, 5:07 p.m.