cross-validate fitlm

10 views (last 30 days)
Toby Feld
Toby Feld on 8 May 2021
Hello,
I would like to use fitlm to also take non-linear relationships into account.
I have X1 which is a 100 x 3 matrix, predictive variables (for training). X2 is a 50 x 3 matrix, predictive variables (for testing). I have Y1 which is a 100 x 1 matrix, predicted variable (for training). Y2 is a 50 x 1 matrix, predicted variable (for testing).
lm = fitlm(X1,Y1,'quadratic');
This gives me a very complex variable, a "1x1 linear model".
Now how can I use the model lm to cross-validate? I can see that there are estimated coefficients, but there are also coefficients for interactions (e.g., "x1:x2"). I am not sure how to do this, but I want something like "testlm(X2,Y2,'quadratic')".
Thanks,
Tim

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!