Undefined function or variable 'lgamma'.

조회 수: 39 (최근 30일)
NMarco
NMarco 2021년 1월 25일
댓글: Walter Roberson 2021년 2월 8일
Hello experts,
as the title says I have a problem with this undefined 'lgamma'.
I'm trying to run an ANCOVA using the function aoctool() but it stops and throws me that error.
Below I post the entire message:
Undefined function or variable 'lgamma'.
Error in betapdf (line 60)
+ lgamma (a + b) - lgamma (a) - lgamma (b));
Error in betainv (line 87)
h = (betacdf (y_old, a, b) - x) ./ betapdf (y_old, a, b);
Error in finv (line 58)
inv(k) = ((1 ./ betainv (1 - x(k), n/2, m/2) - 1) * n / m);
Error in aoctool>getyvalues (line 777)
crit = sqrt(df1 * finv(1-alpha/bonf, df1, df2));
Error in aoctool (line 335)
[newy, ~, ycov] = getyvalues(allx, allgrps, model, stats, ud);
I'm working on MATLAB R2018b.
Is this related with a MATLAB issue or (most likely) it's just me erroneously defining the ANCOVA variables?
Thank you for your help!
Marco
  댓글 수: 3
Star Strider
Star Strider 2021년 1월 26일
You need to Contact Support .
I opened betapdf.m in the MATLAB editor, and the last line of the function is 58. That line contains a betaln call, and there are no gamma function calls of any kind in the entire function. (I am using R2020b.)
NMarco
NMarco 2021년 1월 26일
@Adam Danz , @Star Strider thank you for your feedback.
The lgamma is from a internal MATLAB code, that's why I'm concerned about this error.
I will contact the support, I guess..
Thanks anyway!

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2021년 1월 26일
I see relevant discussion at https://github.com/wichmann-lab/psignifit/issues/4 . The implications there are that you are picking up a third-party toolbox version of finv that is invoking a third-party betainv that is invoking a third-party betapdf that is asking for lgamma that has not been part of MATLAB for a number of years.
The fix would be to move those that third-party finv (and related) out of your MATLAB path.
By the way, the Mathworks long gamma function is gammaln() these days, and is part of basic MATLAB.
  댓글 수: 4
NMarco
NMarco 2021년 2월 8일
Cannot you use one before or after the other? Like, use SPM and than make calculations using pTFE upon removing that folder from the path.
Walter Roberson
Walter Roberson 2021년 2월 8일
https://miplab.epfl.ch/BrainHack/Practice/Utilities/spm12/external/fieldtrip/external/stats/ shows that lgamma.m is defined in the external/fieldtrip/external/stats directory that is installed with SPM12.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by