Constrained polynomial regression with the constraint in coefficient

4 visualizaciones (últimos 30 días)
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?

Respuestas (1)

John D'Errico
John D'Errico el 4 de Abr. de 2020
Editada: John D'Errico el 4 de Abr. de 2020
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

Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by