当前位置:天才代写 > 作业代写,留学生作业代写-北美、澳洲、英国等靠谱代写 > Statistics 305a作业代写 统计作业代写

Statistics 305a作业代写 统计作业代写

2021-05-22 11:14 星期六 所属: 作业代写,留学生作业代写-北美、澳洲、英国等靠谱代写 浏览:571

Statistics 305a作业代写

4, due Thursday, Nov 5,2020.

Statistics 305a作业代写
Statistics 305a作业代写

 

Statistics 305a作业代写 Homework 4, due Thursday, Nov 5, 2020.All questions with a bold R next to the question number can be solved ingroups up to size three.

All questions with a bold R next to the question number can be  solved in  groups up to size three. For such groups a single writeup can be turned in, but make sure to indicate who the three are. All datasets used in the homework assignmentscanbefoundoncourseworkinthedirectoryDatasets.

Locally weighted regression.  Statistics 305a作业代写

Often a linear regression is inadequate, and we turn to more flexible forms of regression. One such form is locally weighted regression. Consider the case of a single predictor x, and suppose the model is yf(x) + s, with s(0,σ2). Local linear regression approximates f(x) at x0 by f (x0) = a0 + b0x0, where a0 and b0 are chosen to minimize

1
1

This is known as the tri-cube weight function, invented by John Tukey, and is a rounded form of the uniform weight function. ωis known as the window size or bandwidth. Since x0 is arbitrary, we have an approximation to f at any value of x. Local regression is thought of as a direct way of estimating the regression function f (x) = E(Y |X = x).

1.  Statistics 305a作业代写

Explainin words why local regression makes sense, and why the result- ing function estimate is smooth as a function of x.

2.

Explain the role of ω. What happens as ω approaches 0? As ω ap- proaches ∞ ?

2
2

4. Statistics 305a作业代写

Show that fˆ(x0) = h(x0)Ty where h(x0) is a n vector, and y is the vector of responses, and give an expression for hi(x0).

5.

If the data xi, yiall lie on a straight line, show that fˆ(x0) lies on the same line .

6.

Showthat the bias of fˆ(x0) is f(x0h(x0)Tf, where fif(xi). By expanding each element of fiin a first order Taylor series about xx0,

conclude that to first order

Statistics 305a作业代写
Statistics 305a作业代写

Use this to show that to first order, fˆ(x0) is unbiased.

7.

R In practice we often use ω = ωs(x0), e. a bandwidth thatdepends on the target point x0 and some other tuning parameter s. For the rest of this homework, we will assume the following form for ωs, for s (0, 1], the so-called span. Let k = |s · n, and let x(k) be the kth nearest neighbor among the xito x0. Then ωs(x0) = |x0 x(k)|.

Write an R function llr(x,y,x0,span,hat=FALSE) to compute  the local linear regression fit at x0. If hat=TRUE, your function should return h.

8.  Statistics 305a作业代写

R Apply your function to the prostate cancer data (dat), availableon the Canvas website. Use lpsa as the response, pgg45 as the predictor, and chose span=1/3. Compute the fit at a uniform sequence of values of x0, and superimpose your fit (using lines()) on a plot of the data. Try a few different values of span, and select a good value by eye(what this means is up to you).

9.  Statistics 305a作业代写

RPick 3 values of x0 (one near end of the range of lpsa, and two at random). With span=1/4, produce for each value of x0 a plot showing the weights produced by the weighting function W . Superimpose on each plot the weight vector h, sometimes known as the equivalentker-nel. (For these plots use a three by one layout via par(mfrow=c(3,1)); ideally each plot should be wide and not too tall. )

10.  Statistics 305a作业代写

What might be a more principled way of selecting span? (Just say how; you do not need to implement it.)

11.

Howmight you measure the “effective degrees of freedom” of your local regression fitter .

12.  Statistics 305a作业代写

R Write a wrapper function that uses llr to compute the local-linear regression fit at all the data points. It should return the df of the fit, and optionally the linear operator (hat) matrix that produces the fit. It should estimate the error variance σ2, and for each fitted value, the estimated standard error of the  Augment your plot with upper and lower 2× standard-error bands.

13.  Statistics 305a作业代写

Superimpose on your plot the linear regression  How might you conduct an informal F-test to compare the linear fit with the non- linear? Do it.

14.  

R Create an image plot of the hat matrix (making sure the rows are order by increasing value of pgg45. What do youobserve?

15.  Statistics 305a作业代写

R The dataset SA csv is available on the Canvas site. These  are data on the occurrence of heart attacks in a farming community in South Africa. Read it in using read.csv() and plot the binary response chd against systolic blood pressure sbp. Fit a local-linear regression to these data, and superimpose it on the fit. What is this curveestimating?

Statistics 305a作业代写
Statistics 305a作业代写

其他代写:homework代写 essay代写 Exercise代写 algorithm代写 analysis代写 app代写 assembly代写 assignment代写 C++代写 C/C++代写 code代写 course代写 CS代写 cs作业代写 Data Analysis代写 dataset代写 data代写

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

 

天才代写-代写联系方式