How to get non interger numbers in Wilkinson notation using fitlm
2 views (last 30 days)
Show older comments
Hello,
I am building a linear regression model with fitlm using Wilkinson notation like y ~ x1*(x2^exp+x3^exp) .
Model and notation are working fine as long exp is an integer. Is there a chance to implement numbers like exp=1.5,3.33 etc.?
Thanks
0 Comments
Answers (1)
dpb
on 20 Aug 2021
Can't be done with Wilkinson notation -- it only includes integral powers. In this regard, note that "The * operator (for interactions) and the ^ operator (for power and exponents) automatically include all lower-order terms. For example, if you specify x^3, the model will automatically include x3, x2, and x. If you want to exclude certain variables from the model, use the – operator to remove the unwanted terms." which goes to explain why.
You'll have to use the terms matrix form although if it will allow the non-integral value (and I'm not sure whether it will or not) or, if the exponent is fixed, transform the variable and fit the transformed variable.
Otherwise, you'll have to use the fit function from the Curve Fitting TB instead of fitlm or build the model X'*X matrix and use the backslash operator in base MATLAB.
0 Comments
See Also
Categories
Find more on Dimensionality Reduction and Feature Extraction 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!