[R-sig-Geo] variance-covariance matrix for GMerrorsar

Qiuhua Ma qiuhuanihao at gmail.com
Wed Apr 12 07:26:28 CEST 2017


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:

> 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:
>
>> On Tue, 11 Apr 2017, Qiuhua Ma wrote:
>>
>> 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))
>>>
>>
>> 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.
>>
>>
>>>
>>> when I apply the same code for GMerrorsar:
>>>
>>>
>>> model2.beta <- coef(model2)
>>>
>>> model2.vcov <- summary(model2)$var
>>>
>>>
>>> model2.vcov
>>>>
>>>
>>> NULL
>>>
>>>
>>> How can I obtain covariance matrix for GMerrorsar?
>>>
>>> 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
>>
>>
>>
>>> Chelsea
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>>
>> --
>> Roger Bivand
>> Department of Economics, Norwegian School of Economics,
>> Helleveien 30, N-5045 Bergen, Norway.
>> voice: +47 55 95 93 55; e-mail: Roger.Bivand at nhh.no
>> Editor-in-Chief of The R Journal, https://journal.r-project.org/
>> index.html
>> http://orcid.org/0000-0003-2392-6140
>> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>>
>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list