john lewis wrote:
R- Users:
Can someone indicate what I am during wrong? This is a script essentially from Venerable & Ripley's text on interpolating a surface with loess function but I can not get it to run.
Thanks. John Lewis Professor McGill University Montreal
library(MASS) library(modreg) data(topo) par(mfcol=c(2,2), pty="s") topo.loess <- loess(z ~ x * y, topo, degree=2, span = 0.25, normalize=F) topo.mar <- list(x = seq(0, 6.5, 0.1), y=seq(0, 6.5, 0.1)) topo.lo <- predict(topo.loess, expand.grid(topo.mar), se=T) lo.1 <- as.data.frame(topo.lo) lo.2 <- as.matrix(lo.1$fit)
I just listed "lo.2": It was a 4356 x 1 matrix; in S-Plus 6.1, it was a NULL matrix with 0 rows and 1 column. I recently attempted to upgrade to R 1.7.1 and now I can't get graphics from R. However, the following worked for me in S-Plus 6.1:
lo.2 <- matrix(topo.lo$fit, nrow=66)
With this, I got a plot that looked sensible (though I didn't compare it with MASS).
hope this helps. spencer graves
lo.3 <- as.matrix(lo.1$se.fit)
contour(topo.mar$x,topo.mar$y,lo.2, levels = seq(700,1000,25),
xlab="fit", ylab="")
points(topo)
contour(topo.mar$x,topo.mar$y,lo.3, levels = seq(5, 25, 5),
xlab="standard error", ylab="")
title("Loess degree = 2")
points(topo)
This is the error I keep getting.
"Error in contour.default(topo.mar$x, topo.mar$y, lo.2, levels = seq(700, : no proper `z' matrix specified"
I received this same message when I ran the script first without changing topo.lo from a list to data.frame etc. as seen below.
contour(topo.mar$x,topo.mar$y,topo.lo$fit, levels = seq(700,1000,25),
xlab="fit", ylab="")
I checked the length of each variable and they are correct. [[alternative HTML version deleted]]
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help