Skip to content

variance-covariance matrix for GMerrorsar

5 messages · Qiuhua Ma, Roger Bivand

#
Dear list,

I want to use bootstrapping to derive confidence intervals for marginal
wtp after GMerrorsar command.

It works for stsls since covariance matrix is directly available. However,
I cannot find covariance matrix for GMerrorsar.

For example, the following code works for stsls:

model1.beta <- coef(model1)

model1.vcov <- summary(model1)$var

model1.sim <- rmultnorm(10000, mu = model1.beta, vmat = model1.vcov)

model1.mwtp <- model1.sim * Pbar

model1.ci <- apply(model1.mwtp, 2, quantile, c(0.025, 0.975))


when I apply the same code for GMerrorsar:


model2.beta <- coef(model2)

model2.vcov <- summary(model2)$var
NULL


How can I obtain covariance matrix for GMerrorsar?


Chelsea
#
On Tue, 11 Apr 2017, Qiuhua Ma wrote:

            
The DGP for this model is (I - \rho W)^{-1} (X \beta + e), so I'm in geat 
doubt about whether your proposal is correct (model1.vcov is has one more 
row and column than X has columns, so including \rho); the first element 
of model1.beta is \rho.
Reading the code, you'll see where the matrices occur. Running under 
debug, you can assign the outside the environment of the function if you 
like (use <<- ). I've added a vcov component in the returned object 
(source on R-Forge, I can send a source package or a Windows binary 
package).

You should also look at sphet::spreg, which does return a var component. 
Please note that you should think of the DGP first and foremost, the coef 
and var may return the values for what you are treating as nuisance parts 
of the model. Getting the distribution of the willingess to pay also 
probably involves them and their variability.

Have you considered getting the WTP marginal from a Bayesian approach?

Hope this helps,

Roger

  
    
#
Thanks for your quick reply. You are right. Marginal wtp should take into
account rho for spatial lag model.

I still would like to use GMerrorsar. Can you please send me the source
package?

Best,

Chelsea
On Tue, Apr 11, 2017 at 7:54 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:

            

  
  
#
Is this the link to the package?

https://r-forge.r-project.org/R/?group_id=182

Chelsea
On Tue, Apr 11, 2017 at 10:59 PM, Qiuhua Ma <qiuhuanihao at gmail.com> wrote:

            

  
  
#
On Wed, 12 Apr 2017, Qiuhua Ma wrote:

            
Yes, and:

install.packages("spdep", repos="http://R-Forge.R-project.org")

should work. But do try sphet::spreg() too, it is more flexible than the 
older spdep GM functions.

Roger