[R] Does "coeftest" correctly use weights from "svydesign" in "svyglm" object?

Anthony Damico ajdamico at gmail.com
Thu Feb 9 08:36:59 CET 2017


hi, that setup is not correct.  see examples in

https://github.com/ajdamico/asdfree/tree/master/European%20Social%20Survey

On Feb 8, 2017 11:54 PM, "André Grow" <grow.andre at gmail.com> wrote:

> Dear all,
>
>
>
> I am using data from the European Social Survey (ESS) and I would like to
> calculate country-level cluster-robust standard errors for a regression
> model in R that includes country fixed effects and employs the design
> weights that come with the ESS.
>
>
>
> To correctly use the weights, I use the 'survey' package and the functions
> 'svydesign' and 'svyglm'. This step looks like this:
>
>
>
> design_1 <- svydesign(id=~1, weights=~dweight, data=ESS)
>
>
>
> m1 <- svyglm(y ~ cntry + x, design = design_1)
>
>
>
> My question is: when I now apply the functions 'cluster.vcov' and
> 'coeftest'
> from the packages 'lmtest' and 'multiwayvcov' to the model m1, do the
> resulting standard errors correctly account for the design weights? This
> step looks like this:
>
>
>
> vcov_m1 <- cluster.vcov(m1, ESS$cntry)
>
>
>
> coeftest(m1, vcov_m1)
>
>
>
> Note that I do not use 'cntry' as an id variable in the svydesign function,
> because then I cannot include country dummies in the regression model.
>
>
>
> Thanks in advance for your feedback!
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list