wireframe 3-D problems
Xu Jun wrote:
I am trying to graph a 3-D graph of simulated data for logit models using the powerful wireframe command, but I got stuck. Here are the codes: x <- seq(-4, 4, by=0.01) y <- seq(-4, 4, by=0.01) p <- 1/(1+exp(-0.12*x + 0.35*y)) mydata <- cbind(x, y, p) require(lattice) wireframe(p~x*y, data=mydata) and I received the following message: Error in eval(substitute(groups), data, environment(formula)) : numeric 'envir' arg not of length one Can anyone here point me to the right direction? Thanks!
Your x and y variables were only evaluated along a single line, not over the entire grid (other solutions are possible using outer() and rep() ...) x <- seq(-4, 4, by=0.25) y <- seq(-4, 4, by=0.25) mydata <- expand.grid(x=x,y=y) p <- 1/(1+exp(-0.12*mydata$x + 0.35*mydata$y)) mydata <- data.frame(x=mydata$x,y=mydata$y,p) require(lattice) wireframe(p~x*y, data=mydata) ## should play with "screen" argument, see ?panel.wireframe
View this message in context: http://www.nabble.com/wireframe-3-D-problems-tp23579998p23580512.html Sent from the R help mailing list archive at Nabble.com.