Anda di halaman 1dari 2

STAT 420

2GR, 2UG, 3GR, 3UG

Fall 2016
A. Stepanov

Homework #2
(due Friday, September 9, by 3:00 p.m.)

Please include your name ( with your last name underlined ),


and your NetID at the top of the first page.

No credit will be given without supporting work.

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:

> stepanov = function(a,n) { }


b)

Use your function from part (a) with


(i)

2.

a = 3, n = 4;

(ii)

a = 5, n = 7.

Do NOT use a computer for this problem.


A marketing firm wishes to determine whether or not there is a relationship between
the number of television commercials broadcast, x, and the sales of its product, Y,

( 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)

What proportion of observed variation in sales is explained by a straight-line


relationship with the number of commercials broadcast?

3.

Do use a computer for this problem.


Use the data from Problem 2. Find the equation of the least-squares regression line.
Create a scatterplot and add the least-squares regression line to it.

4.

Sometimes it is known in advance that the least-squares regression line must go


through the origin, i.e., the regression model is of the form

Yi = xi + i ,

where is are i.i.d. N ( 0, 2 ),

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

Consider the model

Y i = x i + i , where is are i.i.d. N ( 0, 2 ).

a)

Find the least-squares estimate .

b)

Calculate the residuals e i . Does the sum of the residuals equal zero?

c)

Use a computer to find . To fit a model without the y-intercept, use


> lm(y ~ x + 0)

Hint: Use the answer to problem 4.

or

> lm(y ~ x - 1)

Create a scatterplot and add the least-squares regression line y = x to it.


Hint:

abline(

y-intercept

slope

Anda mungkin juga menyukai