Skip to content

How to remove tensor interaction in gam function? #198

Answered by gavinsimpson
Nataliannash asked this question in Q&A
Discussion options

You must be logged in to vote

Instead of opening an Issue (which is for bug reports or feature requests) please use the Discussions tab.

Technically, your model should be

m1 <- gam(Y ~ s(X1) + s(X2) + s(X3) + s(X4) +      # first order terms
            ti(X1, X2) + ti(X1, X3) + ti(X2, X3) + # second order terms
            ti(X1, X2, X3),                        # third order term
          data=data, family = FOO, method = "REML")

Now you can consider dropping the ti(X1, X2, X3), and from there consider if you need any of the second order interactions.

Adding select = TRUE to the model if you want to do model selection.

If your question is, can you fit

m2 <- gam(Y ~ s(X1) + s(X2) + s(X3) + s(X4),
          data=data, f…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Nataliannash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #197 on November 07, 2022 09:10.