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 > model2.vcov NULL How can I obtain covariance matrix for GMerrorsar? Chelsea [[alternative HTML version deleted]] _______________________________________________ RsigGeo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/rsiggeo 
Administrator

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? > 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 RForge, 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]] > > _______________________________________________ > RsigGeo mailing list > [hidden email] > https://stat.ethz.ch/mailman/listinfo/rsiggeo >  Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N5045 Bergen, Norway. voice: +47 55 95 93 55; email: [hidden email] EditorinChief of The R Journal, https://journal.rproject.org/index.html http://orcid.org/0000000323926140 https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en _______________________________________________ RsigGeo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/rsiggeo
Roger Bivand
Department of Economics Norwegian School of Economics Helleveien 30 N5045 Bergen, Norway 
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 <[hidden email]> 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 RForge, 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]] >> >> _______________________________________________ >> RsigGeo mailing list >> [hidden email] >> https://stat.ethz.ch/mailman/listinfo/rsiggeo >> >> >  > Roger Bivand > Department of Economics, Norwegian School of Economics, > Helleveien 30, N5045 Bergen, Norway. > voice: +47 55 95 93 55; email: [hidden email] > EditorinChief of The R Journal, https://journal.rproject.org/index.html > http://orcid.org/0000000323926140 > https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en > [[alternative HTML version deleted]] _______________________________________________ RsigGeo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/rsiggeo 
Is this the link to the package?
https://rforge.rproject.org/R/?group_id=182 Chelsea On Tue, Apr 11, 2017 at 10:59 PM, Qiuhua Ma <[hidden email]> 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 <[hidden email]> 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 RForge, 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]] >>> >>> _______________________________________________ >>> RsigGeo mailing list >>> [hidden email] >>> https://stat.ethz.ch/mailman/listinfo/rsiggeo >>> >>> >>  >> Roger Bivand >> Department of Economics, Norwegian School of Economics, >> Helleveien 30, N5045 Bergen, Norway. >> voice: +47 55 95 93 55; email: [hidden email] >> EditorinChief of The R Journal, https://journal.rproject.org/ >> index.html >> http://orcid.org/0000000323926140 >> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en >> > > [[alternative HTML version deleted]] _______________________________________________ RsigGeo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/rsiggeo 
Administrator

On Wed, 12 Apr 2017, Qiuhua Ma wrote:
> Is this the link to the package? > > https://rforge.rproject.org/R/?group_id=182 Yes, and: install.packages("spdep", repos="http://RForge.Rproject.org") should work. But do try sphet::spreg() too, it is more flexible than the older spdep GM functions. Roger > > Chelsea > > On Tue, Apr 11, 2017 at 10:59 PM, Qiuhua Ma <[hidden email]> 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 <[hidden email]> 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 RForge, 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]] >>>> >>>> _______________________________________________ >>>> RsigGeo mailing list >>>> [hidden email] >>>> https://stat.ethz.ch/mailman/listinfo/rsiggeo >>>> >>>> >>>  >>> Roger Bivand >>> Department of Economics, Norwegian School of Economics, >>> Helleveien 30, N5045 Bergen, Norway. >>> voice: +47 55 95 93 55; email: [hidden email] >>> EditorinChief of The R Journal, https://journal.rproject.org/ >>> index.html >>> http://orcid.org/0000000323926140 >>> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en >>> >> >> >  Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N5045 Bergen, Norway. voice: +47 55 95 93 55; email: [hidden email] EditorinChief of The R Journal, https://journal.rproject.org/index.html http://orcid.org/0000000323926140 https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en _______________________________________________ RsigGeo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/rsiggeo
Roger Bivand
Department of Economics Norwegian School of Economics Helleveien 30 N5045 Bergen, Norway 
Free forum by Nabble  Edit this page 