Fall 2016
A. Stepanov
Homework #2
(due Friday, September 9, by 3:00 p.m.)
1.
Recall:
k =0
a)
ak
=ea.
k!
Write your own R function that computes a partial sum of the above infinite series.
The input should be a real number a and a positive integer n, and the output should
be the value of
n ak
a2 a3
an
=
1
+
a
+
+
+
...
+
.
k!
2
6
n
!
k =0
The function should be called yourNetID, where yourNetID is your NetID. For example,
mine would be called stepanov:
2.
a = 3, n = 4;
(ii)
a = 5, n = 7.
( in thousands of dollars ). The data, obtained from 6 different cities, are shown in the
following table:
a)
13
10
10
16
Find the equation of the least-squares regression line. That is, obtain the least-squares
estimates 0 and 1 .
b)
Calculate the residuals e i . Does the sum of the residuals equal zero?
c)
3.
4.
Yi = xi + i ,
i = 1, 2, , n,
and the equation of the regression line is y = x. In this case, finding the
least-squares line reduces to finding the value that minimizes the expression
f ( ) = [ yi xi ] 2 .
i =1
Use the derivative of f with respect to to derive the formula for the slope of
the least-squares regression line in this case.
5.
The data represents the amount of datium y (in grams) obtained from x cubic meters
of datium ore:
10
12
20
24
27
33
37
a)
b)
Calculate the residuals e i . Does the sum of the residuals equal zero?
c)
or
> lm(y ~ x - 1)
abline(
y-intercept
slope