﻿ 统计代写 | STA 142A: Homework 1

### 統計代寫 | STA 142A: Homework 1 ### 統計代寫 | STA 142A: Homework 1

STA 142A: Homework 1

1. Question 4 in page 120 of the textbook. (Note: this is an open ended question).
2. Linear regression simulation. Consider the linear regression model
yi = β0 + β1xi + i
, i = 1, . . . , n,
where β0 = 5, β1 = 3 and i ～ N(0, 1) and xi ～ Uniform(0, 1).
(a) Generate n = 100 data points (xi
, yi) from the above model. Plot the data. Fit a
linear regression line model using python and add the fitted line to the plot. You
could use the LinearRegression() function from Scikit learn package. See documentation at
model.LinearRegression.html
(b) Repeat the experiment in part (a) for 1000 times (without plotting). Note that you will
get different estimates of β1. Denote them as β?
(1)
1
, β?
(2)
1
, . . . , β?
(1000)
1
. What is the mean
of these values ? Plot a histogram of β?
(1)
1
, β?
(2)
1
, . . . , β?
(1000)
1
.
(c) Repeat (b) but now with i being a standard Cauchy distribution. How does the
histogram change ? Specifically, comment about the tails of histogram. (Note: Here,
you are still using least-squares linear regression. Only the data generating
process is changed.)
3. Question 6 in page 170 of the textbook.
4. Bayes Classifier-I. Suppose that Y ∈ {0, 1} and P(Y = 1) = 1/2. The distribution of
X|Y = 0 is discrete and is specified by
P (X = 1|Y = 0) = 1/3 P (X = 2|Y = 0) = 2/3.
The distribution of X|Y = 1 is discrete and is given by
P (X = 2|Y = 1) = 1/3 P (X = 3|Y = 1) = 2/3.
Find the Bayes Classifier (also called as Bayes optimal classification rule).
5. Bayes Classifier-II Let X ∈ R correspond to input data and Y ∈ {+1, ?1} correspond
to binary labels. Suppose we assume the following model for the conditional probability of
Y = 1 given X = x
P(Y = +1|X = x) =
?
??
??
0, if x < 0
x, if 0 ≤ x < 1
1, if x ≥ 1
1
Let f be a classifier and consider the loss function defined as follows:
`(f(X), Y ) = 1{f(X)6=Y } =
(
1 if f(X) 6= Y
0 f(X) = Y
What is the decision boundary (value of x) that minimizes the risk? Now suppose we assume
the following model for the conditional probability of Y = 1 given X = x
P(Y = +1|X = x) =
?
??
??
0, if x < 0
x
2
, if 0 ≤ x < 1
1, if x ≥ 1
What is the decision boundary (value of x) that minimizes the risk?

#### 在線客服  Essay_Cheery  