Hello all, Im trying to add some data points to a wireframe. X an Y axis are independent variables, Z axis is predicted probability. Id like to add the original data points on which the predicted probabilities are based to the wireframe. Ive followed some of the previous post on this but get stuck :
## first part yields the wireframe## setwd("C:/Temp") rnp <- read.table("interact.csv",header=T,sep=";") status <-rnp[,1:1] totalfrost <- rnp[,2:2] logtps <- rnp[,3:3] logpd <- rnp[,4:4] logwinterp <- rnp[,5:5] model <- glm(status~totalfrost+logtps+logpd+logwinterp+totalfrost*logtps+totalfrost*logwinterp,binomial) abc <- expand.grid(totalfrost=seq(-1.9,3.6,by=0.25),logtps=seq(-3.3,1.1,by=0.25),logpd=seq(0.95,4.1, by=0.25),logwinterp=seq(1.49,1.78, by=0.25)) abc$status <-as.vector(predict(model,abc,type="response")) ##below is the import of the original data together with their predicted probabilities## punten <- read.table("probs.csv",header=T,sep=";") x <- punten[,1:1] y <- punten[,2:2] z <- punten[,3:3] pts <- data.frame(x=x,y=y,z=z) ##end import original data## wireframe(status~totalfrost*logtps,abc,scales=list(arrows=TRUE),drape=TRUE, screen =list (x=15, y=-50, z=-105), pts = pts, panel.3d.wireframe = function(x, y, z, xlim, ylim, zlim, xlim.scaled, ylim.scaled, zlim.scaled, pts, ...) { panel.3dwire(x = x, y = y, z = z, xlim = xlim, ylim = ylim, zlim = zlim, xlim.scaled = xlim.scaled, ylim.scaled = ylim.scaled, zlim.scaled = zlim.scaled, ...) xx <- xlim.scaled[1] + diff(xlim.scaled) * (pts$x - xlim[1]) / diff(xlim) yy <- ylim.scaled[1] + diff(ylim.scaled) * (pts$y - ylim[1]) / diff(ylim) zz <- zlim.scaled[1] + diff(zlim.scaled) * (pts$z - zlim[1]) / diff(zlim) panel.3dscatter(x = xx, y = yy, z = zz, xlim = xlim, ylim = ylim, zlim = zlim, xlim.scaled = xlim.scaled, ylim.scaled = ylim.scaled, zlim.scaled = zlim.scaled, ...) }) This yields me the following errors : Warning messages: 1: In Ops.factor(pts$x, xlim[1]) : - not meaningful for factors 2: In Ops.factor(pts$y, ylim[1]) : - not meaningful for factors 3: In Ops.factor(pts$z, zlim[1]) : - not meaningful for factors Any idea about what is wrong and what to do about it? Thanks! Diederi Diederik Strubbe Evolutionary Ecology Group Department of Biology, University of Antwerp Universiteitsplein 1 B-2610 Antwerp, Belgium http://webhost.ua.ac.be/deco tel : 32 3 820 23 85 [[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.