From: Ross Clement <R.P.Clement_at_westminster.ac.uk>

Date: Fri 04 Mar 2005 - 06:04:15 EST

}

return( total )

}

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 Fri Mar 04 09:34:03 2005

Date: Fri 04 Mar 2005 - 06:04:15 EST

x <- c( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 )

y <- c( 3, 4.2, 8.7, 11.7, 13.2, 19.1, 21, 25, 26.1, 29.8 )

total <- 0

for ( i in 1:length(x) ) {

diff <- y[i] - a * x[i] + b total <- total + diff * diff

}

return( total )

}

a.axis <- seq( -5, 10, length=20 )

b.axis <- seq( -20, 20, length=30 )

z <- outer( a.axis, b.axis, sqe )

persp( a.axis, b.axis, z, col="light grey", xlab="a", ylab="b", zlab="sum.squared.error", theta=45 )

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 Fri Mar 04 09:34:03 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:30:40 EST
*