Borrar filtros
Borrar filtros

How to make intercept 0 in fitlm?

25 visualizaciones (últimos 30 días)
Kash Costello
Kash Costello el 12 de Jun. de 2018
Comentada: Kash Costello el 13 de Jun. de 2018
Hello,
i have this code here. I got my result for this code but I want the intercept to be 0. Does anyone know how to do that?
A = [3 ; 6 ; 9 ; 12 ; 15 ; 18 ; 21 ; 24];
b = [13.65249633; 27.43151638; 40.81176096; 54.58291934; 69.15880849; 82.02503856; 95.68163465; 1.10E+02];
mdl = fitlm(A,b,'linear','RobustOpts','off')
Result: Estimate SE tStat pValue
______ ______ ______ ________
(Intercept) -0.14799 0.27475 -0.53862 0.60954
x1 4.579 0.018137 252.47 2.6057e-13
is it possible to make the Estimated intercept 0? I am pretty sure that the estimated x1 will change in value and that's actually what I'm aiming for...
Thanks a lot!

Respuesta aceptada

Rik
Rik el 12 de Jun. de 2018
If you just want the value for x1:
A = [3 ; 6 ; 9 ; 12 ; 15 ; 18 ; 21 ; 24];
b = [13.65249633; 27.43151638; 40.81176096; 54.58291934;...
69.15880849; 82.02503856; 95.68163465; 1.10E+02];
x1=A\b;
If you want to force the intercept to 0, you can find the solution in the fitlm doc:
mdl = fitlm(A,b,'linear','Intercept',false)%'RobustOpts','off' is the default

Más respuestas (0)

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by