Polyfit and parameter uncertainty
    4 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Niles Martinsen
      
 am 22 Jun. 2012
  
    
    
    
    
    Kommentiert: Kamal Gurnani
 am 28 Feb. 2019
            Hi
I have some data (x, y), where y is proportional to x. I want to find the relationship, so I fit a function of the form f(x) = a*x+b to the data. This is how I do it:
p_RvsT = polyfit(r_vs_t(:, 1), r_vs_t(:, 2), 1);
Now this gives me a good estimate of a and b. What I want now is to find the uncertainty (= standard deviation) on the estimated values of a and b. I have found an older thread ( http://www.mathworks.com/matlabcentral/newsreader/view_thread/59468), which uses this technique:
       x=1:100:10000;
     y=x+.1*x.*(rand(size(x))-.5);
     [p,s]=polyfit(x,y,1);
     [yh,d]=polyval(p,x,s);
     % show results
     line(x,y);
     line(x,[yh;yh-d;yh+d],'color',[1 0 0]);
My question is if this is the correct way to do so?
Best,
Niles.
0 Kommentare
Akzeptierte Antwort
  Walter Roberson
      
      
 am 22 Jun. 2012
        Yes.
2 Kommentare
  Kamal Gurnani
 am 28 Feb. 2019
				But the d-values are the prediction intervals for y, I still can not see the uncertainities in the coefficients.   
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


