I have a dataset with 4 predictor variables (X1, X2, X3,X4), the interaction X1*X2 and a binary response. I would like to visualize how the slope of X1 changes with values of X2. In https://stats.oarc.ucla.edu/r/faq/how-can-i-explain-a-continuous-by-continuous-interaction/ they do something similar with linear regression and two predictors. Is there any way to do that in Logistic regression with multiple predictors but only interested in the interaction of the two? I use R, so if you have some sample code it would be great. A subset of the dataset is:
structure(list(extry = c(0, 0, 0, 0, 0, 0), CAPE = c(1.14374437306378,
20.1164451497721, 4.50769841148758, 26.3733996612395, 2.28748874612802,
0.269116323073831), SATmax = c(11.4, 8.9, 10.3, 12.3, 9.6, 11.7
), PC1 = c(-2.65976813816683, -2.5478670787521, -2.58556444360627,
-2.39983714790594, -1.51378585899909, -0.695703681902304), PC2 = c(0.37508773845025,
-0.347147505858787, -1.35864530847998, -1.66587526284572, -1.86195614101445,
-1.75492325860976)), row.names = c(NA, 6L), class = "data.frame")
and the model fit_int <- glm(extry~CAPE+ SATmax + PC1 + PC2+ CAPE:SATmax,family=binomial("logit"),data = test)