Last data update: 2014.03.03

R: Function to update the formula of CADFtest objects
update.CADFtestR Documentation

Function to update the formula of CADFtest objects

Description

This function updates the formula and/or the other arguments of CADFtest object and re-run the test using the updated arguments. It can be useful if one wants to see the effect of adding/removing stationary covariates or the effect of changing lags, kernel, etc. If covariates have to be added/removed, update() works only if model is passed as a formula.

Usage

  ## S3 method for class 'CADFtest'
update(object, change, ...)

Arguments

object

an object belonging to the class CADFtest.

change

list of charater describing the changes to be applied to the existing model.

...

currently not used.

Value

The function re-run the test and returns an object of class CADFtest. See CADFtest().

Author(s)

Claudio Lupi

Examples

  data(npext, package="urca")
  npext$unemrate <- exp(npext$unemploy)      # compute unemployment rate
  L <- ts(npext, start=1860)                 # time series of levels
  D <- diff(L)                               # time series of diffs
  S <- window(ts.intersect(L,D), start=1909) # select same sample as Hansen's
  CADFt <- CADFtest(L.gnpperca~D.unemrate, data=S, max.lag.y=3,
    kernel="Parzen", prewhite=FALSE)
  CADFt.2 <- update(CADFt, change=list("+ D.indprod", "max.lag.X=3", 
	"criterion='BIC'"))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(CADFtest)
Loading required package: dynlm
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: sandwich
Loading required package: tseries
Loading required package: urca
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/CADFtest/update.CADFtest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: update.CADFtest
> ### Title: Function to update the formula of CADFtest objects
> ### Aliases: update.CADFtest
> 
> ### ** Examples
> 
>   data(npext, package="urca")
>   npext$unemrate <- exp(npext$unemploy)      # compute unemployment rate
>   L <- ts(npext, start=1860)                 # time series of levels
>   D <- diff(L)                               # time series of diffs
>   S <- window(ts.intersect(L,D), start=1909) # select same sample as Hansen's
>   CADFt <- CADFtest(L.gnpperca~D.unemrate, data=S, max.lag.y=3,
+     kernel="Parzen", prewhite=FALSE)
>   CADFt.2 <- update(CADFt, change=list("+ D.indprod", "max.lag.X=3", 
+ 	"criterion='BIC'"))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>