Displaying 2 results from an estimated 2 matches for "predictmat".
Did you mean:
predictdata
2013 Mar 21
1
[mgcv][gam] Odd error: Error in PredictMat(object$smooth[[k]], data) : , `by' variable must be same dimension as smooth arguments
...where "makepHplot" is a different function that I made.
This worked for quite some time. Then I added some data to the model
and changed the specification slightly. Now I'm getting this error message:
1> a = makepred(c("bcph.imp","year"),c(7.5,1))
Error in PredictMat(object$smooth[[k]], data) :
`by' variable must be same dimension as smooth arguments
I never got this message with the old fitted model (and still don't).
What is happening? I can't figure out what about the new fitted model
is causing this problem. Typing "PredictMat"...
2010 Oct 21
1
gam plots and seWithMean
...va(f1,f2)
summary(f2)
plot(f2)
#the solid line s(d)
dat<-data.frame(t,d,x1,x2,x3)
datn<-transform(dat,d=0)
dif<-predict(f2)-predict(f2,datn)
cdif<-dif-mean(dif)
points(d,cdif,cex=0.5,col=rgb(0,1,0,0.2))
#another approach to the solid line s(d)
devAskNewPage(ask=T)
plot(f2)
premat2<-PredictMat(f2$smooth[[1]],data=dat)
dim(premat2)
pars<-f2$coef
pars2<-pars[5:13]
pars2<-as.matrix(pars2,9,1)
pars2
points(d,premat2%*%pars2,cex=0.5,col=rgb(0,0.6,0.3,0.2))
#premat2%*%pars2 = cdif
#confidence intervals when seWithMean = FALSE
devAskNewPage(ask=T)
plot(f2)
points(d,cdif,cex=0.5,col=rg...