Re: [R] multiple parameter optimization with optim()

2015-02-21 Thread Ravi Varadhan
Harold, Obviously the bottleneck is your objective function fn(). I have speeded up your function by a factor of about 2.4 by using `outer' instead of sapply. I think it can be speeded much more. I couldn't figure it out without spending a lot of time. I am sure someone on this list-serv

Re: [R] multiple parameter optimization with optim()

2015-02-20 Thread Bert Gunter
#opt <- optim(startVal, fn, method = "BFGS", hessian = TRUE) > opt <- nlminb(startVal, fn) > #opt <- Rcgmin(startVal, fn) > opt > #list("coefficients" = opt$par, "LogLik" = -opt$value, > &quo

Re: [R] multiple parameter optimization with optim()

2015-02-20 Thread Doran, Harold
opt #list("coefficients" = opt$par, "LogLik" = -opt$value, "Std.Error" = sqrt(diag(solve(opt$hessian } dat <- replicate(20, sample(c(0,1), 2000, replace = T)) r2 <- pl2(datat, Q =10) -----Original Message----- From: Prof J C Nash

Re: [R] multiple parameter optimization with optim()

2015-02-18 Thread Prof J C Nash (U30A)
ow. For a one-off computation, that may still be acceptable. JN On 15-02-18 06:00 AM, r-help-requ...@r-project.org wrote: > Message: 37 > Date: Tue, 17 Feb 2015 23:03:24 + > From: "Doran, Harold" > To: "r-help@r-project.org" > Subject: [R] multiple paramet

[R] multiple parameter optimization with optim()

2015-02-17 Thread Doran, Harold
I am trying to generalize a working piece of code for a single parameter to a multiple parameter problem. Reproducible code is below. The parameters to be estimated are a, b, and c. The estimation problem is such that there is one set of a, b, c parameters for each column of the data. Hence, in