[R] Problem with the port algorithm in nls function

roberto marrone robertomarrone at hotmail.it
Mon Nov 16 19:30:08 CET 2015


Dear all,

using the following code I have find a problem with the port algorithm. If I use the nls function without lower bound for my parameter it compute the parameter's value but I want the parameter positive. Running the following code I had this error. Thanks at all.


optim <- nls(Prezzo ~ S*pnorm((log(15/14)+(0.015+theta^2/2)*0.17)/(theta*sqrt(0.17))) - 14*exp(-0.015*0-17)*pnorm((log(15/14)+(0.015+theta^2/2)*0.17)/(theta*sqrt(0.17)) - theta * sqrt(0.17)),
+  start=c(theta=0.1),
+  data=data,
+  algorithm="port",
+  lower=0.01,
+  trace=TRUE,
+  control= nls.control(maxiter = 100, tol = 1e-05, minFactor = 1/1024, printEval = FALSE, warnOnly = FALSE))


Error in nls_port_fit(m, start, lower, upper, control, trace, give.v = TRUE) :
  INTEGER() can only be applied to a 'integer', not a 'NULL'


	[[alternative HTML version deleted]]



More information about the R-help mailing list