SD.RStests function

Rao's score and adjusted Rao's score tests of linear hypotheses for spatial Durbin and spatial Durbin error models

Rao's score and adjusted Rao's score tests of linear hypotheses for spatial Durbin and spatial Durbin error models

Rao's score and adjusted Rao's score tests of linear hypotheses applied to a fitted linear model to examine whether either the spatially lagged dependent variable lag or the spatially lagged independent variable(s) WX should be included in the model, or both (SDM). Adjusted tests are provided for lag and WX adapting to the presence of the other, and a joint test for both. The joint test is equal to the unadjusted of one plus the adjusted of the other. In addition, draft tests are added from Koley (2024, section 6) for spatial Durbin error models to examine whether either the spatially lagged error err or the spatially lagged independent variable(s) WX should be included in the model, or both (SDEM); because of orthogonality, no adjusted tests are required.

SD.RStests(model, listw, zero.policy = attr(listw, "zero.policy"), test = "SDM", Durbin = TRUE)

Arguments

  • model: an object of class lm returned by lm
  • listw: a listw object created for example by nb2listw, expected to be row-standardised (W-style)
  • zero.policy: default attr(listw, "zero.policy") as set when listw was created, if attribute not set, use global option value; if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA
  • test: test=SDM computes the SDM tests, a character vector of tests requested chosen from SDM_RSlag, SDM_adjRSlag, SDM_RSWX, SDM_adjRSWX, SDM_Joint, test=SDEM computes the SDEM tests, a character vector of tests requested chosen from SDEM_RSerr, SDEM_RSWX, SDEM_Joint; test=all computes all the tests
  • Durbin: default TRUE for Durbin models including WX; if TRUE, full spatial Durbin model; if a formula object, the subset of explanatory variables to lag

Returns

A list of class LMtestlist of htest objects, each with: - statistic: the value of the Lagrange Multiplier test.

  • parameter: number of degrees of freedom

  • p.value: the p-value of the test.

  • method: a character string giving the method used.

  • data.name: a character string giving the name(s) of the data.

References

Malabika Koley and Anil K. Bera (2024) To use, or not to use the spatial Durbin model? – that is the question, Spatial Economic Analysis, 19:1, 30-56, tools:::Rd_expr_doi("10.1080/17421772.2023.2256810") ; Malabika Koley (2024) Specification Testing under General Nesting Spatial Model (Appendix C), https://sites.google.com/view/malabikakoley/research.

Author(s)

Roger Bivand Roger.Bivand@nhh.no , Malabika Koley and Anil K. Bera

Note

The results in the example below agree with those in Table 3, p. 22 in Koley and Bera (2024).

See Also

lm, lm.RStests

Examples

columbus <- sf::st_read(system.file("shapes/columbus.gpkg", package="spData")[1]) col.gal.nb <- read.gal(system.file("weights/columbus.gal", package="spData")[1]) col.listw <- nb2listw(col.gal.nb, style="W") lm_obj <- lm(CRIME ~ INC + HOVAL, data=columbus) summary(lm.RStests(lm_obj, col.listw, test="all")) res <- SD.RStests(lm_obj, col.listw, test="SDM") summary(res) all.equal(unname(res$SDM_Joint$statistic), unname(res$SDM_RSlag$statistic + res$SDM_adjRSWX$statistic)) all.equal(unname(res$SDM_Joint$statistic), unname(res$SDM_adjRSlag$statistic + res$SDM_RSWX$statistic)) res <- SD.RStests(lm_obj, col.listw, test="SDEM") summary(res) all.equal(unname(res$SDEM_Joint$statistic), unname(res$SDEM_RSerr$statistic + res$SDEM_RSWX$statistic)) summary(SD.RStests(lm_obj, nb2listw(col.gal.nb, style="C"), test="all")) summary(SD.RStests(lm_obj, col.listw, test="all", Durbin= ~ INC)) lm_obj0 <- lm(I(scale(CRIME)) ~ 0 + I(scale(INC)) + I(scale(HOVAL)), data=columbus) summary(SD.RStests(lm_obj0, col.listw, test="all")) columbusNA <- columbus columbusNA$HOVAL[15] <- NA lm_objNA <- lm(CRIME ~ INC + HOVAL, data=columbusNA) summary(SD.RStests(lm_objNA, col.listw, test="all"))