R/bsjktest.formula.R

Defines functions `bsjktest.formula`

`bsjktest.formula` <-
function(x, data, index=NULL, listw, test=c("C.1","C.2","C.3","J"), ...){

  ## 
  ## transform listw if needed
  if("listw" %in% class(listw)) {
    w <- listw2mat(listw)
  } else {
    w <- listw
  }

  ## transform data if needed
  if(!("pdata.frame" %in% class(data))) {
    data <- pdata.frame(data, index)
  }

  gindex <- dimnames(data)[[2]][1]
  tindex <- dimnames(data)[[2]][2]

  switch(match.arg(test), C.1 = {

    bsjk = pbsjkSDtest(formula=x, data=data, w=w, index=index, ...)

  }, C.2 = {

    bsjk = pbsjkARtest(formula=x, data=data, w=w, index=index, ...)

  }, C.3 = {

    bsjk = pbsjkREtest(formula=x, data=data, w=w, index=index, ...)

  }, J = {

    bsjk = pbsjkJtest(formula=x, data=data, w=w, index=index, ...)

  })

  return(bsjk)

}

Try the splm package in your browser

Any scripts or data that you put into this service are public.

splm documentation built on July 26, 2023, 5:44 p.m.