# Exploring shifts in response to dichotomous dependent variable

I have one dichotomous dependent variable (buried with grave goods or not) and a series of categorical and continuous independent variables (age at death, year of death, sex, socioeconomic status) for a dataset of c.5000 individuals. Therefore, I have used binary logistic regression in SPSS to explore how each of the independent variables impact the likelihood of the individual being buried with grave goods.

However, in my preliminary analysis, I found that the proportion of individuals buried with grave goods seemed to increase until around the age of 10-12 and then plateaued. I have two questions related to how I can explore this trend:

1. I performed a binary logistic regression for individuals aged 1-12 and another for individuals 13-30 and found age was a significant contributing factor in the first regression and not in the second. While this does demonstrate that the pattern is likely there, I am unhappy with this approach and have not been able to find good examples of how these patterns are normally tested for significance (while controlling for the other variables). Any suggestions or examples of how this has been done would be greatly appreciated.

2. I am interested in identifying the age at which this trend shifts so that I can then see if there are differences between the socioeconomic groups however I do not have a statistics background and am unsure how best to go about this.

• Did you advance? If you want I can have a look at your data, but then you need to share a link ... Commented Oct 6, 2021 at 17:40
• That's very kind of you to offer. Your suggestion of looking at interactions was a good one. I think that is a great way to approach this problem Commented Oct 10, 2021 at 1:19
• Hi again, I have looked into splines and interactions and I think I understand how to go forward but would like to check my understanding. 1. To incorporate both splines and interactions, it seems easier to complete this analysis in R rather than SPSS 2. I then construct a full model with all my variables including splines for age as well as interaction variables between socioeconomic status and the splines for age 3. To probe the interaction between socioeconomic status and age, I then compute predicted probabilities that the individual received grave goods for different ages Commented Oct 13, 2021 at 18:37
• *my apologies. Compute the predicted probabilities that the individual received grave goods for different ages within different socioeconomic classes (ie. age 5 at low, medium, high status; age 10 at low medium, high status; age 15 at low, medium, high status etc.) Commented Oct 13, 2021 at 18:49

It is usually best to use a model with all the data, and then include interactions. I discussed this at Separate Models vs Flags in the same model, see also How to test a curvilinear relationship in a logistic regression.

For your data I would try a generalized additive model (see tag ), a very good and flexible implementations is mgcv R (there might be something in SPSS, but I do not know about that). In reality, gam's as implemented in mgcv can be seen as a modern, flexible implementation of glm's (generalized linear models), and what I show here could be done, more or less, with glm plus some spline packages. But the modern, flexible way is shown below. So, something like

library(mgcv)
yourdf <- data.frame(grave_goods=, age_at_death=,
year_of_death=, sex=,
ses=, ...)
mod0 <- mgcv::gam( grave_goods ~ sex + ses +
s(age_at_death) +
s(year_of_death),
family=binomial, data=yourdf,
... )
summary(mod0)


Here I assume that grave_goods, sex, ses are factors, and that ses has few levels (probably 2?). The above is then a base model, with smooth effects, but without interactions. Interactions can be modeled using terms such as

s(age_at_death, by=sex)


or s(age_at_death, by=ses)

or even

s(age_at_death, by=interaction(sex,ses))


(same with year_of_death). For interactions between the two numerical variables we have to be careful, since they will have very different ranges ... but something like the following:

s(age_at_death) + s(year_of_death) +
ti(age_at_death, year_of_death)


Here is some useful material on mgcv made available by ith author Simon Wood.

• This is great thank you! I just have a couple of follow up questions. What is the benefit of ti(age_at_death, year_of_death) and would this include an interaction of the two variables with their splines? Also I am curious about the comment that two continuous variables with different ranges should be treated carefully. I have not seen this concern come up before looking into interactions Commented Oct 20, 2021 at 18:22
• ti (read as "tensor interaction" is made for an anova-like interpretation, so is assuming the main effects are already in the model (and taking care of that). Different ranges is important, because using a term like s(age_at_death, year_of_death) is using an isotropic thin-plate spline, while ti is using a tensor product,not assuming isotropic Commented Oct 20, 2021 at 18:27
• Ah understood. That makes sense, thanks again! Commented Oct 20, 2021 at 18:43
• I do hope you don't mind me posing one more question. In my case, the number of burials with grave goods is disproportionate to those without (c.10% are buried with goods). It seems brglm can implement Firth's correction for this but I cannot see whether splines can also be included. Do you happen to know the answer to this? Commented Oct 22, 2021 at 19:57
• I doubt that 10% rate is lowe enough to matter, but you could always try&see ... see stats.stackexchange.com/questions/88734/…. Then brglm seems to use the same interface as glm, so you could always use regression splines (with package splines. But that will not (easily) match the spline interaction modeling of mgcv ... Maybe you could look into brms Commented Oct 26, 2021 at 18:10