[R] ms and congratulations!

gb@stat.umu.se gb at stat.umu.se
Tue Feb 29 17:12:22 CET 2000


On 28 Feb 2000, Douglas Bates wrote:

> Douglas Bates <bates at stat.wisc.edu> writes:
> 
> > Assuming that the quadratic form evaluates to a scalar, try
> > 
> > opt.func <- function(alf, beta) 
> >   t(Y-(X[,1] * alf + X[,2] * bet)^delta) %*% covariance.matrix.inverse %*%
> >             (Y-(X[,1] * alf + X[,2] * bet)^delta)
> > 
> > nlm(opt.func, c(alf = 5, bet = 0.5))
> > 
> > or
> > 
> > optim(c(alf = 5, bet = 0.5), opt.func)
> 
> Those are wrong.  The function being optimized has to be a function of
> a single argument.  If alf and bet are both scalars you can combine
> them into a vector and use
> 
> opt.func <- function(arg) 
>   t(Y-(X[,1] * arg[1] + X[,2] * arg[2])^delta) %*% covariance.matrix.inverse %*%
>             (Y-(X[,1] * arg[1] + X[,2] * arg[2])^delta)

Doug, thank you for the help. Of course it works perfectly!
And of course my thanks go to the whole  R  team on a day
like today! 

Göran
----------------------------------------------------------
 Göran Broström                      tel: +46 90 786-5223
 Department of Statistics            fax: +46 90 786-6614
 Umeå University                                         
 SE-90187 Umeå, Sweden              email: gb at stat.umu.se
                                                        
 http://www.stat.umu.se/egna/gb    ftp://capa.stat.umu.se
----------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list