Reputation: 16845
I am trying to fit a GAM model as follows:
model <- gam(`output` ~ s(`var 1`) + s(`var 2`), data = mydata)
Where mydata
is a data.frame
containing the data I need with columns: output
, var 1
and var 2
.
When I run the command I get this warning:
Warning message:
In model.matrix.default(mt, mf, contrasts) :
non-list contrasts argument ignored
Which I have no idea what it means. However I can see that the model is fit as summary(model)
returns stuff.
Now I would like to plot the fitting curves for:
output
against var 1
output
against var 2
How?
I have tried to:
plot(model)
But I get this error:
Error in parse(text = evars) : <text>:1:8: unexpected symbol
1: var 1
Upvotes: 0
Views: 243
Reputation: 16845
The problem was in the names. lm
accepts the syntax of names enclosed in backticks. gam
does not. In the end, I changed the data frame to allow this:
model <- gam(y ~ s(x) + s(w), data = mydata)
And then the plotting worked.
Upvotes: 1