The answer to my post is yes (which I just figured out).

Solution:



#super small version of R code for pd plot using apply

a <- rbind(c(0:1111)*(max(m$x1)-min(m$x1))/1111 +
min(m$x1),c(0:1111)*0-99999)

b <- matrix(rep(c(0:1111)*(max(m$x1)-min(m$x1))/1111 + min(m$x1), nrow(m)),
nrow(m), 1112, byrow=T)

a[2,] <- apply(b,2,FUN=function(x)
{mean(predict(lm1,cbind(m[,-match("x1",names(m))],x1=x)))  })

plot(a[1,],a[2,],xlab="x1",ylab="Response",type="l",main="Partial Dependence
Plot")


Mike Dugas

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to