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

2 views (last 30 days)
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 Comment
hdrees
hdrees on 17 Jan 2017
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.

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 21 Mar 2016
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 Comments
Walter Roberson
Walter Roberson on 22 Mar 2016
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 on 22 Mar 2016
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!