LRTpv.fun: Calculate the p-value of a likelihood ratio test for each...

Description Usage Arguments Details Value See Also Examples

View source: R/LRTpv.fun.r

Description

This function calculates, for each covariate in the model (except the intercept), the p-value of a likelihood ratio test comparing the original fitted NHPP with the model excluding that covariate from the linear predictor.

Usage

1
LRTpv.fun(mlePP)

Arguments

mlePP

An object of class mlePP-class; usually, the output from fitPP.fun. The fitted model cannot include fixed parameters.

Details

A LRT is carried for all the covariates in the linear predictor except the intercept. If the model has not an intercept and there is only one covariate, no test can be carried out.

Value

A matrix with one column, which contains the LRT p-values for all the covariates in the model (except the intercept)

See Also

fitPP.fun, testlik.fun, dropAIC.fun, addAIC.fun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(BarTxTn)
covB<-cbind(cos(2*pi*BarTxTn$dia/365), sin(2*pi*BarTxTn$dia/365), 
	BarTxTn$TTx,BarTxTn$Txm31,BarTxTn$Txm31**2)
BarEv<-POTevents.fun(T=BarTxTn$Tx,thres=318, 
	date=cbind(BarTxTn$ano,BarTxTn$mes,BarTxTn$dia))

mod1B<-fitPP.fun(tind=TRUE,covariates=covB, 
	posE=BarEv$Px, inddat=BarEv$inddat,
	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=FALSE)

LRTpv.fun(mod1B)

Example output

Loading required package: stats4
Number of events:  137
Number of excesses over threshold 318 : 253

Number of observations  not used in the estimation process:  116
Total number of time observations:  8415
Number of events:  137

Convergence code:  0
Convergence attained
Loglikelihood:  -522.727

Estimated coefficients: 
     b0      b1      b2      b3      b4      b5 
-89.289   2.534   1.425  -0.006   0.557  -0.001 
Full coefficients: 
     b0      b1      b2      b3      b4      b5 
-89.289   2.534   1.425  -0.006   0.557  -0.001 
attr(,"TypeCoeff")
[1] "Fixed: No  fixed parameters"


  The p-values of the LRT comparing the initial model and the model without the covariate 
           p-values
Covariate1    0.034
Covariate2    0.000
Covariate3    0.634
Covariate4    0.000
Covariate5    0.000
               p-values
Covariate1 3.423331e-02
Covariate2 7.105427e-14
Covariate3 6.338780e-01
Covariate4 6.936213e-08
Covariate5 0.000000e+00

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