# What is the appropriate way to test for a shift in probability using multiple logistic regression?

We have data on the day in which a butterfly pupates (forms a cocoon) in the summer/fall of 2 different pairs of years (2005-2006 vs 2009-2010). At the time that the pupa forms it can either be in diapause (suspended animation) or not.

Individual butterfly caterpillars were randomly selected from a wild population and observed in outdoor enclosures until they pupated. At this time the pupa was determined to be either in diapause or not.

We would like to know if there is a shift in the probability that a butterfly pupa will be in diapause or not on a given day between years. In other words, does a butterfly pupa have a significantly different probability of being in diapause later (or earlier) in 2005 vs 2006?

We have analyzed each pair of years using separate multiple logistic regressions with Day of pupation and Year as factors and are interpreting a significant Year effect as a significant shift in diapause probability on a given day between years.

Is this the appropriate way to approach this problem?

Thank you.

Data Format:

Individual   Diapause Pupation_Day Year
1            1          200        2005
2            0          201        2005
.            .           .          .
.            .           .          .
.            .           .          .
n            1          300        2006

• It's not possible to apply logistic regression correctly to these data because the dependent variable is not binary (and, when it is forced to look binary, it induces strong dependencies among the records.) See the comments at stats.stackexchange.com/questions/9797/… . – whuber Apr 21 '11 at 18:53
• Do you mean that essentially you have two data points: the day of pupation in 2005 and the day of pupation in 2006? Not much statistics can be done on two values. Or is there something more hidden in the ...? – Aniko Apr 21 '11 at 19:42
• @whuber thank you for your suggestion. In my attempt to simplify the biology of the question I think I misrepresented the system. I have edited the question to reflect the change. In reality we are looking at whether a pupa that forms on a given day is or is not in diapause. This seems to resolve the non-binary problem you mention and since all of the butterflies have pupated by the end of the experiment then there would not be the right censored problem. thanks again – DQdlM Apr 21 '11 at 19:49
• @Aniko, I have edited the question to hopefully make the system clearer. In each year we have observations for ~50 individuals: the day of pupation and whether the pupa is in diapause. Thanks. – DQdlM Apr 21 '11 at 19:53
• I don't see any individuals in your data. Does one animal keeps moving from being in diapause to not and back? – Aniko Apr 21 '11 at 19:57

Your initial logistic regression approach seems reasonable, assuming good diagnostics. However, if I understand the scientific question right, you'll need an interaction between year and day to see differences between years in the tendency to be in diapause as day increases. The main effect of year only says that one year has a higher per day probability of being in diapause, which is not, I think, what you care about.

Alternatively

The other way to think about the problem is to have days as a dependent variable. This means you would reverse the conditional probability formulation that you implicitly started with by not asking 'are later pupae more likely to be in diapause?' i.e. P(diapause | day, year), but rather 'do pupae in dipause tend to occur later in the year' i.e. P(day | diapause, year).

In such a model the observations are Pupation_Day which is classified by Diapause status which is nested within Year. The effect of interest is a difference of differences, specifically: the difference between the difference in mean Pupation_Day for Diapause==1 and Diapause==0 in Year==2005 versus Year=2006. (I'm not still sure what role the 'pairs of years' play in your design though.)

The only potentially tricky bits I see are remembering that Diapause is a random effect, and making a sensible assumption about the conditional distribution of Pupation_Day. Frankly, I'd try Normal with shared variance first and then see if the model diagnostics object. If they do, I'd crack open JAGS/BUGS, and just write out the full model, which would make inference about difference in differences easier too.

This alternative approach may be too much machinery for the scientific question though. If we could tell what the ideal inferential endpoint was it would be easier to recommend an approach.

• Thank you for your sugestions. I am not sure exactly what you mean by "ideal inferential endpoint" so I an not sure how to clarify further. The 'pairs of years' is basically because there is a large gap in samples between the 2 sets of years, we opted to consider each pair of years independently as opposed to having Year as a factor with all the data combined. – DQdlM Apr 23 '11 at 13:02
• @KennyPeanuts By 'ideal inferential endpoint' I meant what you'd really like to be able to say or show or do after you've completed the analysis. Basically I was struggling to parse your third paragraph and looking for some context. Thinking in your initial model formulation, the first sentence suggests you would like to report a shift in the intercept of a logistic regression model (which moves the diapause prob. up or down by year). But the second suggests you would like to show a shift in the slope (which makes the effect on diapause of being a day later more pronounced by year). Or both... – conjugateprior Apr 23 '11 at 18:00
• Oh, I see what your queston is now. Basically we would like to know if the prob of going into diapause on a given day changes between years. It seems that this could be due to either a change in intercept or slope. As I understand your initial comments on an interaction term, a sig year effect without sig interaction would mean a shift in intercept with essentially no change in slope, while a sig year effect and interaction would indicate a shift in intercept and slope. Is that the correct interpretation? – DQdlM Apr 23 '11 at 18:25
• @KennyPeanuts Yes, that's what I was suggesting. You'd want to compare the marginal effects of day between years rather than the model coefficients directly to really make the inference. A good paper discussion and figures is here: homepages.nyu.edu/~mrg217/interaction.html The other issue is that you don't say what the distribution of diapause is over days of a year, so I assumed as a default that it is rising or falling. If in fact it peaks at some time of year then you may want days^2 in the model as well (or some other polynomial or smooth term). – conjugateprior Apr 24 '11 at 8:54
• thank you for all your input and for the ref. I appreciate it. – DQdlM Apr 24 '11 at 14:53