mle2

7 views
Skip to first unread message

עמית קורנגוט

unread,
Sep 1, 2015, 6:15:58 AM9/1/15
to Israel R User Group
Hi,

I'm trying to find a MLE for the variance of u in the fay-herriot model: y=x*beta+u+e.
I built the likelihood function because I know that y is multivariate-normal distributed but when I use mle2 function on it I get high results for the estimators.
what I do worng?

my code is:

LL=function(sigma_u2_est, beta_est){

  lR=-1/2*log(det(diag(sigma_u2_est+sig_d2_mm,nrow=n_domain, ncol=n_domain)))-1/2*t(y-x*beta_est)%*%solve(diag(sigma_u2_est+sig_d2_mm,nrow=n_domain, ncol=n_domain))%*%(y-x*beta_est)-n_domain/2*log(2*pi)

  return(-lR)

}

 

fit=mle2(minuslogl = LL, start=list(sigma_u2_est=12, beta_est=2), control=list(trace=0,REPORT=5,maxit=10000))



thanks,

Amit

Reply all
Reply to author
Forward
0 new messages