Skip to content
Back to formatted view

Raw Message

Message-ID: <loom.20060209T091523-518@post.gmane.org>
Date: 2006-02-09T08:17:38Z
From: Dieter Menne
Subject: Simple optim - question

Carsten Steinhoff <carsten.steinhoff <at> gmx.de> writes:

> I want to find the parameters mu and sigma that minimize the following
> function.
> It's important, that mu and sigma are strictly positive.
> 
> -----------------
> optimiere = function(fmean,smean,d,x,mu,sigma)
> {
> merk = c()
> for (i in 1:length(d))
>   merk=c(merk,1/(d[i]^2)*(d[i]-1/(fmean*(1-plnorm(x[i],mu,sigma))))^2)
> return(sum(merk))
> }
> -----------------
> 
....

Try optim or nlminb, both can be used with constraints. Or, as your example 
looks like a least-square problem, reformulate optim and use nls.

Dieter