Learn R Programming

hspm (version 1.1)

regimes: Estimation of regimes models

Description

The function regimes deals with the estimation of regime models. Most of the times the variable identifying the regimes reveals some spatial aspects of the data (e.g., administrative boundaries).

Usage

regimes(formula, data, rgv = NULL, vc = c("homoskedastic", "groupwise"))

Value

An object of class lm and spregimes.

Arguments

formula

a symbolic description of the model of the form y ~ x_f | x_v where y is the dependent variable, x_f are the regressors that do not vary by regimes and x_v are the regressors that vary by regimes

data

the data of class data.frame.

rgv

an object of class formula to identify the regime variables

vc

one of c("homoskedastic", "groupwise"). If groupwise, the model VC matrix is estimated by weighted least square.

Author

Gianfranco Piras and Mauricio Sarrias

Details

For convenience and without loss of generality, we assume the presence of only two regimes. In this case, the basic (non-spatial) is: $$ y = \begin{bmatrix} X_1& 0 \\ 0 & X_2 \\ \end{bmatrix} \begin{bmatrix} \beta_1 \\ \beta_2 \\ \end{bmatrix} + X\beta + \varepsilon $$ where \(y = [y_1^\prime,y_2^\prime]^\prime\), and the \(n_1 \times 1\) vector \(y_1\) contains the observations on the dependent variable for the first regime, and the \(n_2 \times 1\) vector \(y_2\) (with \(n_1 + n_2 = n\)) contains the observations on the dependent variable for the second regime. The \(n_1 \times k\) matrix \(X_1\) and the \(n_2 \times k\) matrix \(X_2\) are blocks of a block diagonal matrix, the vectors of parameters \(\beta_1\) and \(\beta_2\) have dimension \(k_1 \times 1\) and \(k_2 \times 1\), respectively, \(X\) is the \(n \times p\) matrix of regressors that do not vary by regime, \(\beta\) is a \(p\times 1\) vector of parameters and \(\varepsilon = [\varepsilon_1^\prime,\varepsilon_2^\prime]^\prime\) is the \(n\times 1\) vector of innovations.

  • If vc = "homoskedastic", the model is estimated by OLS.

  • If vc = "groupwise", the model is estimated in two steps. In the first step, the model is estimated by OLS. In the second step, the inverse of the (groupwise) residuals from the first step are employed as weights in a weighted least square procedure.

Examples

Run this code
data("baltim")
form   <- PRICE  ~ NROOM + NBATH + PATIO + FIREPL + AC + GAR + AGE + LOTSZ + SQFT
split  <- ~ CITCOU
mod <- regimes(formula = form, data = baltim, rgv = split, vc = "groupwise")
summary(mod)
form <- PRICE  ~ AC + AGE + NROOM + PATIO + FIREPL + SQFT | NBATH + GAR + LOTSZ - 1
mod <- regimes(form, baltim, split, vc = "homoskedastic")
summary(mod)


Run the code above in your browser using DataLab