Stats413 Homework 10

Due Date: Apr 21, 5pm.
Answer all questions. Show all work.

a）考虑拟合以下逻辑回归模型：
logit（P（Y = 1 | X））= — 0 + —1X1

b）考虑拟合空逻辑回归模型：
logit（P（Y = 1 | X））= -0

（提示：请谨慎对待信号。qni= 1 yi是什么，它与阳性结果的估计概率（相反，与阴性结果的估计概率）有何关系？exp（-ˆ0）应该有一个不错的选择。和明显的解释。）

chickenwtsub <-cockwts [chickwts \$ feed ==“亚麻仁” | chickenwts \$ feed ==“向日葵”，]
chickenwtsub \$ sunflower <-as.numeric（chickwtsub \$ feed ==“ sunflower”）

a）手动（不在R中）计算至少5个阈值的真实正率和真实负率，这些阈值之间的距离介于0和1之间（不包括0或1，它们为每个模型提供相同的TPR和TNR）。

b）手动（不在R中）使用您的5个阈值以及阈值0和1.绘制ROC曲线。

c）哪个阈值（您选择的5个阈值）提供了最佳分类？

1个

d（d）

a）推导-从权重为dW的加权最小二乘得出w，其中d为某个非零常数。表演

d（d）— -w和-w之间的关系。

C）

b）从权重为W + c的加权最小二乘法推导得到-w，其中c为某个非零常数。表演

c（c）ˆ“ w” = 1—w。

Question 1

1. a)  Consider fitting the following logistic regression model:
logit(P(Y =1|X))=0 +1X1

In class we derived an interpretation of ˆ1 in terms of increasing X1 by 1.
Generalize this. That is, finish this interpretation by deriving the associated change in
Y when X1

changes by an arbitrary constant c:
If
X1 were to change by c, we would predict that the odds of a positive outcome would . . .

2. b)  Consider fitting a null logistic regression model:
logit(P (Y = 1|X)) = 0

It turns out that we do have a closed form solution for the MLE estimate of 0. Derive and provide an interpretation for ˆ0.

(Hints: Be careful with signs. What is qni=1 yi and how does it relate to the estimated probability of a positive outcome (and conversly, to the estimated probability of a negative outcome)? exp(ˆ0) should have a nice and obvious interpretation.)

Question 2

The data set “chickwts” records an experiment comparing the eect of dierent feeds on chicken weight. Let’s reverse that and see whether we can predict which feed a particular chicken recieved. We’ll focus on only two feeds, linseed and sunflower, and the following code will help you create a data set with only those two feeds and with a proper dummy variable.

```data(chickwts)
chickwtsub <- chickwts[chickwts\$feed == "linseed" | chickwts\$feed == "sunflower",]
chickwtsub\$sunflower <- as.numeric(chickwtsub\$feed == "sunflower")
```

Fit a model predicting feed type based upon weight. Generate the predicted probabilities for each observa- tions. (You do not have to include this output in your submission.) From this output, address the questions below.

1. a)  Manually, (not in R) calculate the true positive rate and true negative rate for at least 5 thresholds well spaced between 0 and 1 (not including 0 or 1 which provide identical TPR and TNR for every model).
2. b)  Manually (not in R) draw the ROC curve using your 5 thresholds, as well as thresholds 0 and 1.
3. c)  Which threshold (of the 5 your chose) provides best classification?

1

Question 3

Let’s investigate how transformations of weights aect the estimated coecients in weighted least squares. Let ˆw be the vector of estimates weights from weighted least squares with weights W.

ˆ(d)

1. a)  Derive w from weighted least squares with weights dW where d is some non-zero constant. Show

ˆ(d) ˆ the relationship between w and w.

ˆ(c)

2. b)  Derive w from weighted least squares with weights W + c where c is some non-zero constant. Show

ˆ(c) ˆ that w = 1w.

Question 4

Consider the following plot. X and Y are continuous variables, and G is binary.

 1 3 2

10

5

0

5

2 0 2 4 6

x

G

0 1

1. a)  Design a model to predict Y . Write down the conditional expectation of Y .
2. b)  There are three labeled points (the triangles). The color of each matches group membership. For each

point, is it a problematic outlier, an outlier, or neither? Defend your decision. EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!

E-mail: easydue@outlook.com  微信:easydue

EasyDue™是一个服务全球中国留学生的专业代写公司