How do you format the function 'pcrsse' required for crossval?

5 views (last 30 days)
Hi,
I am working through the example "Partial Least Squares Regression and Principal Components Regression" provided in the Mathworks Help Center. I have reached the part discussing cross validation as a method to determine the necessary number of principle components.
The instructions say it is necessary to calculate the mean squared prediction error (MSEP) for the principle component regression (PCR) using the function 'crossval.' In order to do this, you must make a function to determine the sum of squared error for PCR, but they do not give the code for this function only the name 'pcrsse.' However, inserting a function into crossval requires tricky formatting, I have also tried to follow the help file on 'crossval' with no success. Will someone please look at this example in the Help Center and help me develop this 'pcrsse' function? Many thanks.
Frederik
  2 Comments
Asvin Kumar
Asvin Kumar on 9 Jun 2020
Can you provide details on what you've tried so far and what issues you ran into while following the help file on crossval?
Frederik Schmidt
Frederik Schmidt on 10 Jun 2020
Thanks for your willingness to help, but actually the problem has already been resolved. I only had to enter a larger amount of data for the 10-fold cross-validation to work. And obviously the function '@pcrsse' is provided by Matlab and automatically called when requested in the function call.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!