Hi
I need to find the Hessian matrix for a complicated function from a certain
kind of data but i keep getting this error
Error in f1 - f2 : non-numeric argument to binary operator

the data is given by

          U<-runif(n)
          Us<-sort(U)
          tau1<- 2
          F1tau<- pgamma((tau1/theta1),shape,1)
          N1<-sum(Us<F1tau)
          X1<- Us[1:N1]
          Ti<- theta1*qgamma(Us[1:N1],shape,1)
          w=N1+1
          V<- Us[w:r]
          N2<- length(V)
          V1<-theta2*qgamma(V,shape,1)
          Tj<-V1+tau1-(theta2/theta1)*tau1
          c1<-matrix(Ti,ncol=1)
          c2<-matrix(Tj,ncol=1)
          cc<-data.frame(rbind(c1,c2))[,1]

require(numDeriv)
m1<- function(x)  #a function that generates the estimates
{
   loglik<-function(alpha,theta1,theta2){
       -(
log(factorial(n)/(factorial(N1)*factorial(N2)))-r*lgamma(alpha)-alpha*N1*log(theta1)

-alpha*(r-N1)*log(theta2)+(alpha-1)*sum(log(cc[1:N1]))+(alpha-1)*sum(log(cc[w:r]-tau1+

(theta2/theta1)*tau1))-(1/theta1)*sum(cc[1:N1])-(1/theta2)*sum(cc[w:r]-tau1+(theta2/theta1)*tau1)+

(n-r)*log(1-pgamma((max(cc)-tau1+(theta2/theta1)*tau1)/theta2,alpha,1)))
   }}

H<-hessian(m1, cc)

Thank you and take care.
Laila

	[[alternative HTML version deleted]]


