Flexible modeling of categorical variables

I am estimating balancing weights by modeling my exposures against a set of possible confounders, like age and cohort. I then check the association of each of this confounders with the exposure, after weighting the observations (it should be the same as after adjusting for the propensity score). Ideally this association should be as close as possible to zero. I notice that there are still some confounders with a relatively large association, and most of them are factors like cohort and socio-economic position. In the outcome model I model my exposures with natural splines. I was wondering whether there is something similar for categorical variables, so that I can model their effects more flexibly.

How did you determine that there are still some confounders with associations, and what were they associated with?

I am using a love plot, and I see that some of these confounders still have large associations with the exposure after adjusting for the propensity score / weighting.

The only thing I can guess is that the weighting was ignored in the love plot (I had not heard of such a plot before). You didn’t explain why you are using propensity score weighting as opposed to the more efficient and simpler direct covariate adjustment.

For sure the weighting was considered because I see a change (reduction) in the associations. I am using weighting in combination with adjustment to obtain double robustness.