Re: [R] function in nls argument -- robust estimation

2008-05-20 Thread Fernando Moyano
Hi Kate and others, thanks for the info. Btw, you sent the different methods to analyze the data: nls, nls.lm and nlrob. Comparing the results visually nlrob performed better then nls, but nls.lm (using the 0.9 quantile of residuals) was still better than nlrob. My data may have a rather large amo

Re: [R] function in nls argument

2008-05-08 Thread Fernando Moyano
f your goal is to minimize sum( (observed - > predicted)^2), the function you give nls to minimize (optim.fun in your > case) should return the vector (observed - predicted), not the scalar sum( > (observed - predicted)^2). You may want to see the nls.lm function in > package minpack.lm f

[R] function in nls argument

2008-05-07 Thread Fernando Moyano
Greetings R users, maybe there is someone who can help me with this problem: I define a function "optim.fun" and want as output the sum of squared errors between predicted and measured values, as follows: optim.fun <- function (ST04, SM08b, ch2no, a, b, d, E) { predR <- (a*SM08b^I