# Logistic regression with an independent variable that only applies to a subset

I'm trying to perform a logistic regression with the dependent variable being whether a potential customer who attended an event purchased or did not purchase.

A subset of potential customers at the event participated in a meet-and-greet type activity with each other and existing customers. For each potential customer, the percentage of existing customers was recorded for the time a potential customer was in the meet-and-greet area. For example, a potential customer may have stopped at the meet-and greet for 1 hour, and during that time, on average there might have been 20% existing customers, and 80% potential customers.

I would like to incorporate this variable into my logistic regression model as a continuous variable without categorizing it, but I do not know how to code that variable for potential customers who were at the event, but not the meet-and-greet.

I think that setting the non-meet-and-greet people to zero would not be the right way to go. Do I just need to perform a separate logistic regression on the people who participated in the meet-and-greet? I'm using SPSS if that makes a difference. Thank you!

• But is the meet-and-greet participation itself endogenous? That is might the percentages have affected whether someone entered that area? If so, you would need to model that part of the process, too. – JKP May 14 '14 at 12:33

## 2 Answers

This variable seems inapplicable to the people outside your subset. If they weren't at the meet-and-greet, why would the mixture of customers who were there improve your prediction for the people who only attended the event? It seems to me like you'd have to treat the variable as missing for the group that only attended the event. You definitely shouldn't set it to zero for them – for the purpose of your logistic regression, those zeros would be treated as zero percent, assuming the variable is entered as continuous like you want.

However, coding those observations as missing will probably cause SPSS to exclude all the event-only attendees by default when fitting a model that includes the variable that only applies to attendees of the meet-and-greet. That may cost you a lot of power depending on how many only attended the event. There's a lot to be said about alternative methods for handling missing data, so rather than going into it here, I recommend checking out David C. Howell's Treatment of Missing Data. He covers a lot of bad options and a few good ones, and then gives a dedicated treatment of SPSS in Multiple Imputation Using SPSS. At a glance, it looks like it will be important to determine whether observations are missing completely at random, and if so, to consider your imputation options carefully.

You can setup two variables and their interaction:
$X_1$ = Attended meet & greet (categorical)
$X_2$ = Your continuous variable measured on meet & greeters (doesn't matter what you set this to for non meet & greeters)

And instead of including both main effects, only include $X_1$
$Y = \beta_0 + \beta_1X_1 + \beta_2X_1X_2$

So $\beta_1$ is the impact of attending the meet & greet, and $\beta_2$ is the impact of your continuous measure only amongst those attending the meet & greet.

• How is this different from coding $X_2$ as zero for those who only attend the event? – Nick Stauner May 14 '14 at 1:18
• @NickStauner It prevents the zeros of the non-subset from (directly) influencing $\beta_2$ – Affine May 14 '14 at 1:37
• I have the same question as @NickStauner. I don't see how this is mathematically any different to coding $X_2$ as zero. The data table would look the same surely and it is only our explanation of how we got there which is different. Isn't this an example of why we should always include the main effect in a model ... If we did so here then the error would be obvious? I am asking not stating ;) – drstevok May 14 '14 at 23:53