# What statistical test to use for a within-subject design with binary dv?

I am asking because I am lost and I failed my first submission because of wrong analysis.

The goal of my experiment is to examine the moderating role of product involvement in the relationship between maximizing tendency and intentions to switch a product. Maximizing tendency (the independent variable) is measured as a continuous variable, intention to switch as a binary variable (Yes or No). Product involvement is measured by testing participants for 2 product categories, differing in involvement (High or Low).

To be more specific, I measured participants maximizing tendency and then participants had to complete a task which consisted in choosing a product from an assortment, and after they were asked if they wanted to switch to a different model. Every participant did this one time for a high involvement product category, and another time for a low involvement product category (so it is a within-subjects design). So each participant has a maximizing tendency score and intention to switch "values" for each category (so either Yes or No). Keep in mind, they have intention to switch for the high involvement product and intention to switch for the low involvement product.

I need to check whether there is an interaction effect, but I don't know how to do it. I tried using logistic regression, analyzing each product category separately but this did not allow me to measure any significant difference between the 2 conditions. I am looking online but I don't find anything perfect for my case. What kind of statistical test can I use to analyze this? P.S. I am using SPSS

Multilevel models frequently do not capture the right correlation patterns. A method that models serial correlation and allows, unlike a random intercepts model, the correlation between two binary occurrences within the same individual to lessen as the time gap increases, is more likely to fit. One such model is a first-order Markov binary logistic model, which does not require the use of random effects and is easy to set up.

With the tall and thin dataset you add a variable that is the outcome status of the customer in the previous time period. You need to start the process off by having a baseline status or assuming that at time 0 no one intends to switch already. The previous period's outcome status is just a covariate in the logistic model, and you also need to add elapsed time as a covariate, plus nonlinear terms for time, to allow for arbitrary drift in the switch tendencies.

This first-order Markov state transition model handles the case where the outcome can reoccur as well as the case where it is a terminating event ("absorbing state"). For the latter, the multiple rows per customer just stop at the terminating event.

A case study for the more complicated situation where the outcome status is ordinal with more than two levels may be found here.

• As a non-statistician who usually defaults to multilevel model, thank you for this! Can I ask a related question - would using an unstructured covariance structure in a multilevel model overcome the issue of the model not capturing the correct correlation patterns? Jul 28 at 8:59
• Good question. When subjects are measured at different times or there are a lot of distinct time points, an unstructured covariance matrix has too many parameters, creating convergence problems and instability. An unstructured pattern probably works fine when there are 3 time points, typically. Jul 28 at 12:05
• That makes sense, thank you! :) Jul 28 at 13:43
• On this site thanks is expressed by upvoting comments, questions, and answer. Jul 28 at 17:43

Does the following

  id  max      intswitch cond
1  3.351453         1 high
1  3.813666         1  low
2  1.881614         0 high
2  4.234444         0  low
3  3.198558         0 high
3  3.306464         0  low
4  1.982942         1 high
4  2.858967         1  low
5  4.139784         1 high
5  3.502371         0  low
6  1.364619         0 high
6  1.604352         0  low


match your data structure? In the example, id refers to participant identifier, max to maximizing tendency (I drew it from normal distribution with mu=3 and sd=1, maybe your variable is different but ignore that for the example's sake), cond to product involvement (high or low, each participant goes through both), and intswitch to intention to switch (0=no, 1=yes)?

If so, I think a multilevel logistic regression model with max and cond and their interaction predicting intention to switch and including random intercept of participant should work. The interaction and relevant post-hoc comparisons will provide evidence about whether maximizing has a different relation with switching intentions in the high vs. low involvement condition, and the participant id random intercept will take care of the repeated nature of the data. You can do this in SPSS using Mixed models...Generalized linear option.

The r code I would use would be

library(lme4)
model<-glmer(intswitch ~ (1|id)+cond*max, data=data, family="binomial")


but I don't dare suggest SPSS syntax as it's been too long since I used SPSS for this type of analyses.

EDIT - so your data is

id max  intswitch cond
1  3    1         high   #here, high would refer to the
1  3    0         low    #trial where the participant was presented
2  2    0         high   #with high involvement products and low
2  2    0         low    #to the trial with the low involvement
3  1.5  1         high   #products
3  1.5  1         low


Or, possibly, the "cond" variable is yet somehow different? If so, please clarify.

But in any case, it seems to me you can model your data in multilevel logistic regression regressing intention to switch on the condition variable, maximizing tendency and their interaction and include participant random intercept, and that should be doable in SPSS Mixed Models Generalized Linear :)

EDIT 2 - if your data in SPSS now has this kind of structure

id1 max low high
1   3   0   0
2   4   1   0
3   2   1   0
4   2   1   1
5   3   0   0
6   5   1   1
7   4   0   0
8   4   1   1
9   3   1   0
10  2   1   0


You can restructure it into long format with the following or something like it

VARSTOCASES
/ID=id
/MAKE cond FROM low high
/INDEX=Index1(cond)
/KEEP=id1 max
/NULL=KEEP.


(id variable cannot be called "id" in SPSS VARSTOCASES for some reason, so I changed it into id1)

• Thank you so much. My data structure is different, in a sense that each participant has one maximizing tendency score, and values (0 or 1) for intention to switch high and intention to switch low. I don't know if that changes something in your answer. Jul 26 at 15:27
• Not really - it wouldn't even change the example r code. Maximizing tendency would then just be a level 2 predictor. I didn't quite get whether you have 2 or 4 "intention to switch" scores per participant, but that doesn't change things either. If you organize your data in the long format (so that each row = 1 observation and the same participant has as many rows as there are observations per participant). Jul 27 at 11:09
• Well my problem then is that I don't have a variable indicating the condition. The variables I have, for each participant, are: id, maximizing score, intention to switch for high and intention to switch for low. The structure is different from the one proposed in the edit (I don't have doubles for participants) Jul 29 at 13:28
• Yes, you would need to restructure your data into long format to do the suggested analysis (at least in R and SPSS). Such restructure creates a variable indicating repeated measures across participants (here: cond). See SPSS tutorials for Data restructure (I believe varstocases is the function to do this). Aug 1 at 9:38
• I mean, you do have two scores of intention to switch for each participant, right? They are just currently in the form of 2 separate variables (columns/vectors) so that you have one row per participant in your data? Aug 1 at 9:40