Hi all, 
       Thanks to the suggestion from Nikhil to use vector parameters, I
have made some progress with my MLE code. I have however encountered
another problem with the optimization step. The code is as follows: 
 
 est.x<-as.vector(tapply(Diff_A1c_6_0,factor(Study_Compound_ID),mean))
 ll<-
function(mu=est.x,a=0,b=1.2,tau=rep(0.5,24),sigma=rep(0.5,24),ro=rep(0.7
,24))
    { if (min(tau)>0 && min(sigma)>0 && min(ro)>-1 && max(ro)<1)
          {llsm<-0
           for (i in 1:24)
           llsm <-
llsm-sum(dmnorm(as.matrix(subset(A1c_data_all,Study_Compound_ID==levels(
factor(Study_Compound_ID))[i],select=c(Diff_A1c_6_0,Diff_A1c_12_0))),c(m
u[i],a+b*mu[i]),matrix(c(tau[i]^2,ro[i]*tau[i]*sigma[i],ro[i]*tau[i]*sig
ma[i],sigma[i]^2),nrow=2),log=T))
           return(llsm)
            }  
     else NA
    }
fit<-mle(ll) 
 
Then I get the following error message: 
 
Error in optim(start, f, method = method, hessian = TRUE, ...) : 
  (list) object cannot be coerced to type 'double' 
 
The function itself works fine when I applied various values of
parameters to it, i.e. it does output the negative log-likelihood given
the parameters. There also was a short dicussion about it a few years
ago on this mailing list, but no final resolution was reached for it.
 
Yue
 
Notice:  This e-mail message, together with any attachme...{{dropped:14}}

