I am wondering how I can extract a resulting fitting equation from Matlab's regressionLearner (version R2017b)? I am using the linear regression with quadratic terms to fit the variable "C" as a function the variables "H2O", "CO2" and "P". I have exported the compact model into my workspace:

When I open the structure and click on "LinearModel", I find the supposedly used equation form under "Formula" as

LinearPredictor '1 + H2O*CO2 + H2O*P + CO2*P + H2O^2 + CO2^2 + P^2'

This formula has 7 terms. However, under "TermNames" 10 terms are listed, and under coefficients I find estimates for each of these terms, including standard error SE, tStat and pValue.

How do these ten terms relate to the seven terms in the LinearPredictor equation above? The LinearPredictor equation is missing terms with only H2O, CO2, and P, and instead of H2O:P it contains H2O*P etc. Are these supposed to be the same? Is this even the best way to extract a polynomial equation from the regressionLearner?

## Best Answer