[R] clustered standarderrors using design package

Frank E Harrell Jr f.harrell at vanderbilt.edu
Sun May 20 01:54:07 CEST 2007


Anders Eklund wrote:
> Please help,
> 
> I have a strange problem. I've got a balanced panel data set. I use dummy
> variable regression and I've got results with lm function.
> 
> summary(lm(y ~ post + t19961 + t19962 + t19963 + t19964 + t19971 + t19972
> + t19973 + t19974 + t19981+factor( id)))
> 
> 
> The problem is that I would like to get my standard errors clustered but
> then gets the following error message:
> 
> f<-(lm(y ~ post + t19961 + t19962 + t19963 + t19964 + t19971 + t19972 +
> t19973 + t19974 + t19981+factor( id)))

Omit id from the model (usually) and do
library(Design)

f <- ols(y ~ post + . . . , x=TRUE,  y=TRUE)
g.clust1 <- robcov(f, id)

Frank

> library(Design)
> g.clust1 <- robcov(f, id)
> Error in match.arg(type) : 'arg' should be one of working, response,
> deviance, pearson, partial
> 
> All my variables is vectors and I've tried with other variables inside and
> outside the model and all results in the same errormessage.
> 
> Best regards
> 
> Anders Eklund
> Stockholm, Sweden.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> 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.
> 


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list