Hi, I have a function of the second grade, with 2 parameters: y~A^2 + A + B^2 + B
The response y is a measurement for the precision of the analytical method, where A en B are method parameters. As its neccesary to keep the precision of the analytical methad as good as possible, its usefull to optimize A en B to keep y as low as possible. But how can I do this with R? I have searched the archives, did some search work in the help function ( optimize, nlm, nls, ...) but could find anything that looks like what I need. I have written a script which does the work, but I doubt this is the easiest way. Here are some data and the script: A<- rep(c(1,4,8),3) B<- rep(c(1,3,6),each=3) C <- c(3,2,3,2,1,2,3,2,3) fit <- lm(C~I(A^2)+A+I(B^2)+B) Now to optimize: new <- data.frame(A=rep( seq(0, 8, 0.5),each=17),B=rep(seq(0, 8, 0.5),17)) new$C <- predict(fit, new) new[which.min(new$C),] This give me the values for A en B, where C is minimized. Is there another way? Kind regards Bart [[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