Gpfit error on line 74. Not even working with the given matlab example.

조회 수: 1 (최근 30일)
mashtine
mashtine 2016년 3월 21일
댓글: hdrees 2017년 1월 17일
Hi there,
It appears that upgrading matlab to 2016a made no difference to my problem and once again, I cannot even perform the matlab example using the gpfit function. I get the following error when using the Matlab code online:
y =
0.0017 7.2773
Operands to the || and && operators must be convertible to
logical scalar values.
Error in gpfit (line 74)
if n == 0 || ~isfinite(rangex)
and the function keeps spitting y out as the minimum and maximum (rangex). My data is too big to attach and I do not think it is worth it to scale down as it is really just a matrix of wind speeds. No Nans no Infs.
When I add a breakpoint to the gpfit code, I can see that n is scalar 1x1 so I am pretty confused!
Any ideas?
Thanks!
  댓글 수: 1
hdrees
hdrees 2017년 1월 17일
You shouldn't bother with fixing the error: gpfit usually gives nonsensical output even for nice data sets, e.g. k less than -1 although the likelihood function is unbounded for k<-1 (i.e. an MLE cannot exist on this range).
The function mle with 'distribution' equal to 'gp' works slightly better, but often gives values far off the true MLE, too. (To check, just compare the output with the one obtained from some reliable R package or plot the likelihood function and determine its maximum "manually".) So, unfortunately, so far MTALAB does not offer any reliable ML estimate for GPD data.

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

답변 (1개)

Steven Lord
Steven Lord 2016년 3월 21일
What size is rangex when you reach that line?
Are you sure you're calling the ISFINITE function included with MATLAB on that line? How about the NOT function, which is the function form of the operator "~"? Check each:
which -all isfinite
which -all not
  댓글 수: 5
Walter Roberson
Walter Roberson 2016년 3월 22일
The example does not use wind speed, it creates a random value it looks to me.
What is size() of the array you are passing in? Not the approximate number of elements, the size(). I am examining the hypothesis that the shape of the input matters.
mashtine
mashtine 2016년 3월 22일
Hi Walter,
It is a vector of m x 1. I tried passing it as a vector of 1 x m and that made no difference. I think I am confusing you. When I copy and paste the matlab example into matlab it still doesn't work and thus it has nothing to do with me passing wind speed.

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

Community Treasure Hunt

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

Start Hunting!

Translated by