[R] Optimizing given two vectors of data (confusedSoul)

Prof. John C Nash nashjc at uottawa.ca
Fri Jun 25 14:55:21 CEST 2010


> I am trying to estimate an Arrhenius-exponential model in R.  I have one
> vector of data containing failure times, and another containing
> corresponding temperatures.  I am trying to optimize a maximum likelihood
> function given BOTH these vectors.  However, the optim command takes only
> one such vector parameter.
>
> How can I pass both vectors into the function?

You need to combine your vectors

   params<-c(vecone, vectwo)

Inside your objective function, you will need to split them out again.

However, I have some suspicions that you are referring to the DATA for the function rather 
than the parameters that are being optimized. The data goes into the '...' arguments to 
optim and other optimization tools.

JN



More information about the R-help mailing list