Message-ID: <1274693404675-2228350.post@n4.nabble.com>
Date: 2010-05-24T09:30:04Z
From: Berend Hasselman
Subject: Optimization
In-Reply-To: <AANLkTikrTm4Dg-iSmk3iCjynEY0jr1tMXpHwohIm85C_@mail.gmail.com>
Bogaso wrote:
>
> Hi all, I need to minimize following function :
>
> dat <- matrix(rnorm(20000), ncol=2)
> targetFn <- function(x) {
> dat <- as.matrix(dat)
> dat1 <- 1*dat[,1] - (x^2)*dat[,2]
> return(sd(dat1)) }
>
> i.e. I want ro find for which "x" the value of "targetFn" will be minimum,
> depending on current dataset "dat". Is there any optimization routine
> available for this type of optimization?
>
Try the help
??optimization
And some mathematics will show that in your particular case x=0 is the
optimal value.
Berend
--
View this message in context: http://r.789695.n4.nabble.com/Optimization-tp2228300p2228350.html
Sent from the R help mailing list archive at Nabble.com.