## No clustering:
x <- sin(1:100)
y <- 1:100
fm <- lm(y ~ x + I(x^2))
dfadjustSE(fm)
## Clustering, with 5 clusters
clustervar <- as.factor(c(rep(1, 40), rep(5, 20),
rep(2, 20), rep(3, 10), rep(4, 10)))
dfadjustSE(fm, clustervar)
## Only compute standard errors for the second coefficient
dfadjustSE(fm, clustervar, ell=2)
## Compute standard error for the sum of second and third coefficient
dfadjustSE(fm, clustervar, ell=c(0, 1, 1))
Run the code above in your browser using DataLab