Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when no minimum found using Laplace fitting #4

Open
fohria opened this issue May 12, 2022 · 1 comment
Open

Error when no minimum found using Laplace fitting #4

fohria opened this issue May 12, 2022 · 1 comment

Comments

@fohria
Copy link

fohria commented May 12, 2022

Thanks for this toolkit, it's straight-forward to use and add your own likelihood functions.

I ran into this error when fitting the included "model_dualRL":

Subject: 27
--- No positive hessian found in spite of 100 initialization.

bad subject 27 ... use liberal tolgrad 0.1000
--- No positive hessian found in spite of 100 initialization.
No minimum found for subject 27
No minimum found, use prior values as individual parameters
Error using double
Conversion to double from cell is not possible.

Error in  ^  (line 44)
        X = double(X);

Error in cbm_lap (line 169)
    Ainvdiag{n}  = diag(A_n^-1);

I think this is due to an error in the cbm_lap.m file (lines 152-162) when using the prior as fitted value when the function can't find a good fit at all. I could fix it and progress by changing the below:

if pconfig.prior_for_bads
    if verbose, fprintf(fid,'No minimum found, use prior values as individual parameters\n'); end
    theta_n   = mu;
    [loglik_n]  = cbm_loggaussian(theta_n',model,prior,dat);
    % A_n       = A;  % old
    A_n       = A{n};  % new
    G_n       = nan(1,d);
else
    cbm     = sprintf(fid,'No minimum found for subject %02d\n',n);
    success = 0;
    return;
end

CBM has worked well until now, but perhaps I've not encountered cases before when the fit is so bad it has to use the prior? It could also be I've just done something wrong on my end :)

@marcosfeng
Copy link

marcosfeng commented Oct 5, 2023

Had the same problem and changed this line too. Some models just couldn't fit some participants...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants