[R] Problem with the port algorithm in nls function

ProfJCNash profjcnash at gmail.com
Mon Nov 16 21:05:24 CET 2015


You might try functions in the nlmrt package, but there are some
differences in the call -- you must have a well-defined dataframe for
example. And with only 1 parameter, I'm not sure of the behaviour.

JN

On 15-11-16 02:41 PM, Bert Gunter wrote:
> from ?nls ...
> 
> "The algorithm = "port" code appears unfinished, and does not even
> check that the starting value is within the bounds. Use with caution,
> especially where bounds are supplied."
> 
> So it appears that you may have gotten what you paid for.
> 
> Cheers,
> Bert
> Bert Gunter
> 
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
>    -- Clifford Stoll
> 
> 
> On Mon, Nov 16, 2015 at 10:30 AM, roberto marrone
> <robertomarrone at hotmail.it> wrote:
>> 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]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list