gq.test: Goldfeld-Quandt Test

gq.testR Documentation

Goldfeld-Quandt Test

Description

Goldfeld-Quandt test for heteroskedastic errors. The object of test results returned by this command can be plotted using the plot() function.

Usage

gq.test(
  mod,
  data = list(),
  split = 0.5,
  omit.obs = 0,
  ah = c("increasing", "unequal", "decreasing"),
  order.by = NULL,
  sig.level = 0.05,
  details = FALSE,
  hyp = TRUE
)

Arguments

mod

estimated linear model object or formula. If only a model formula is passed then the data argument must be specified.

data

if mod is a formula then the corresponding data frame has to be specified.

split

partitions the data set into two groups. If <= 1 then split is a percentage value such that T*split observations are in the first partition. If split >= 1 it is interpreted as the index of the partitioning observation, i.e. the number of observations in the first group.

omit.obs

the number of central observations to be omitted. Might increase the power of the test. If <= 1 then split is the percentage value of all observations, otherwise it is interpreted as absolute number.

ah

character string specifying the type of the alternative hypothesis: "increasing" (variance increases from group 1 to group 2), "decreasing" (variance decreases from group 1 to group 2), "unequal" (variances are unequal between the groups). The default is to test for increasing variances.

order.by

either a vector z or a formula with a single explanatory variable like ~ z. The observations in the model are ordered by the size of z. If set to NULL (the default) the observations are assumed to be ordered.

sig.level

significance level. Default value: sig.level = 0.05.

details

logical value indicating whether specific details about the test should be returned.

hyp

logical value indicating whether the Hypotheses should be returned.

Value

A list object including:

hyp character matrix of hypotheses (if hyp = TRUE).
results a data frame of basic test results.
hreg1 matrix of regression results in Group I.
stats1 additional statistic of regression in Group I.
hreg2 matrix of regression results in Group II.
stats2 additional statistic of regression in Group II.
nulldist type of the Null distribution with its parameters.

References

Goldfeld, S.M. & Quandt, R.E. (1965): Some Tests for Homoskedasticity. Journal of the American Statistical Association 60, 539-547.

See Also

wh.test, gqtest.

Examples

## 5 observations in group 1 with the hypothesis that the variance of group 2 is larger
gq.test(rent ~ dist, split = 5, ah = "increasing", data = data.rent)

## Ordered by population size
eu.mod <- ols(expend ~ pop + gdp + farm + votes + mship, data = data.eu)
results <- gq.test(eu.mod, split = 13, order.by = data.eu$pop, details = TRUE)
results

plot(results)


desk documentation built on May 29, 2024, 6:05 a.m.

Related to gq.test in desk...