godfrey_orme | R Documentation |
This function implements the method of \insertCiteGodfrey99;textualskedastic for testing for heteroskedasticity in a linear regression model. The procedure is more clearly described in \insertCiteGodfrey06;textualskedastic.
godfrey_orme(
mainlm,
hettest,
B = 1000L,
alternative = c("greater", "less", "two.sided"),
seed = 1234,
...
)
mainlm |
Either an object of |
hettest |
A character specifying the name of a function
that implements a heteroskedasticity test on a linear regression model.
The function is called with the |
B |
An integer specifying the number of nonparametric bootstrap samples
to generate. Defaults to |
alternative |
The tailedness of the test whose statistic is computed by
|
seed |
An integer specifying a seed to pass to
|
... |
Additional arguments to pass to function with name |
The procedure runs as follows. (1) The observed
value of the test statistic T_0
is computed using function with
name hettest
. (2) A sample
e_1^\star,e_2^\star,\ldots,e_n^\star
is drawn with replacement from
the OLS residuals. (3) Bootstrapped response values are computed as
y_i^{\star}=x_i' \hat{\beta}+e_i^\star,i=1,2,\ldots,n
.
(4) Bootstrapped test statistic value T^\star
is computed from the
regression of y^\star
on X
using function hettest
.
(5) Steps (2)-(4) are repeated until B
bootstrapped test statistic
values are computed. (6) Empirical p
-value is computed by comparing
the bootstrapped test statistic values to the observed test statistic
value. Note that, if alternative
is set to "two.sided"
, the
one-sided p
-value is doubled (twosidedpval
cannot
be used in this case).
An object of class
"htest"
. If object
is not assigned, its attributes are displayed in the console as a
tibble
using tidy
.
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
godfrey_orme(mtcars_lm, hettest = "breusch_pagan")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.