Dear all,
I have a problem when I try to use maxlikmt to estimate parameters. here is the function:
proc (1) = lfn(theta, data, ind);
local mu_redesign, mu_revise, mu_both, sigma2_redesign, sigma2_revise, sigma2_both, log_sum, tempfunc;
// extracting parameters
mu_redesign = theta[1];
mu_revise = theta[2];
mu_both = theta[3];
sigma2_redesign = theta[4];
sigma2_revise = theta[5];
sigma2_both = theta[6];
//defining the component of log-likehood
log_sum = 0;
for i (1, rows(data), 1);
tempfunc = 1;
for j (i - data[i, 9] + 1, i - data[i, 9] + data[i, 10], 1);
tempfunc = tempfunc*cdfn(((data[i,4]-data[j,4])*mu_redesign+(data[i,5]-data[j,5])*mu_revise+(data[i,6]-data[j,6])*mu_both)/sqrt(2+(data[i,4]+data[j,4])*sigma2_redesign+(data[i,5]+data[j,5])*sigma2_revise+(data[i,6]+data[j,6])*sigma2_both));
if data[i,8] == 1;
log_sum = log_sum + log(tempfunc);
endif;
if data[i,8] == 0;
log_sum = log_sum + log(1-tempfunc);
endif;
endfor;
endfor;
// declaring the model results structure
struct modelResults mm;
mm.function = log_sum;
retp(mm);
endp;
I create two temp variables ("log_sum" and "tempfunc") to contain the piece of likelihood, the problem is in the line inside the j
loop, and it says "G0043 : Not implemented for complex matrices"
Could you help me to fix it?
Many Thanks!