[R] Error in nlm : non-finite value supplied by 'nlm'

Ravi Varadhan rvaradhan at jhmi.edu
Tue Jun 15 22:00:40 CEST 2010


You need to constrain your parameters such that 0 < vector[1] < 1 and
vector[2] > 0.

You could try the `spg' function in package "BB" or the `L-BFGS-B' function
in optim to perform this box-constrained optimization. There are other
options as well including the `nlminb' function.

Ravi.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Hiba Baroud
Sent: Tuesday, June 15, 2010 1:33 PM
To: r-help at r-project.org
Subject: [R] Error in nlm : non-finite value supplied by 'nlm'


Hello,
 
I am trying to compute MLE for non-Gaussian AR(1). The error term follows a
difference poisson distribution. This distribution has one parameter
(vector[2]).
So in total I want to estimate two parameters: the AR(1) paramter
(vector[1]) and the distribution parameter.
My function is the negative loglikelihood derived from a mixing operator.
 
f=function(vector)
-sum(log((vector[1]*data$I)+((1-vector[1])*((exp(-2*vector[2]))*besselI(2*ve
ctor[2],data$PC)))))
 
nlm(f,p=c(-0.2354,0.00003269))

Error in nlm(f, p = c(-0.2354, 3.269e-05)) : 
  non-finite value supplied by 'nlm'

In addition: There were 50 or more warnings (use warnings() to see the first
50)
 
warnings()
Warning messages:
1: In besselI(2 * vector[2], data$PC) : value out of range in 'bessel_i'
# all warnings are the same
 
 
I would like to know what are the possible ways to avoid having non-finite
value.
 
Thank you very much.
 
H.

 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with Microsofts powerful SPAM protection.

	[[alternative HTML version deleted]]



More information about the R-help mailing list