GetLikeDI: Calculate the Likelihood function value provide a certain...

Description Usage Arguments Value Author(s) Examples

Description

Likelihood function value is calcuated for the intervention

Usage

1
GetLikeDI(delta, z, T, xint = NA, itype = c("step", "pulse"), ...)

Arguments

delta

The specific number for Intervention Level estimated

z

The time series we fit into the model

T

The start of the Intervention in the series

xint

The covariate considered in the model

itype

The type of intervention fitting in the model:"Step"(Default),"Step"

...

Supported argment for arima function

Value

Likelihood value is provided

Author(s)

Jinkun Xiao and A. I. McLeod

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
###Likelihood Test for Casualties with null:delta=1###
###Constrained Model Likelihood####
(LLRestricted<-GetLikeDI(delta=0,z=casualties[,1],T=70,xint=scale(casualties[,2]),
 itype="s",order=c(1,0,0),seasonal=list(order=c(0,0,1),period=12)))
###Full Model Likelihood###
(LLFull <- optimize(f = GetLikeDI, interval = c(0.1, 2),  maximum = TRUE, 
 z = casualties[,1], T = 70, xint = scale(casualties[,2]), itype = "s", 
 order=c(1,0,0),seasonal=list(order=c(0,0,1),period=12)))
X <- 2 * (LLFull$objective - LLRestricted)
###P-VLUE For Likelihood Test###
(pval <- 1 - pchisq(X, 1))
GetPV(delta0=1,z=casualties[,1],T=70,xint=scale(casualties[,2]),itype="s",order=c(1,0,0),
  seasonal=list(order=c(0,0,1),period=12))

######################################################
###Likelihood Test for Nile Flow with null:delta=1####
LLRestricted <- GetLikeDI(delta=1,z=Nile,T=34,itype="p",order=c(1,0,0))
ans <- optimize(f = GetLikeDI, interval = c(0.1, 2), maximum = TRUE,z=Nile,T=33
                ,itype="p",order=c(1,0,0)) 
LLFull <- ans$objective
X <- 2 * (LLFull - LLRestricted)
(pval <- 1 - pchisq(X, 1))
GetPV(delta0=0,z=Nile,T=34,itype="p",order=c(1,0,0))

dynia documentation built on May 1, 2019, 10:17 p.m.

Related to GetLikeDI in dynia...