Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205399

How to plot the fitting curves in a GAM regression in R?

$
0
0

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?


Attempt I

I have tried to:

plot(model)

But I get this error:

Error in parse(text = evars) : <text>:1:8: unexpected symbol
1: var 1

Viewing all articles
Browse latest Browse all 205399

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>