# rbreak
## Restricted Structural Change Models

## Overview

Methods for detecting structural breaks and estimating break locations under linear restrictions on coefficients within and across regimes using the method of Perron and Qu (2006).

## Example

```r
library(rbreak)

# Example data
data(example)
y <- example$y
bigt <- length(y)
z <- matrix(1, nrow = bigt, ncol = 1)

# Form A restrictions: coefficients in regimes 1 and 3 are equal, coefficients in regimes 2 and 4 are equal
m <- 3
q <- 1
trm <- 0.10
S <- matrix(c(1, 0,
              0, 1,
              1, 0,
              0, 1), nrow = 4, byrow = TRUE)
s <- rep(0, 4)

# Complete analysis
result_formA <- mainp(
  m = m, q = q, z = z, y = y, trm = trm,
  robust = 0, prewhit = 0, hetvar = 1,
  S = S, s = s,
  doestim = 1, dotest = 0, docv = 0,
  bigt = bigt, forma = 1, formb = 0
)

# Form B restrictions: coefficients in regimes 1 and 3 are equal, coefficients in regimes 2 and 4 are equal
R <- matrix(c(1, 0, -1, 0,
              0, 1,  0, -1), nrow = 2, byrow = TRUE)
r <- c(0, 0)

# Complete analysis
result_formB <- mainp(
  m = m, q = q, z = z, y = y, trm = trm,
  robust = 0, prewhit = 0, hetvar = 1,
  R = R, r = r,
  doestim = 1, dotest = 0, docv = 0,
  bigt = bigt, forma = 0, formb = 1
)
```

## References

Perron, P., and Qu, Z. (2006). "Estimating Restricted Structural Change Models". 
*Journal of Econometrics*, 134(2), 373-399.
<doi:10.1016/j.jeconom.2005.06.030>
  
Bai, J., and Perron, P. (1998). "Estimating and Testing Linear Models with Multiple 
Structural Changes". *Econometrica*, 66(1), 47-78.

Bai, J., and Perron, P. (2003). "Computation and Analysis of Multiple Structural Change Models".
*Journal of Applied Econometrics*, 18(1), 1-22.
