Hey,
I have asked this question already but I didn't get it to work even though I had some advice…
Here is an example from Matlab's documentation:
load('fisheriris');y = species;X = meas;cp = cvpartition(y,'k',10); % Stratified cross-validation
classf = @(XTRAIN, ytrain,XTEST)(classify(XTEST,XTRAIN,...ytrain));cvMCR = crossval('mcr',X,y,'predfun',classf,'partition',cp)cvMCR = 0.0200
How can I do this same with the ar-function? Can someone show me the ACTUAL code? I tried this using ar, but I only got different kind of errors…would save a lot of time if someone would just show the code.
I have a vector of values such as:
temperatureData =
-1,4 -0,95 -0,47 -0,16 0,15 0,4 0,34 0,42 0,48 0,56 0,73 0,78 0,86 1,06 1,19 1,3 1,41 1,25 1,17 1,14 0,92 1,3 1,17 1,22 1,25 1,49 1,63 1,84 1,95 1,87 1,95 2,06 2,14
I have created the AR-model doing this:
ar(temperatureData, orderOfModel)
Now I would just need to cross validate the model with the same data. Any examples?
Best Answer