#### 联系方式

• QQ：99515681
• 邮箱：99515681@qq.com
• 工作时间：8:00-23:00
• 微信：codinghelp

#### 您当前位置：首页 >> Algorithm 算法作业Algorithm 算法作业

###### 日期：2019-11-28 10:25

THE UNIVERSITY OF HONG KONG

DEPARTMENT OF STATISTICS AND ACTUARIAL SCIENCE

STAT 6014/7614 Advanced Statistical Learning

Assignment 3

Due Date: December 5, 2019

1. The dataset ozone.csv records the level of atmospheric ozone concentration and two

meteorological variables at different locations in the Los Angeles basin in 1976. The response,

referred to as ozone (O3), is the logarithm of the daily maximum of the hourly-average ozone

concentrations (ppm) in Upland, California. The other two variables are temperature in qF

(temp) and inversion base height in feet (ibh). The first few lines of the dataset is shown

below:

> head(ozone)

(a) Use R to determine the univariate kernel density estimate for the response variables O3

using Sheather and Jones’ plug-in rule for bandwidth selection. How are the ozone levels

(logarithm transformed) distributed without taking account of the other variables?

(b) Use R to fit a generalized additive model with O3 as response and temp, ibh as additive

explanatory variables. You may choose a response distribution based on the result obtained

in part (a). Write down the equation of the fitted model with necessary details including

definitions of all involved coefficients (if applicable) and regression/smoothing terms.

(c) Construct partial prediction plots for the model fitted in part (b).

(d) Is there any linear relationship between O3 and the explanatory variables revealed from the

fit plots obtained in part (c)? Use R to perform Chi-square test to confirm.

(e) Use R to refine the model based on the result in part (d). Write down the final fitted model.

(f) From the results obtained above, how does the GAM compare to a GLIM for this dataset?

Explain briefly. (You don’t need to fit the GLIM.)

19/20, 1st term

P. 2

2. To fit a nonparametric model ? based on a data set, the

smoothing spline estimator is obtained by minimizing

with respect to the regression function ?, where is the smoothing parameter and.

(a) Is it reasonable to replace the second order derivative ?′′ by the first order derivative ?′

in the objective function ? Explain briefly.

(b) What solution for will be obtained for → ∞ ?

(c) Below are three smoothing splines fitted for a given data set, for which three values of

the smoothing parameter,0.0007, 0.02, 0.5, are used. Identify the value of ? used

for each estimate.

(d) Suppose that a sample of size is observed as and a

smoothing spline is being fitted. The following is a dialogue between two students.

Alice: “A cubic function can be uniquely defined by 4 points. Since the fitted regression

function must be a natural cubic spline, the resulting fit should be a cubic function

perfectly interpolating the data.”

Bob: “How about the value of ? The choice of the smoothing parameter ? would

affect the fitted model. I don’t think the fitted regression function must be a

perfect interpolation.”

Briefly comment on their claims.

Estimate A Estimate B Estimate C

19/20, 1st term

P. 3

3. The dataset typhoon.csv records the annual numbers of typhoon signal no. 8 issued in

Hong Kong from 1956 to 2018, and the first few lines are shown below:

> head(typhoon)

(a) Use R to fit a three-state Poisson-HMM to the annual numbers of typhoon signals.

(b) Draw a state transition diagram to show the architecture of the fitted HMM, including

estimates of the model parameters.

(c) Use Viterbi decoding to determine the most likely state path for 2014 to 2018.

(d) Use posterior decoding to determine the most likely states for 2014 to 2018.

(e) Based on the state for year 2018 obtained in part (d), estimate the expected number of

typhoon signal no. 8 that will be issued in 2019.

4. The ASIA data set is a small synthetic data set from Lauritzen and Spiegelhalter (1988) that

tries to implement a diagnostic model for lung diseases (tuberculosis, lung cancer, or

bronchitis) after a visit to Asia. The original data set contains the following variables:

A visit to Asia recently (no / yes)

S smoker (no / yes)

T has tuberculosis (no / yes)

L has lung cancer (no / yes)

B has bronchitis (no / yes)

X positive chest X-ray results (no / yes)

D shortness-of-breath (dyspnea) symptom (no / yes)

Since the results of a single chest X-ray do not discriminate between lung cancer and

tuberculosis, a deterministic variable E is added and determined from the values in variables

T and L:

E tuberculosis or lung cancer (no / yes)

19/20, 1st term

P. 4

The first few lines of the data set asia.csv are shown below:

> head(asia)

A S T L B E X D

1 no yes no no yes no no yes

2 no yes no no no no no no

3 yes no yes no no yes yes yes

4 no no no no yes no no yes

5 no no no no no no no yes

6 no yes no no no no no yes

(a) Use R package bnlearn to fit a Bayesian network by hill-climbing algorithm.

(b) Write down the joint probability as a product of conditional probabilities according to the

network structure determined in part (a).

(c) Based on what was suggested from the network structure, state “True” or “False” or

“Uncertain” for each of the following statements.

(i) Node L d-separates node S and node X.

(ii) A recent visit to Asia affects the chance of the presence of dyspnea.

(iii) For a smoker with positive chest X-ray results, whether he/she had recently visit

Asia does not affect his/her risk of having bronchitis.

(d) Write down the Markov blanket of node E.

(e) According to the fitted Bayesian network, how likely is that a non-smoker with positive

chest X-ray results would be suffering from tuberculosis?