Re: [R] plotting smoother function on raw data

2012-09-14 Thread Simon Wood
Well it's not pretty, but I guess you could try something like this... best, simon library(mgcv) dat <- gamSim(1,n=200,dist="normal",scale=2) b <- gam(y ~ s(x1)+s(x2),data=dat) m <- 40 x1 <- seq(0,1,length=m) x2 <- seq(0,1,length=m) pd <- expand.grid(x1=x1,x2=x2) fv <- predict(b,newdata=pd,se=TRU

[R] plotting smoother function on raw data

2012-09-11 Thread Anna Zakrisson
Hi, I have used the mgcv library to generate a simple additive model. I want to know how to plot the function on the raw data with confidence intervals whan I have TWO variables in the model. I get it to work with one variable but not with two. I am on the limit for what I understand in R, so b