qdmean | R Documentation |
Quasi-demean a variable, based on estimate of theta
qdmean(model, predictor, group, data, dv)
model |
an estimated random effects model |
predictor |
the predictor variable to quasi-demean |
group |
the grouping variable to use to quasi-demean |
data |
if a lmer model, the dataset used to estimate the model |
dv |
if a lmer model, the dependent variable (as a string in quotes) |
if using a lmer
model, pass the data with no NA
observations
the quasi-demeaned independent variable
Soren Jordan and Andrew Q. Philips
## Not run:
# using plm
model.plm <- plm(ln_wage ~ wks_work + union, index = c("idcode", "year"),
data = nlswork,
model = "random", random.method = "swar", effect = "individual")
# quasi-demean wks_work
wkswork.plm <- qdmean(model = model.plm, predictor = "wks_work", group = "idcode")
summary(wkswork.plm)
# using lmer
model.lmer <- lmer(ln_wage ~ wks_work + union + (1 | idcode),
data = data)
# quasi-demean wks_work
wkswork.lmer <- qdmean(model = model.lmer, predictor = "wks_work", group = "idcode",
data = nlswork, dv = "ln_wage")
summary(wkswork.lmer)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.