Docsity

Notes on Linear Regression - Mechanical Engineering Problem Solving | MECH 102, Study notes of Mechanical Engineering

Toggle sidebar
bg1
a051.137=a0intercept x y,():=
a19.188−10 3−
×=a1slope x y,():=
Using MathCAD's built-in functions:
a051.137=a0y_bar a1x_bar⋅−:=
a19.188−10 3−
×=a1
n
i
xiyi
⋅
∑
⋅
i
xi
i
yi∑
⋅
∑
−
n
i
xi
()
2
∑
⋅
i
xi∑
2
−
:=
y_bar 23.571=y_bar i
yi∑
n
:=x_bar 3 103
×=x_bar i
xi∑
n
:=
Using regression equations:
ya
0a1x⋅+=
Form of regression equation:
i0n1−..:=n7=n length mpg():=
x weight:=weight 2000 2200 2600 2900 3400 3800 4100()
T
:=
y mpg:=mpg 35 30 28 22 18 17 15()
T
:=
Data provided:
Trending vehicle miles-per-gallon versus vehicle weight
Linear Regression Example
pf2

Partial preview of the text

Download Notes on Linear Regression - Mechanical Engineering Problem Solving | MECH 102 and more Study notes Mechanical Engineering in PDF only on Docsity!

a 0

a =51. 0

:=intercept x y( , )

a 1

− 3

a = × 1

:=slope x y( , )

Using MathCAD's built-in functions:

a 0

a =51. 0

y_bar a 1

:= − ⋅x_bar

a 1

− 3

a = × 1

n

i

x

i

y

i

i

x

i

i

y

∑ i

n

i

x

( i)

2

i

x

∑ i

2

y_bar y_bar =23.

i

y

∑ i

n

x_bar 3 10 :=

3

x_bar = ×

i

x

∑ i

n

Using regression equations:

y a 0

a 1

= + ⋅x

Form of regression equation:

n :=length mpg( ) n = 7 i := 0 ..n − 1

weight ( 2000 2200 2600 2900 3400 3800 4100 ) x :=weight

T

:=

mpg ( 35 30 28 22 18 17 15 ) y :=mpg

T

:=

Data provided:

Trending vehicle miles-per-gallon versus vehicle weight

Linear Regression Example

Computing the standard error and the correlation coefficient:

S

t

i

y

i

−y_bar

2

:= S

t

S

r

i

y

i

a 0

a 1

x

i

2

:= S

r

s y_x

S

r

n − 2

:= s y_x

r

S

t

S

r

S

t

:= r =0.

Plotting the original data and the regression line:

f x( ) a 0

a 1

:= + ⋅x

2000 2500 3000 3500 4000 4500

10

15

20

25

30

35

y i

f x i

xi

Now we can estimate a vehicles mpg, given its weight. For example:

weight := 3100

mpg := f weight( ) mpg =22.