8
$\begingroup$

Let's say that you were wanting to model how many times someone had to take a certain test before passing (depending on a range of predictors like practice, mock tests taken, classes attended, etc.). Let's also say that most people pass after the first attempt, but that others have to take the test several times, and that the distribution looks Poisson-ish.

If you were to model the dependent variable as the number of tests taken, your minimum count would be 1. On the other hand, if you wanted to model the dependent variable as the number of resits needed, the minimum count would be 0. Both of these seem to me to a reasonable thing to do, and the latter is just the former minus 1, i.e. is shifted.

It also seems, conceptually like this difference (tests~x1+x2+x3... vs. resits~x1+x2+x3... or tests-1~x1+x2+x3...) shouldn't really affect your ultimate conclusions: if practice decreases the number of tests, it should also decrease the number of resits, and it seems like it should do so to a similar extent.

My questions are:

  1. What is the practical effect on the model parameters of using (a) shifted dependent variable (resits) rather than (b) the unshifted one (tests)? For instance, would you generally expect the parameter to be overestimated if using resits, or underestimated? If either, would you generally expect the difference to be substantial or minor? Or would this all depend so much on the particular data set that there's no way to tell? That is, is the conceptual similarity between tests and resits misleading, in as far as it makes me think I should get similar results for both.

  2. What is the practical effect on the model parameters of using:
    (a) a zero-truncated model - e.g., in R, I'd specify:
    vglm(tests~x, data, family=pospoisson()) and
    (b) a left-shifted model - e.g. in R, glm(resits~x, family=poisson)?

There is a discussion of shifting vs. truncation here but this discussion doesn't specifically address things like the model parameters and significance. It also focuses on right-shifting rather than left-shifting.

I have tried the various options above on my data and it turned out that the basic Poisson (y~x, fam=poisson) had a lower estimate for the predictor than the zero-truncated (y~x, fam=pospoisson), which in turn had a lower estimate than the left-shifted model (y-1~x, fam=poisson). Bootstrapped confidence intervals suggest that these differences are not significant, though. However, doing this hasn't told me whether I can expect this to hold generally, i.e., whether the conceptual similarity between tests and resits should typically translate into similar models. In my case, left-shifting resulted in a higher parameter than the zero-truncation model, but is that generally the case? In my case, the parameters weren't significantly different, but is that generally the case? I realize that someone might be able to derive an answer to all this from first principals, mathematically, but I don't have the mathematical background to do so.

I'm asking this as a prelude to another question, here. For reasons that I'll explain in that post, I have to left-shift my response variable and I'm wanting to know whether this is in principle problematic (in which case I've just been lucky that the model parameters are quite similar).

*Edit: My data is not in the form of test-counts vs resit-counts. I'm just using these as illustrations because the conceptual similarity between tests and resits is fairly obvious. So my question is not about what regression someone should use for such variables, but is rather about what the effect of shifting vs truncating is on model parameters - would you expect a trivial difference, a significant difference, or there's no way to tell without data? Since people suggested negative binomials below, though, I'm happy to accept answers to this question concerning either Poisson or negative binomial models.

$\endgroup$
1
  • $\begingroup$ My first thought with data that's essentially "number of failures to first success" would be to use the negative binomial (if probabilities of success were constant and trials independent it would be geometric but the heterogeneity might be adequately modelled as negative binomial) $\endgroup$
    – Glen_b
    Commented Aug 13, 2016 at 6:12

2 Answers 2

6
$\begingroup$

Although you are modeling counts, your data cannot be Poisson. The easy way to see this is because it cannot be $0$, which is a possible value for the Poisson distribution. But this isn't really a shifted or truncated Poisson, either. Nor could the number of resits be Poisson. What you are calling "the number of resits" could equally well be called "the number of failures until $r$ successes". That is the definition of a negative binomial. In your case, $r=1$.

In short, I would model "the number of resits" using a regression model with a negative binomial distribution. Typically with a regression model, the predicted values should be the expected value at each point in the covariate space. Note that the expected value of a negative binomial is:
$$ E[Y] = \frac{(1-p)r}{p} $$ where $p$ is the probability of success. Since $r=1$ for you, the predicted values are the odds of failing a test. You could convert that to the probability of passing a test via $1-(\hat y / (1+\hat y))$.

It's actually a little more complicated than that in practice, unfortunately. First, as you probably know, models that use something other than the normal distribution for the response (e.g., the negative binomial), need to use a link function. So to get to what I'm calling $\hat y$, you will need to exponentiate the values computed from the model equation.

Next, 'using a negative binomial distribution' sounds like you need negative binomial regression. Actually, that is a slightly different animal from what we have here. Negative binomial regression estimates not only the regression coefficients but also a dispersion parameter. We know the appropriate parameter value for your case a-priori. What you need is called the geometric model.

Note also that there are different ways of specifying and parameterizing these things, so you need to read the documentation very carefully. I can walk through a simple example using R. Let's compare people who did not take a prep class, x = 0, to those who did, x = 1. We will imagine that those who didn't take a prep class have only a 30% chance of passing, but those who did have a 70% chance.

library(MASS)   # you need this library for the negative.binomial() function below
set.seed(1082)  # this makes the example exactly reproducible
y = c(rnbinom(1000, size=1, prob=.3),   # number of resits for those who didn't 
      rnbinom(1000, size=1, prob=.7) )  #   or did take prep class
x = rep(c(0,1), each=1000)              # prep class indicator
m = glm(y~x, family=negative.binomial(theta=1))
summary(m)
# Call:
# glm(formula = y ~ x, family = negative.binomial(theta = 1))
# 
# Deviance Residuals: 
#     Min       1Q   Median       3Q      Max  
# -1.5805  -0.8358  -0.6336   0.4447   3.3044  
# 
# Coefficients:
#             Estimate Std. Error t value Pr(>|t|)    
# (Intercept)  0.91108    0.03883   23.46   <2e-16 ***
# x           -1.78335    0.07180  -24.84   <2e-16 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# 
# (Dispersion parameter for Negative Binomial(1) family taken to be 1.075368)
# 
#     Null deviance: 2646  on 1999  degrees of freedom
# Residual deviance: 1913  on 1998  degrees of freedom
# AIC: 5902.8
# 
# Number of Fisher Scoring iterations: 4
cm = c(coef(m)[1], sum(coef(m)) )
1 - ( exp(cm)/(1 + exp(cm)) )  # the model's estimated probabilities of passing the test
# (Intercept)             
#   0.2867795   0.7052186 
$\endgroup$
2
  • $\begingroup$ Thanks for taking the time to give such a detailed answer. My data isn't actually about tests vs resits - I just chose these as illustrations since I particularly wanted to know about the effect of shifting, and since these variables are both conceptually very similar and easy to explain without having to make this long question even longer. My data (which I explain in a little more detail in the link provided in the last paragraph) involves how many people respond with a given word when given a certain cue, and I'm struggling to conceptualize that in terms of failures to 1 success. $\endgroup$
    – Justin
    Commented Aug 13, 2016 at 0:49
  • $\begingroup$ @Justin, my guess from your description there is that you want to do I binomial-style logistic regression of how many of the other people chose the same word. $\endgroup$ Commented Aug 13, 2016 at 1:55
2
$\begingroup$

You have to use the distribution that explains the phenomenon. Sometime a simple rewording can do the trick of thinking outside the box. For instance, instead of framing the question as "how many attempts to pass?" you frame it as "How many re-takes?".

You see, in your case it's impossible to have an observations of a "number of attempts" variable less that 1. Hence, Poisson is simply not a good fit at all. However, if you frame the question the way I did, you observations of "number of retakes" variable include 0, and Poisson could be reasonable distribution to consider.

You're not truncating anything or shifting, you are answering a different question about a different variable, namely, a "number of re-takes" not attempts like in the original question.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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