# How to do Chow Test in R

The Chow test is used to compare the coefficients of two distinct regression models on two separate datasets.

This test is commonly used in econometrics using time series data to evaluate if the data has a structural break at some point.

The basic steps are as follows:

Run all of your data through a “limited” regression (pooled).

Using your breakpoint as a guide, divide your sample into two groups (e.g. a point in time, or a variable value).

On each of your subsamples, run an “unrestricted” regression. With a single breakpoint, you’ll run two “unrestricted” regressions.

Then calculate Chow F-statistic.

## Chow Test in R

This tutorial shows you how to execute a Chow test in R step by step.

Let’s create the Data Frame, we can make use of the EuStockMarkets dataset here for illustration purposes.

library(dplyr) data<-data.frame(EuStockMarkets) data <- dplyr::select(data, DAX, SMI)

View first six rows of data

head(data)

DAX SMI 1 1628.75 1678.1 2 1613.63 1688.5 3 1606.51 1678.6 4 1621.04 1684.1 5 1618.16 1686.6 6 1610.61 1671.6

### Visualize the Information

Then, to visualize the data, we’ll make a basic scatterplot. Let’s load ggplot2 package in the R console.

library(ggplot2)

In R, we can now make a scatterplot Chow test.

ggplot(data, aes(x = disp, y = mpg)) + geom_point(col='steelblue', size=3)

We can see from the scatterplot that the data pattern appears to alter at DAX = 4000. But not sure, as a result, we may use the Chow test to see if the data has a structural breakpoint.

Take the Chow Test. To execute a Chow test, we may use the strucchange package’s sctest function:

Let’s load strucchange package

**Syntax**:

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, ...)

The above function returns the following

**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

One Sample Analysis in R » Quick Guide »

library(strucchange)

Now we can perform the Chow test in R

sctest(data$SMI ~ data$DAX, type = "Chow", point = 10)

Chow test data: data$SMI ~ data$DAX F = 212.01, p-value < 2.2e-16

We can reject the null hypothesis of the test because the p-value is less than 0.05. This means we have enough evidence to conclude that the data contains a structural breakpoint.

To put it another way, two regression lines can match the data pattern better than a single regression line.

Subscribe to our newsletter!