2
$\begingroup$

I'm doing a project involving outcomes measured for people clustered within departments. The departments had previously been randomized to a treatment or control condition.

One of the main outcomes is the proportion of women within each department (technically the proportion of new hires that are women). So, I'm interested in the relative proportion of women in treatment and control departments.

My initial impression as to how to analyze these data was to simply calculate the proportion of women within each department, then fit a plain old linear model with condition as a predictor variable. However, on further thought it seems like this might be an appropriate situation in which to use a GLMEM (Generalized Linear Mixed Effects Model) in which condition predicts gender, with random intercepts for department.

What are the implications of fitting a linear model on proportions calculated within departments vs fitting a full GLMEM?

Here is some very simple R code showing these two approaches:

set.seed(1343)

d <- data.frame(id = 1:2000, dept_id = rep(1:100, 20))
d$condition <- ifelse(d$dept_id %in% 1:50, "control", "experimental")
d$gender <- sample(rep(c(1, 0), 1000))

mod1 <- glmer(gender ~ condition + (1|dept_id), family = binomial, data = d)
summary(mod1)

dept_stats <- ddply(d, "dept_id", summarize, 
                    condition = unique(condition),
                    prop_m = sum(gender == 1)/length(gender))

mod2 <- lm(prop_m ~ condition, data = dept_stats)
summary(mod2)
$\endgroup$
2
$\begingroup$
  1. A linear model should be less powerful, since you are throwing data away (e.g., 4 values 0, 1, 0, 1 becomes one value: .5).
  2. Without weighting your proportions by the number of new hires (I don't see that in your code), the model will be inefficient and can be biased if the number of new hires correlates with the condition.
  3. A linear model constitutes the wrong way to think about your data. For example, your predictions could ultimately fall outside the possible bounds of 0% and 100%.
$\endgroup$
  • $\begingroup$ (2) refers to the fact that the LM would need to include a predictor called, for example, num_hires and not to the fact that weighting by number of hires is necessary in the GLMEM, correct? $\endgroup$ – Patrick S. Forscher Nov 23 '15 at 19:50
  • $\begingroup$ Also, is it true that predictions can fall outside [0,1] in an LM on proportions even if the data are proportions and not a series of 0s and 1s? I am aware of the predictions problem in the context of an LM on a dichotomous outcome, but not in the context of an LM on proportions. $\endgroup$ – Patrick S. Forscher Nov 23 '15 at 19:51
  • $\begingroup$ I would not use num_hires as a covariate. I would weight your observations with num_hires (or at least, I would do that if I were going to use lm for some strange reason). Also, I don't mean that the y-hats in your dataset will be outside the acceptable range, but that it is possible for them to be b/c the model is incorrect. You have a binary treatment indicator--that provides some protection against seeing this in your dataset, but if you had continuous variables (or a continuous covariate) you could have predicted values outside the bounds. $\endgroup$ – gung - Reinstate Monica Nov 23 '15 at 20:00
  • $\begingroup$ I see. Assuming that I use glmer instead of lm, is it true that it is unnecessary to use the weights argument in glmer to weight by num_hires? $\endgroup$ – Patrick S. Forscher Nov 23 '15 at 20:04
  • 1
    $\begingroup$ If you enter a vector of 1's & 0's (each hire is male or female), or if you enter a matrix cbind(num_males, num_females) for each department, as your LHS, you do not need to use the weights argument. (I'd have to check the documentation, but it may not work the same as weights in lm--at least it doesn't in glm.) $\endgroup$ – gung - Reinstate Monica Nov 23 '15 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.