View source: R/detectors_retrospective.R
| Q.test | R Documentation | 
Performs the multivariate forward CUSUM R-test (retrospective) with linear boundary
Q.test(formula, alternative = c("two.sided", "greater", "less"), H = NULL)
formula | 
 Specification of the linear regression model by an object of the class "formula"  | 
alternative | 
 A character string specifying the alternative hypothesis; must be one of "two.sided" (default), "greater" or "less". The output detector is the maximum norm of Q_t ("two.sided"), the maximum entry of Q_t ("greater"), or maximum entry of -Q_t ("less"), respectively.  | 
H | 
 An optional matrix for the partial hypothesis H'β_t = H'β_0, where H'Q_t is considered instead of Q_t. H must have orthonormal columns. For a test for a break in the intercept, H can also set to the string "intercept". The full structural break test is considered as the default setting (NULL).  | 
A list containing the following components:
detector | 
 A vector containing the path of the detector statistic depending on the specificaton for the alternative hypothesis  | 
boundary | 
 A vector containing the values of the linear boundary function  | 
detector.scaled | 
 A vector containing the path of the detector divided by the boundary  | 
statistic | 
 The test statistic; maximum of detector.scaled  | 
alternative | 
 The specification for the alternative hypothesis  | 
critical.value | 
 A vector containing critical values for different significance levels; NA if critical value for this specification is not implemented  | 
rejection | 
 A logical vector containing the test decision for different significance levels; TRUE for rejection; NA if critical value is not implemented  | 
T <- 100 u <- rnorm(T,0,1) x <- rnorm(T,1,2) y <- c(rep(0,T/2), rep(0.7,T/2)) + x + I(x^2) + u Q.test(y~1+x+I(x^2)) Q.test(y~1+x+I(x^2), alternative = "greater") H <- matrix(c(1,0,0), ncol = 1) Q.test(y~1+x+I(x^2), H = H)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.