Skip to contents

Fit \(y = Xb + e\) by least squares and form the first-order conditions \(f_{it} = x_{it} e_t\) for the m regression parameters and \(f_{m+1,t} = e_t^2 - \sigma^2\) for the error variance, whose cumulative sums \(S_t\) are zero at \(t = n\) by construction. With \(V = \sum_t f_t f_t'\) the joint statistic is \(L_c = (1/n)\sum_t S_t' V^{-1} S_t\), and the individual ones are \(L_i = (1/n)\sum_t S_{it}^2 / V_{ii}\). Because \(S_n = 0\) the cumulative sums are a tied-down random walk under the null, so the limit is a Brownian bridge and the critical values depend only on the number of parameters tested. Including the variance score is what gives power against a shift in \(\sigma^2\).

Usage

Lctest(y, X, add_intercept = TRUE, variance = TRUE)

Arguments

y

Response, in the order stability is tested against.

X

n by p regressors, ordered the same way.

add_intercept

Prepend a column of ones.

variance

Include the error-variance score (df = m + 1).

Value

List with statistic (L_c), df, individual, critical, n, method.

References

Nyblom (1989), JASA 84:223-230; Hansen (1992), Journal of Policy Modeling 14:517-533: eqs (3)-(4) give the scores, (9)-(10) give L_c, and Table 1 – reproduced verbatim above – is the critical-value table. No p-value is returned: Table 1 gives six points and interpolating between them would invent precision the published table does not carry. strucchange's sctest(type="Nyblom-Hansen") averages over the n+1 points of the empirical process including the zero at t=0, so its value is n/(n+1) times the L_c of eq (9) returned here.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
D <- data.frame(x = c(1, 2, 3, 4), y = c(2, 4, 5, 9))
Lctest(D, V)
#> $statistic
#> [1] 0.7036788
#> 
#> $df
#> [1] 3
#> 
#> $individual
#> [1] 0.1218220 0.1246613 0.3377919
#> 
#> $critical
#>  0.01 0.025  0.05 0.075   0.1   0.2 
#> 1.350 1.160 1.010 0.913 0.846 0.679 
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Nyblom-Hansen joint parameter stability test"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"