Stata offers the spreg package for estimation of spatial models. In most spatial model specifications, the marginal effects are not simply the beta estimates. LeSage and Pace explain this well in chapter 2 of their book Introduction to Spatial Econometrics. The spreg package does not calculate the direct, indirect, and total effects for you. The package documentation, however, does walk you through how to get those results. There are two methods, one is tedious and not very useful. The other comes from LeSage and Pace's book in chapter 2 and involves, for the direct effect, multiplying the beta estimates divided by the sample size times the trace of a matrix. Specifically, it is
(B/n)*trace(S)
where S = (I - lam*W)^-1, I is the nxn identity matrix, and W is a spatial weights adjacency matrix. Lambda is the parameter estimate from the spatial lag of the dependent variable. This formula is for the direct effect, the total effect is a similar process. These results are simply obtained in Mata after running a spatial model with spreg. Unfortunately, the spreg documentation provides no illustration or discussion of obtaining estimates of the dispersion for these effects. LeSage and Pace recommend a Bayesian Markov Chain Monte Carlo approach to provide a large number of draws for the model parameters (depends on the spatial model but in my case lam, rho, beta, theta, a, and sigma^2) and subsequently obtain an estimate of the dispersion parameter for the marginal effect.
Does anyone have any clue how to implement this in Mata? There is a user-written Mata function that can be downloaded called amcmc. This function is for adaptive Markov Chain Monte Carlo sampling from the distributions. I am attempting to see if it will work but so far no luck. Any input here is greatly appreciated. Since the spreg creators never mentioned anything about obtaining estimates of the dispersion parameters for ATI, ATDI, and indirect effects maybe it cannot be done in Mata. But if so, the above formula is of little use. Any thoughts?
(B/n)*trace(S)
where S = (I - lam*W)^-1, I is the nxn identity matrix, and W is a spatial weights adjacency matrix. Lambda is the parameter estimate from the spatial lag of the dependent variable. This formula is for the direct effect, the total effect is a similar process. These results are simply obtained in Mata after running a spatial model with spreg. Unfortunately, the spreg documentation provides no illustration or discussion of obtaining estimates of the dispersion for these effects. LeSage and Pace recommend a Bayesian Markov Chain Monte Carlo approach to provide a large number of draws for the model parameters (depends on the spatial model but in my case lam, rho, beta, theta, a, and sigma^2) and subsequently obtain an estimate of the dispersion parameter for the marginal effect.
Does anyone have any clue how to implement this in Mata? There is a user-written Mata function that can be downloaded called amcmc. This function is for adaptive Markov Chain Monte Carlo sampling from the distributions. I am attempting to see if it will work but so far no luck. Any input here is greatly appreciated. Since the spreg creators never mentioned anything about obtaining estimates of the dispersion parameters for ATI, ATDI, and indirect effects maybe it cannot be done in Mata. But if so, the above formula is of little use. Any thoughts?
Comment