R: Likelihood ratio test

LR.Sarlm {spatialreg} | R Documentation

## Likelihood ratio test

### Description

The `LR.Sarlm()` function provides a likelihood ratio test for objects for which a `logLik()` function exists for their class, or for objects of class `logLik`. `LR1.Sarlm()` and `Wald1.Sarlm()` are used internally in `summary.Sarlm()`, but may be accessed directly; they report the values respectively of LR and Wald tests for the absence of spatial dependence in spatial lag or error models. The spatial Hausman test is available for models fitted with `errorSarlm` and `GMerrorsar`.

### Usage

    LR.Sarlm(x, y)
    ## S3 method for class 'Sarlm'
    logLik(object, ...)
    LR1.Sarlm(object)
    Wald1.Sarlm(object)
    ## S3 method for class 'Sarlm'
    Hausman.test(object, ..., tol=NULL)
    ## S3 method for class 'Sarlm'
    anova(object, ...)
    bptest.Sarlm(object, varformula=NULL, studentize = TRUE, data=list())
    ## S3 method for class 'Sarlm'
    impacts(obj, ..., tr, R = NULL, listw = NULL, evalues=NULL,
     useHESS = NULL, tol = 1e-06, empirical = FALSE, Q=NULL)

### Arguments

`x` | a `logLik` object or an object for which a `logLik()` function exists
`y` | a `logLik` object or an object for which a `logLik()` function exists
`object, obj` | a `Sarlm` object
`...` | further arguments passed to or from other methods

`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
`studentize` | logical. If set to `TRUE` Koenker's studentized version of the test statistic will be used.
`data` | an optional data frame containing the variables in the varformula
`tr` | A vector of traces of powers of the spatial weights matrix created using `trW`, for approximate impact measures; if not given, `listw` must be given for exact measures (for small to moderate spatial weights matrices); the traces must be for the same spatial weights as were used in fitting the spatial regression, and must be row-standardised
`listw` | If `tr` is not given, a spatial weights object as created by `nb2listw`; they must be the same spatial weights as were used in fitting the spatial regression, but do not have to be row-standardised
`evalues` | vector of eigenvalues of spatial weights matrix for impacts calculations
`R` | If given, simulations are used to compute distributions for the impact measures, returned as `mcmc` objects; the objects are used for convenience but are not output by an MCMC process
`useHESS` | Use the Hessian approximation (if available) even if the asymptotic coefficient covariance matrix is available; used for comparing methods
`tol` | Argument passed to `mvrnorm` and `solve`: tolerance (relative to largest variance) for numerical lack of positive-definiteness in the coefficient covariance matrix
`empirical` | Argument passed to `mvrnorm` (default FALSE): if true, the coefficients and their covariance matrix specify the empirical not population mean and covariance matrix
`Q` | default NULL, else an integer number of cumulative power series impacts to calculate if `tr` is given

### Value

The tests return objects of class `htest` with:

`statistic` | value of statistic
`parameter` | degrees of freedom
`p.value` | Probability value
`estimate` | varies with test
`method` | description of test method

`logLik.Sarlm()` returns an object of class `logLik` `LR1.Sarlm`, `Hausman.Sarlm` and `Wald1.Sarlm` returm objects of class `htest`

### Note

The numbers of degrees of freedom returned by `logLik.Sarlm()` include nuisance parameters, that is the number of regression coefficients, plus sigma, plus spatial parameter esitmate(s).

### Author(s)

Roger Bivand Roger.Bivand@nhh.no, `bptest`: Torsten Hothorn and Achim Zeileis, modified by Roger Bivand

### References

LeSage J and RK Pace (2009) Introduction to Spatial Econometrics. CRC Press, Boca Raton, pp. 61–63; Pace RK and LeSage J (2008) A spatial Hausman test. Economics Letters 101, 282–284. T.S. Breusch & A.R. Pagan (1979), A Simple Test for Heteroscedasticity and Random Coefficient Variation. Econometrica 47, 1287–1294

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

L. Anselin (1988) Spatial econometrics: methods and models. Dordrecht: Kluwer, pp. 121–122.

### See Also

`logLik.lm`, `anova.Sarlm`

### Examples

    require("sf", quietly=TRUE)
    columbus <- st_read(system.file("shapes/columbus.shp", package="spData")[1], quiet=TRUE)
    #require("spdep", quietly=TRUE)
    col.gal.nb <- spdep::read.gal(system.file("weights/columbus.gal", package="spData")[1])
    lm.mod <- lm(CRIME ~ HOVAL + INC, data=columbus)
    lag <- lagsarlm(CRIME ~ HOVAL + INC, data=columbus, spdep::nb2listw(col.gal.nb))
    mixed <- lagsarlm(CRIME ~ HOVAL + INC, data=columbus, spdep::nb2listw(col.gal.nb), type="mixed")
    error <- errorsarlm(CRIME ~ HOVAL + INC, data=columbus, spdep::nb2listw(col.gal.nb))
    Hausman.test(error)
    LR.Sarlm(mixed, error)
    anova(lag, lm.mod)
    anova(lag, error, mixed)
    AIC(lag, error, mixed)
    bptest.Sarlm(error)
    bptest.Sarlm(error, studentize=FALSE)
    ## Not run:
    lm.target <- lm(error$tary ~ error$tarX - 1)
    if (require(lmtest, quietly=TRUE) && require(sandwich, quietly=TRUE)) {
      print(coeftest(lm.target, vcov=vcovHC(lm.target, type="HC0"), df=Inf))
    }

    ## End(Not run)

[Package spatialreg version 1.2-1 Index]