# correlation and fitting line to a data set with standard error

3 Ansichten (letzte 30 Tage)
karlo gonzales am 12 Nov. 2012
Dear friends,
suppose we have a set of data as
X=x1,x2,x3,x4,.......x26 , Y= y1+/-a , y2+/- b, y3+/-c ........, y26+/-z (a..z are standard error for each value of yi )
would you tell me 1- how can we find the correlation between X, Y, 2- how can we fit a line/curve to these data
thanks
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Star Strider am 12 Nov. 2012
It's easy to convert the standard errors ( SE ) into inverse-variance weights:
Wgt = 1./(N.*SE.^2);
where N are the number of observations used to calculate each SE. They are usually the same for all but can vary, so this allows N to be a vector of the same size as SE.
1. This File Exchange routine calculates a Weighted Correlation Matrix.
2. Weighted Nonlinear Regression is easy enough to do (in 2012a and later). In 2011 and earlier versions, it is a bit more complicated but definitely possible. (See this Weighted Nonlinear Regression Demo for details.) If you want to do linear regression, all you have to do is specify a linear model.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

karlo gonzales am 12 Nov. 2012
thank you so much "Star Strider" for your hints!
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Star Strider am 12 Nov. 2012
It is my pleasure!

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Linear 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!

Translated by