From: kathie <kathryn.lord2000_at_gmail.com>

Date: Wed, 19 Mar 2008 14:01:54 -0700 (PDT)

Date: Wed, 19 Mar 2008 14:01:54 -0700 (PDT)

I want to min "integrate( (p1*dnorm+p2*dnorm+p3*dnorm)^(1.3))" for p, mu, and sigma.

So, I have to estimate 8 parameters(p3=1-p1-p2).

- How could I fix this error? Actually, I can not understand why it is not finite function. Anyway, I tried to divide into several intervals and sum up, but I failed.
- how could I improve results?

alpha=1.3; theta0=c(0.5,0,sqrt(10),0.25,-.3,sqrt(0.05),.3,sqrt(0.05))

fc = function(theta){

numint = function(z)

{

(theta[1]*dnorm(z,mean=theta[2],sd=theta[3])+theta[4]*dnorm(z,mean=theta[5],sd=theta[6])

+(1-(theta[1]+theta[4]))*dnorm(z,mean=theta[7],sd=theta[8]))^alpha }

inte = integrate(numint,lower=-Inf, upper=Inf)$value
inte

}

optim(theta0, fc, method="L-BFGS-B",hessian=T, lower=c(rep(c(0,-Inf,0),2),-Inf,0),upper=c(rep(c(1,Inf,4),2),Inf,4))

Kathryn lord

-- View this message in context: http://www.nabble.com/problem-with-optim-and-integrate-tp16149860p16149860.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.Received on Wed 19 Mar 2008 - 21:49:11 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Fri 21 Mar 2008 - 19:31:14 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*