G0043 : Not implemented for complex matrices in library maxlikmt

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);
        if data[i,8] == 0;
            log_sum = log_sum + log(1-tempfunc);
    // declaring the model results structure
    struct modelResults mm;
    mm.function = log_sum;

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!

1 Answer


The problem is most likely that you are passing a negative number to either sqrt or log.

Passing a negative number will return a complex output which will then be passed to the cdfn function. cdfn does not accept complex inputs, so it is returning the error.

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy