File: bptest.sarlm.Rd

package info (click to toggle)
r-cran-spdep 0.8-1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,876 kB
  • sloc: ansic: 1,489; sh: 16; makefile: 2
file content (65 lines) | stat: -rw-r--r-- 3,147 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
% Copyright 2004-2012 by Roger S. Bivand
\encoding{UTF-8}
\name{bptest.sarlm}
\alias{bptest.sarlm}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Breusch-Pagan test for spatial models}
\description{
  Performs the Breusch-Pagan test for heteroskedasticity on the least squares fit of the spatial models taking the spatial coefficients rho or lambda into account. This function is a copy of the \code{bptest} function in package "lmtest", modified to use objects returned by spatial simultaneous autoregressive models.
}
\usage{
bptest.sarlm(object, varformula=NULL, studentize = TRUE, data=list())
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{object}{An object of class \code{"sarlm"} from \code{errorsarlm()} or \code{lagsarlm()}.}
  \item{varformula}{a formula describing only the potential explanatory variables for the variance (no dependent variable needed). By default the same explanatory variables are taken as in the main regression model}
  \item{studentize}{logical. If set to \code{TRUE} Koenker's studentized
   version of the test statistic will be used.}
  \item{data}{an optional data frame containing the variables in the varformula}
}
\details{
   Asymptotically this corresponds to the test given by Anselin (1988), but is not exactly the same. The studentized version is more conservative and perhaps to be prefered. The residuals, and for spatial error models the RHS variables, are adjusted for the spatial coefficient, as suggested bt Luc Anselin (personal communication).

It is also technically possible to make heteroskedasticity corrections to standard error estimates by using the \dQuote{lm.target} component of \code{sarlm} objects - using functions in the lmtest and sandwich packages.
}

\value{
 A list with class \code{"htest"} containing the following components:
  \item{statistic}{the value of the test statistic.}
  \item{p.value}{the p-value of the test.}
  \item{parameter}{degrees of freedom (wrongly reported if varformula given before 0.5-44.}
  \item{method}{a character string indicating what type of test was
    performed.}
}
\references{T.S. Breusch & A.R. Pagan (1979),
A Simple Test for Heteroscedasticity and Random Coefficient Variation.
\emph{Econometrica} \bold{47}, 1287--1294

W. Krämer & H. Sonnberger (1986),
\emph{The Linear Regression Model under Test}. Heidelberg: Physica.

L. Anselin (1988) \emph{Spatial econometrics: methods and models.}
Dordrecht: Kluwer, pp. 121--122.
}
\author{Torsten Hothorn \email{Torsten.Hothorn@rzmail.uni-erlangen.de} and
 Achim Zeileis \email{zeileis@ci.tuwien.ac.at}, modified by Roger Bivand \email{Roger.Bivand@nhh.no}}

\seealso{\code{\link{errorsarlm}}, \code{\link{lagsarlm}}}
\examples{
if (require(rgdal, quietly=TRUE)) {
example(columbus)
error.col <- errorsarlm(CRIME ~ HOVAL + INC, data=columbus,
 nb2listw(col.gal.nb))
bptest.sarlm(error.col)
bptest.sarlm(error.col, studentize=FALSE)
\dontrun{
lm.target <- lm(error.col$tary ~ error.col$tarX - 1)
if (require(lmtest) && require(sandwich)) {
  coeftest(lm.target, vcov=vcovHC(lm.target, type="HC0"), df=Inf)
}
}
}
}
\keyword{spatial}