Project 47: Standard Error of Slope

yi = the y-value for the point with index i

xi = the x-value for the point with index i

ŷi = the predicted y-value for the point with index i

= the mean value for the x-values


Example:

x = [1, 3, 5]

y = [5, 7, 12]

xbar = 3

LSRL: y = 1.75x + 2.75

predicted ys = 1.75(1) + 2.75, 1.75(3) + 2.75, 1.75(5) + 2.75 = 4.5, 8, 11.5

residuals = .5, -1, .5

sum of squared residuals = .25 + 1 + .25 = 1.5

differences from xbar = -2, 0, 2

sum of squared differences from xbar = 4 + 0 + 4 = 8

seSlope = sqrt(1/1*1.5/8) = .433

Project 47: Variables 'x' and 'y' have been initialized.  There are also working methods called getAverage and residual.

x and y represent the x and y values in the dataset.

getAverage(data) returns the average of data

residual(x, y, index) returns the residual for the point with index given

Example: If x = [1, 3, 5] and y = [5, 7, 12] then residual(x, y, 2) returns .5 because the residual for the point (5,12) is .5.

Task: Appropriately initialize the value of 'seSlope' that represents the standard error of the slope (or the approximate standard deviation of the sampling distribution of sample slopes)

**If your code works for 5 test cases, you can enter your e-mail address

Universal Computational Math Methods:

pow(5,2) returns 25.0

abs(-3.0) returns 3

sqrt(49.0) returns 7.0