Standard deviation between two vector

Hi there,
Can anybody help me to find out standard deviation between two vector? first vector shows data points and other vector shows fitting curve for it. I want to see based on std which curve fitting function has best fit
68.3306790117463 68.0583000000000
69.7661166036220 69.7895000000000
72.1123677003504 71.5207000000000
73.0939315719700 73.2519000000000
73.9225823385832 74.9831000000000
76.4566931111904 76.7143000000000
77.5042095769199 78.4455000000000
78.8703468364576 80.1767000000000
81.7629172086221 81.9079000000000
84.5119789972035 83.6391000000000
85.6904259495530 85.3703000000000
86.9839371938436 87.1015000000000
88.1731382924858 88.8327000000000
88.5525994121150 90.5639000000000
93.3274107768681 92.2951000000000
94.3898044222140 94.0263000000000
96.4532553644749 95.7575000000000
98.6474654885060 97.4887000000000
99.9741525141648 99.2199000000000
101.980636557984 100.951100000000
104.675296906708 102.682300000000
106.750596607465 104.413500000000
106.199133595364 106.144700000000
108.657750373732 107.875900000000
109.234571173461 109.607100000000
109.976002830055 111.338300000000
111.845164723014 113.069500000000
114.282169520428 114.800700000000
114.789373580927 116.531900000000
117.538189964372 118.263100000000
119.854576650875 119.994300000000
122.247310933277 121.725500000000
Thank you in advance to all

 Accepted Answer

I suspect that what you want are confidence intervals for the fitted regression line, since ‘standard deviation’ does not make sense in this context. Without the independent variable (x) data, it is not possible for me to do it.
With your original (x,y) data, use the fitlm function to repeat the fit, then use the predict function to create the confidence intervals. Plotting the confidence limits as lines is then straightforward. You can also use the errorbar function to plot the error bars at each point on the regression line as an alternative.

6 Comments

Hello Star,
thank you very much... you are always there to help ....I really appreciated. yes i want to find confidence interval also errorbar. I do not know but i can process. Could you please give me one example then i will follow same for my further data set also. here is my x data:
function which i have used: y=ax+b where a,b=0.8656 7.4663 with leastsquarefit
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
100
102
104
106
108
110
112
114
116
118
120
122
124
126
128
130
132
I read the link which have given in your explanaion. I have one small question: my models are already ready with different mathematical functions. I want to check which function is more suitable. I can not use fitlm again to generate mdl and then check the confidence interval. Here my supervisior suggest me to check with std. suppose:
i have two mathematical functions which i have fitted on the data:
one model has: std for measurement data=0.1822 ; std of fitted curve= 0.1834
similarly with another mathematical function std=0.1934 .
Now here i do not know how i can select which one is better?
This works:
Data = [ 70 68.3306790117463
72 69.766116603622
74 72.1123677003504
76 73.09393157197
78 73.9225823385832
80 76.4566931111904
82 77.5042095769199
84 78.8703468364576
86 81.7629172086221
88 84.5119789972035
90 85.690425949553
92 86.9839371938436
94 88.1731382924858
96 88.552599412115
98 93.3274107768681
100 94.389804422214
102 96.4532553644749
104 98.647465488506
106 99.9741525141648
108 101.980636557984
110 104.675296906708
112 106.750596607465
114 106.199133595364
116 108.657750373732
118 109.234571173461
120 109.976002830055
122 111.845164723014
124 114.282169520428
126 114.789373580927
128 117.538189964372
130 119.854576650875
132 122.247310933277];
model = fitlm(Data(:,1), Data(:,2), 'linear');
[ypred,yci] = predict(model, Data(:,1));
figure
plot(Data(:,1), Data(:,2), '.')
hold on
plot(Data(:,1), ypred, '-r')
plot(Data(:,1), yci(:,1), '-g')
plot(Data(:,1), yci(:,2), '-g')
hold off
grid
legend('Data', 'Linear Fit', '95% Confidence Limits', 'Location','SE')
Add the title and appropriate xlabel and ylabel strings.
Thank you very very much
As always, my pleasure!
Hello Star,
Could you please help me for the following problem? Thank you very very very much in advance

Sign in to comment.

More Answers (0)

Categories

Products

Asked:

on 17 Dec 2019

Commented:

on 18 Dec 2019

Community Treasure Hunt

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

Start Hunting!