[R] psi not functioning in nlrob?

Keo Ormsby keo.ormsby2 at gmail.com
Thu Aug 13 20:50:02 CEST 2009


I hadn't checked this, I only had used the default.
The problem stems from the reassigned weighs during nls iterations, 
where the psi.bisquare function can return some 0 weight values, which 
then returns some NaN values in the resid vector that is calculated by 
dividing residuals/weights.
Since the default na.action value is na.fail, this causes the nls to crash.
you can bypass this problem with
model3=nlrob(y~a1*x^a2,data=transient,psi=psi.bisquare, 
start=list(a1=0.02,a2=0.7), maxit=1000, na.action = na.omit)
but it will give you a lot of warning messages about a division of a 
different size vectors in -residuals(out)/sqrt(w), but will finish and 
calculate the parameters.
I don't know enough statistics to assure you that omiting values with 
weight=0 is sound from a mathematical standpoint, intuitively I would 
substitute them for 0.

Perhaps someone out there can help us with this?

Best wishes,
Keo.


Xiao Xiao escribió:
> Thank you Keo!
> After installing MASS the default "psi=psi.huber" is working now.
> However I still can't get "psi=psi.bisquare" to work, and here's
> another error message:
>   
>> model3=nlrob(y~a1*x^a2,data=transient,psi=psi.bisquare, start=list(a1=0.02,a2=0.7),maxit=1000)
>>     
> Error in na.fail.default(list(y = c(71.2600034232749, 148.175742933206,  :
>   missing values in object
>
> I don't know why there are missing values, I'm sure y is the right
> length and there are no NAs in it. Could somebody help me with this
> one please?
>
> Thanks in advance,
> Xiao
> On Wed, Aug 12, 2009 at 11:47 PM, Keo
> Ormsby<christopher.ormsby at cieni.org.mx> wrote:
>   
>> You have to install MASS package first.
>> Hope this does the trick.
>> Best,
>> Keo.
>>
>> Xiao Xiao wrote:
>>     
>>> Hi all,
>>>
>>> I'm trying to fit a nonlinear regression by "nlrob":
>>>
>>>  model3=nlrob(y~a1*x^a2,data=transient,psi=psi.bisquare,
>>> start=list(a1=0.02,a2=0.7),maxit=1000)
>>>
>>> However an error message keeps popping up saying that the function
>>> psi.bisquare doesn't exist.
>>>
>>> I also tried psi.huber, which is supposed to be the default for nlrob:
>>>
>>> model3=nlrob(y~a1*x^a2,data=transient,psi=psi.huber,
>>> start=list(a1=0.02,a2=0.7),maxit=1000)
>>>
>>> But I still got the same error message - psi.huber doesn't exist.
>>>
>>> Is the argument "psi" not available in nlrob?
>>>
>>> Any help will be appreciated.
>>>
>>> Best,
>>> Xiao Xiao
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> 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
> 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