Error using eval Undefined function 'function' for input arguments of type 'double'.
Show older comments
Hi everyone,
When I try to run the following lines of code I keep getting the error that the function is undefined for input arguments of type 'double'. I have read online that this can be caused by a licensing issue with the package or that the directory is not correct. However, neither of these issues are the case here. What else can cause this error? Thanks in advance!
CODE:
% VaR Evaluation w/o mean
forecastdata = dataf(T+1:N-22+1,1);
eval(['forecastdata',num2str(jj),' = dataf(',num2str(T),'+',num2str(jj),':',num2str(N),'-22+',num2str(jj),');']);
eval(['TT',num2str(jj),' =size(forecastdata',num2str(jj),');']);
eval(['[LRPF95',num2str(jj),',LRPF95pv',num2str(jj),',LRPF99',num2str(jj),',LRPF99pv',num2str(jj),',LRind95',num2str(jj),',LRind95pv',num2str(jj),',LRind99',num2str(jj),',LRind99pv',num2str(jj),',LRcc95',num2str(jj),',LRcc95pv',num2str(jj),',LRcc99',num2str(jj),',LRcc99pv',num2str(jj),',TUFF95',num2str(jj),',TUFF99',num2str(jj),',PF95',num2str(jj),',PF99',num2str(jj),'] = VaRLRtest(forecastdata',num2str(jj),',VaR95',num2str(jj),',VaR99',num2str(jj),');']);
eval(['[RLF95',num2str(jj),',FLF95',num2str(jj),',RLF99',num2str(jj),',FLF99',num2str(jj),'] = VaRLossFUN(forecastdata',num2str(jj),',VaR95',num2str(jj),',VaR99',num2str(jj),');']);
ERROR:
Error using eval
Undefined function 'VaRLRtest' for input arguments of type 'double'.
Error in var_oos_evaluation (line 137)
15 Comments
Walter Roberson
on 5 Jun 2021
If a software package forces you to write code that way, then you are better off without that software.
I was not able to locate any software package that matches what you are doing. I found one PUDN contribution that I cannot reach at the moment, that gave a name that I searched on and that in turn hinted that just maybe this has to do with code that was in Studies in Nonlinear Dynamics & Econometrics from 1996; https://sites.google.com/site/jurimarcucci/publications/hints-for-mrsgarch-program
Deegan Huisman
on 5 Jun 2021
Edited: Deegan Huisman
on 5 Jun 2021
Walter Roberson
on 5 Jun 2021
If you get the zip from https://sites.google.com/site/jurimarcucci/snde1145_supplementary_1.zip?attredirects=0 then that expands to a directory Marcucci_Programs_and_Data which has several files inside it, including VaRLRtest.m
Please confirm that that directory is on your MATLAB path. You can use MATLAB's pathtool to add it to your path.
Deegan Huisman
on 5 Jun 2021
dpb
on 5 Jun 2021
And, if you didn't already know, now you do why Walter's first comment! :)
Set a breakpoint at the offending line and inspect the content of the string being passed to eval to make sure it is what looks to be reasonable (probably).
See what the working path is when running the code and various diagnostics in that context like
which -all VaRLRtest
etc., to see what is returned. Is there some licensing agreement that goes with this code, perchance, that you haven't downloaded?
If you can run the function interactively, then it is something to do with the built command; if you can't get to the function at command line, then it has to do with install issues of some sort.
Walter Roberson
on 5 Jun 2021
First I had to fix mrsgarchestfor_con_all -- change a size(x0) to size(x0,1), and comment out a couple of the optimset lines for options no longer supported.
I am waiting for that to finish running before I can see which other functions I need to execute in order to create the files needed for var_oos_evaluation to run (it needs a .mat that another function creates, and that other function needs files that other functions create, and ...)
"What else can cause this error?"
Throw that code in the binary-bin where it belongs.
Deegan Huisman
on 6 Jun 2021
dpb
on 6 Jun 2021
Well, I'd suggest don't wait on Walter to solve your problems for you... :)
He gave you the road map to where issues lie, pick up and run with it.
When pick up a piece of code like that is, whether it's worth the effort to debug it or just write the needed functionality is often a hard choice. If the original author has orphaned it weighs a decision weighted to the latter in my view.
Walter Roberson
on 6 Jun 2021
I am having to repair multiple places in the code as I go, and each run takes several hours. And then it fails a different way and I have to run for hours again. I also have no guidance about which programs have to be run in which order so that all the needed files get created. It would help if you told us the specific sequence of programs to run.
Deegan Huisman
on 6 Jun 2021
Deegan Huisman
on 6 Jun 2021
Stephen23
on 7 Jun 2021
@Deegan Huisman: given how badly-written that code is, you are likely to save time by writing the functionality yourself.
Walter Roberson
on 7 Jun 2021
(Note: we have been gardening this weekend, so response is delayed)
Deegan Huisman
on 7 Jun 2021
Answers (0)
Categories
Find more on Word games in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!