[R] b1 function in ch 12 scripts of MASS

From: Jordi <jordi_molins_at_hotmail.com>
Date: Thu 01 Sep 2005 - 05:49:24 EST


Dear list,  

I have been trying to reproduce the scripts of the MASS library and I have found a problem when trying to reproduce the code in 12.4, with the use of neural networks and the function b1:  

b1 <- function(Z, ...)

{

   zp <- Z[,3] - pmax(Z[,2], Z[,1])

   contour(xp/log(10), yp/log(10), matrix(zp, np),

      add=T, levels=0, labex=0, ...)

   zp <- Z[,1] - pmax(Z[,3], Z[,2])

   contour(xp/log(10), yp/log(10), matrix(zp, np),

      add=T, levels=0, labex=0, ...)

}  

Using this function, the contours appear in a much reduced zone of the chart. Instead, if I use  

b1 <- function(Z, ...)

{

   zp <- Z[,3] - pmax(Z[,2], Z[,1])

   contour(exp(xp), exp(yp), matrix(zp, np),

      add=T, levels=0, labex=0, ...)

   zp <- Z[,1] - pmax(Z[,3], Z[,2])

   contour(exp(xp), exp(yp), matrix(zp, np),

      add=T, levels=0, labex=0, ...)

}  

I get similar panels to the ones in the book. Also, this choice would be consistent with the functions predplot and cushplot.  

Am I doing something wrong?  

Regards  

Jordi  

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Sep 01 05:58:16 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 16:09:56 EST