*Looking at the complaints below on using numericDeriv and using optim, I
don't understand how to use these functions properly. Any help will be
appreciated for my example function below. Thanks.*
*
*
*fitterma <- function(xtime) { *
*a <- -0.09144115*
*b <- -0.01335756*
*c <- -2.368057*
*d <- -0.00600052*
*return(exp(a+b*xtime)+exp(c+d*xtime))*
*}*
*First, take the numerical derivative of this CDF (fitterma)* to obtain
probability density function. I tried using:
*> numericDeriv(fitterma,"xtime")*
*Error in numericDeriv(fitterma, "xtime") : *
* cannot coerce type 'closure' to vector of type 'double'*
*Secondly, I want to minimize this function (fitterma) as a function of
xtime*. I tried using:
*> optim(1, fitterma)*
I don't understand how to use above function either.
[[alternative HTML version deleted]]