1
$\begingroup$

When using glm(link=logit), I detected a significant interaction between two continuous predictor variables. How can I present the results visually using R?

$\endgroup$

2 Answers 2

2
$\begingroup$

Show the univariate plot where several curves correspond to different levels of other variable. If you model was y=xz, you'd pick z=0,1,2...n; then show y=0, y=x, y=2x etc. on the same graph. In this case these would be lines with different slopes.

$\endgroup$
1
$\begingroup$

One of many approaches in R

require(rms)
dd <- datadist(mydata); options(datadist='dd')
f <- lrm(y ~ pol(x1, 2) * rcs(x2, 3), data=mydata)
# quadratic in x1, cublic spline in x2 with 3 default knots
bplot(f, x1, x2)   # 3-d plot; bplot has several options
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.