hmctest | R Documentation |
Harrison-McCabe test for heteroskedasticity.
hmctest(formula, point = 0.5, order.by = NULL, simulate.p = TRUE, nsim = 1000, plot = FALSE, data = list())
formula |
a symbolic description for the model to be tested
(or a fitted |
point |
numeric. If |
order.by |
Either a vector |
simulate.p |
logical. If |
nsim |
integer. Determines how many runs are used to simulate the p value. |
plot |
logical. If |
data |
an optional data frame containing the variables in the model.
By default the variables are taken from the environment which |
The Harrison-McCabe test statistic is the fraction of the residual sum of squares that relates to the fraction of the data before the breakpoint. Under H_0 the test statistic should be close to the size of this fraction, e.g. in the default case close to 0.5. The null hypothesis is reject if the statistic is too small.
Examples can not only be found on this page, but also on the help pages of the
data sets bondyield
, currencysubstitution
,
growthofmoney
, moneydemand
,
unemployment
,
wages
.
A list with class "htest"
containing the following components:
statistic |
the value of the test statistic. |
p.value |
the simulated p-value of the test. |
method |
a character string indicating what type of test was performed. |
data.name |
a character string giving the name(s) of the data. |
M.J. Harrison & B.P.M McCabe (1979), A Test for Heteroscedasticity based on Ordinary Least Squares Residuals. Journal of the American Statistical Association 74, 494–499
W. Krämer & H. Sonnberger (1986), The Linear Regression Model under Test. Heidelberg: Physica
lm
## generate a regressor x <- rep(c(-1,1), 50) ## generate heteroskedastic and homoskedastic disturbances err1 <- c(rnorm(50, sd=1), rnorm(50, sd=2)) err2 <- rnorm(100) ## generate a linear relationship y1 <- 1 + x + err1 y2 <- 1 + x + err2 ## perform Harrison-McCabe test hmctest(y1 ~ x) hmctest(y2 ~ x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.