Constrained polynomial regression with the constraint in coefficient

5 ビュー (過去 30 日間)
David Smalenberger
David Smalenberger 2020 年 4 月 4 日
編集済み: John D'Errico 2020 年 4 月 4 日
Greetings,
I have a data set and I wish to fit the data to the function of the form:
y =
where Matlab determines α to minimize the error between the data set and the line. I have seen other constrained polynomial regression that has a specific functional form but not a constraint on the coefficient as I propose. Thoughts?
  2 件のコメント
Torsten
Torsten 2020 年 4 月 4 日
Try lsqcurvefit.
Ameer Hamza
Ameer Hamza 2020 年 4 月 4 日
What are the constraints on α?

サインインしてコメントする。

回答 (1 件)

John D'Errico
John D'Errico 2020 年 4 月 4 日
編集済み: John D'Errico 2020 年 4 月 4 日
You are trying to estimate alpha, given a set of data points in the form of (x,y) pairs? Where alpha enters into BOTH coefficients, even though the model is linear in x?
This is not really a constrained polynomial regression in my view, except that you can see it as a linear polynomial regression, EXCEPT that the coefficients in the polynomial are nonlinearly related. So I suppose you can view this as a constrained regression in that context.
Simplest is to use the curve fitting toolbox. I lack your data, so I'll need to make some up. I'll pick an arbitrary value for alpha.
alpha0 = 1.5;
x = rand(20,1);
y = log(alpha0) + (alpha0-1)*x + rand(size(x))/10;
ft = fittype('log(alpha) + (alpha-1)*x','indep','x')
ft =
General model:
ft(alpha,x) = log(alpha) + (alpha-1)*x
mdl = fit(x,y,ft)
mdl =
General model:
mdl(x) = log(alpha) + (alpha-1)*x
Coefficients (with 95% confidence bounds):
alpha = 1.538 (1.525, 1.551)
plot(mdl)
hold on
plot(x,y,'bo')
We could do this using other tools, such as nlinfit from the stats toolbox, lsqnonlin or lsqcurvefit from the optimmization toolbox. Lacking any toolbox, even fminseach or fminbnd would suffice. Fit is nice, because it is easy to use, and because it gives you confidence informtion on the parameters.
But, as you can see, it is really pretty easy to use fminbnd here too.
obj = @(alph) sum((y - (log(alph) + (alph-1)*x)).^2)
obj =
function_handle with value:
@(alph)sum((y-(log(alph)+(alph-1)*x)).^2)
fminbnd(obj,.05,5)
ans =
1.53823485565892

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by