splogit(form,inst=NULL,winst=NULL,wmat=NULL,shpfile=NULL,blockid=NULL, minblock=NULL,maxblock=NULL,data=NULL,silent=FALSE,minp=NULL)
splogit provides flexibility in specifying the list of instruments. By default, the instrument list includes X and WX, where X is the original explanatory variable list and W is the spatial weight matrix. Either wmat or shpfile must be specified if inst and winst are set to their default values.
It is also possible to directly specify the full instrument list or to include only a subset of the X variables in the list that is to be pre-multiplied by W. Let list1 and list2 be user-provided lists of the form list=~z1+z2. The combinations of defaults (NULL) and lists for inst produce the following results for Z:
1. inst = NULL, winst = NULL, and either shpfile or wmat specified: Z = (X, WX)
2. inst = list1, winst = NULL, and either shpfile or wmat specified: Z = list1
3. inst = NULL, winst = list2, and either shpfile or wmat specified: Z = (X, W*list2)
4. inst = list1, winst = list2, and either shpfile or wmat specified: Z = (list1, W*list2)
5. inst = list1, winst = list2, and both shpfile and wmat NOT specified: Z = (list1, list2)
Note that when inst=list1 and winst=NULL it is up to the user to specify at least one variable in list1 that is not also included in X.
The difference between cases (4) and (5) is that the list2 variables are left unaltered in case (5) rather than being pre-multiplied by W. The case (5) option makes it possible to avoid manipulations of large matrices from within splogit. The idea is that W*list2 should be calculated prior to running splogit, with the variables implied by W*list2 being provided directly to splogit using the winst option.
set.seed(9947)
cmap <- readShapePoly(system.file("maps/CookCensusTracts.shp",
package="McSpatial"))
cmap <- cmap[cmap$CHICAGO==1&cmap$CAREA!="O'Hare",]
wmat <- makew(cmap)$wmat
n = nrow(wmat)
rho = .4
x <- runif(n,0,10)
ystar <- as.numeric(solve(diag(n) - rho*wmat)%*%(x + rnorm(n,0,2)))
y <- ystar>quantile(ystar,.4)
fit <- splogit(y~x, wmat=wmat)
Run the code above in your browser using DataLab