How do I extract a polynomial equation from regressionLearner?

조회 수: 10 (최근 30일)
Jule
Jule 2020년 10월 7일
답변: Jule 2020년 10월 7일
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?

채택된 답변

Jule
Jule 2020년 10월 7일
Okay, a few tests later I figured it out - for anyone else wondering about a similar problem, forget about the equation in linearPredictor!
In this case, your equation would look like this:
A(H2O,CO2,P) = coeff(1) + coeff(2)*H2O + coeff(3)*CO2 + coeff(4)*P + coeff(5)*H2O*CO2 + coeff(6)*H2O*P + coeff(7)*CO2*P + coeff(8)*H2O^2 + coeff(9)*CO2^2 + coeff(10)*P^2
with coeff being the different values for each term from column 1 ("estimate") in the coefficients category.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dynamic System Models에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by