Matlab, an error after using fitctree function - matlab

I am trying to construct a decision tree. I tried using the fitctree function and wrote:
ctree = fitctree(TrainingX,TrainingY);
such that TrainingX is the input matrix and TrainingY is the target matrix. An error appears saying that:
Undefined function 'fitctree' for input arguments of type 'double'.
I don't know what is the problem and what should I do to solve it. Could you please help me?

The reason why it is undefined is because fitctree requires the Statistics Toolbox in MATLAB. If you don't have the Statistics Toolbox, you can't use this function and you're SOL. Sorry!
Even with the Statistics Toolbox, fitctree is only available for recent editions of MATLAB (R2014a+). Check the release notes on the Statistics Toolbox for more details: http://www.mathworks.com/help/stats/release-notes.html. Go to where R2014a is and fully expand out all of the facts by clicking on Expand All. Where you see "Functions for classification methods and clustering", you'll see an entry for fitctree there.
The only option would be to upgrade your version of MATLAB to at least R2014a or above.
Good luck!

Related

function evalclusters from Statistics toolbox not found in matlab

I would like to use the function evalclusters from the statistics toolbox in matlab, but matlab is unable to find the function when I call it.
help evalclusters
returns 'evalclusters not found.'
The statistics toolbox is installed [license('test','statistics_toolbox') returns '1'].
Thanks!
evalclusters was added with Matlab 2013b and extended with 2014a, it is not available in Matlab 2013a.
In case upgrading Matlab is not an option, current Octave Statistics package includes it as well. (Open-Source alternative to Matlab which basically uses the same syntax)

Is 'ols' function in Econometrics toolbox in MATLAB?

I am trying to run a code which calls the function OLS. reg=ols(y,X). I am getting an error saying that ols is an undefined function for input of type double. Is ols a function in the econometrics toolbox or do we create a separate ols function? I have checked the working directory and the toolbox is added to the path. I don't know what the problem is.
I don't have ols either and I have the econometrics toolbox. I'm guessing you are looking for some functions in File Exchange, most likely the Toolkit on Econometrics and Economics Teaching.

Workaround for Maple in MATLAB

I am trying to get the MATLAB toolbox SOSTOOLS to work inside a MATLAB R2010b (7.11.0.584) but get the following error:
??? Error using ==> maple at 54 The MAPLE command is not available.
Googling it I found out that MATLAB stopped using Maple at some stage and switched to MuPad.
Short of switching to an older version of MATLAB, is there a known workaround for this situation?
A solution in the form of installing Maple as the symbolic toolbox engine is not possible with your version of Matlab.
This outlines an alternative possible solution, I did not find a concrete workaround that will spare you work. I recommend you contact the authors, or check for octave versions with the same functionality.
The change to MuPad is a problem that's been posted numerous times, and there is a useful discussion of differences between Maple and MuPad here:
http://www.walkingrandomly.com/?p=178
For some commands it looks like a simple translator might work. Most of the implementation would apparently be in parsing the output from MuPad and turning it into what Maple would generate. The input to MuPad and Maple is apparently equal most of the time, but read the doc above.
To write a translator, you redirect calls to maple by placing in your path the following function maple that calls mupad:
function output=maple(input);
%prepare input here (if necessary) ...
output=mupad(input);
% parse the output (if necessary) ...
More likely than not, a naive call to this re-director will not solve the problem without some input/output parsing.

Simulate ARMA process in matlab

I am trying to simulate a time series process using Matlab. For example, let's see the following example:
http://www.mathworks.com/help/econ/arima.print.html
When I run following code
model = arima(1,0,1);
[fit,VarCov] = estimate(model,Y,'print',false);
I get the following error:
??? Undefined function or method 'arima' for input arguments of type 'double'.
Does Matlab contain functions for Matlab? Can I calculate different functions,like calculate autocorrelation or autocovariance at different lag? Or estimate ARMA parameters?
You need to make sure that you have a license and code for the Econometrics Toolbox before using that function. MATLAB has annoying license requirements for both the main software and its various toolboxes :(
But, you may be able to find some public code that can do the same thing. Check out http://www.mathtools.net/

Differencies in Mex-file for Matlab

I have created a Mex-file (.mexw64) from my matlab project using Matlab Coder. The problem is that the output is not the same when I run the mex-file as when I run the project in a normal way. Often the variation in the numbers are really small:
5.4463.. -> 5.4465.. etc.
I'm thinking that there might be a problem related fixed point computations. What should I look for?
Expected differences from MATLAB are explained in the documentation. See the section on Floating-point Numerical results:
MATLAB Coder Documentation on expected differences.