95% error value for the slope of a linear regression found using lsline?

7 visualizaciones (últimos 30 días)
Hi there, I'm analyzing data in a scatter plot and need to find the error in the slope the best fit line. I found the best fit line using lsline and then found the value of its slope by looking at the equation with polyfit. I would like to find the +/- value of the slope (M) for my scatter data- what is the best way to do this? Thanks -Brenna
subplot(2,2,[3 4])
%designating range of points to fit
S = 1;
F = 150;
RANGE = ADeltaM (S:F,1);
c2 = linspace(1,10,length(RANGE));
scatter(ADeltaM (S:F,1),NDeltaM (S:F,1),[],c2)
lsline(subplot(2,2,[3 4]))
grid on
xlabel('ARM Lost','fontsize',10)
ylabel('NRM Lost','fontsize',10);
%%Calc Value of slope
h = lsline ;
p = polyfit(get(h,'xdata'),get(h,'ydata'),1);
%get M (value of the slope)
M = p(1,1);

Respuestas (1)

Star Strider
Star Strider el 24 de Jun. de 2016
Use the File Exchange contribution polyparci.

Community Treasure Hunt

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

Start Hunting!

Translated by