Learn R Programming

strucchange (version 1.5-4)

sctest.formula: Structural Change Tests in Linear Regression Models

Description

Performs tests for structural change in linear regression models.

Usage

# S3 method for formula
sctest(formula, type = , h = 0.15,
    alt.boundary = FALSE, functional = c("max", "range",
    "maxL2", "meanL2"), from = 0.15, to = NULL, point = 0.5,
    asymptotic = FALSE, data, ...)

Value

An object of class "htest" containing:

statistic

the test statistic,

p.value

the corresponding p value,

method

a character string with the method used,

data.name

a character string with the data name.

Arguments

formula

a formula describing the model to be tested.

type

a character string specifying the structural change test that is to be performed, the default is "Rec-CUSUM". Besides the test types described in efp and sctest.Fstats the Chow test and the Nyblom-Hansen test can be performed by setting type to "Chow" or "Nyblom-Hansen", respectively.

h

numeric from interval (0,1) specifying the bandwidth. Determines the size of the data window relative to the sample size (for MOSUM and ME tests only).

alt.boundary

logical. If set to TRUE alternative boundaries (instead of the standard linear boundaries) will be used (for CUSUM processes only).

functional

indicates which functional should be used to aggregate the empirical fluctuation processes to a test statistic.

from, to

numeric. If from is smaller than 1 they are interpreted as percentages of data and by default to is taken to be the 1 - from. F statistics will be calculated for the observations (n*from):(n*to), when n is the number of observations in the model. If from is greater than 1 it is interpreted to be the index and to defaults to n - from. (for F tests only)

point

parameter of the Chow test for the potential change point. Interpreted analogous to the from parameter. By default taken to be floor(n*0.5) if n is the number of observations in the model.

asymptotic

logical. If TRUE the asymptotic (chi-square) distribution instead of the exact (F) distribution will be used to compute the p value (for Chow test only).

data

an optional data frame containing the variables in the model. By default the variables are taken from the environment which sctest is called from.

...

further arguments passed to efp or Fstats.

Details

sctest.formula is a convenience interface for performing structural change tests in linear regression models based on efp and Fstats. It is mainly a wrapper for sctest.efp and sctest.Fstats as it fits an empirical fluctuation process first or computes the F statistics respectively and subsequently performs the corresponding test. The Chow test and the Nyblom-Hansen test are available explicitly here.

An alternative convenience interface for performing structural change tests in general parametric models (based on gefp) is available in sctest.default.

See Also

sctest.efp, sctest.Fstats, sctest.default

Examples

Run this code
## Example 7.4 from Greene (1993), "Econometric Analysis"
## Chow test on Longley data
data("longley")
sctest(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data = longley,
  type = "Chow", point = 7)

## which is equivalent to segmenting the regression via
fac <- factor(c(rep(1, 7), rep(2, 9)))
fm0 <- lm(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data = longley)
fm1 <- lm(Employed ~ fac/(Year + GNP.deflator + GNP + Armed.Forces), data = longley)
anova(fm0, fm1)

## estimates from Table 7.5 in Greene (1993)
summary(fm0)
summary(fm1)

Run the code above in your browser using DataLab