[R] problem with uniroot

Ben Bolker bolker at ufl.edu
Wed Jun 3 23:20:43 CEST 2009




daniele riggi wrote:
> 
> Hi R-users,I'm trying to solve a non linear equation, to find the degrees
> of
> freedom of a mixture of t student. I'm sure i wrote the minimization
> equation in the right way, but when i try to run the EM algorithm to
> estimate the parameters of the mixture, the following error will appear:
> 
> Error in uniroot(function(z) log(z/2) - digamma(z/2) + 1 - log((z + d)/2)
> +
>  :
>   f() values at end points not of opposite sign
> 
> I don't know how solve this problem, i have already tried using the
> function
> optimize, but it doesn't work.
> 
> 

Well, this isn't exactly a reproducible example ...
As the error message suggests, the uniroot() function is finding that
the endpoints you have given it are of the same signs, hence it
doesn't know how to set about looking for a root.  I would suggest
that you insert a debugging statement that prints the values of
the endpoints and the values of the function evaluated at those
endpoints (see ?cat) -- perhaps that will give you a clue.

 Ben Bolker

-- 
View this message in context: http://www.nabble.com/problem-with-uniroot-tp23853892p23859678.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list