## 这个Homework是用R语言提供每个随机抽样的解决方案

STAT 3701 Homework 6
Show all work. Submit your solutions in a pdf document on Canvas. Include your R code (which must be commented and properly indented) in the pdf file. Also submit one text file with all your R code (comments and all) clearly labeled with the problem it goes with. This must be properly indented. Before every solution with random sampling use set.seed(3701).
Problem 1 (16 points)
For this problem let the objective function g be g(x) = sin(x)x, x ∈ (0, 6π]
We are interested in using the bisection search method to find the global minimizer xˆ, i.e.,xˆ = argmin x∈(0,6π]g(x)
(a) (4 points) Derive ∇g(x).
(b) (4 points) Using the bisection search algorithm bsearch from the notes with initial interval [a0, b0] =[0.1, 6π]. Let x¯ be the critical point return by the algorithm. What is the value of g(¯x)?
(c) (4 points) Make a plot of g(x) over the domain (0, 6π]. Was the value x¯ you found in part (b) the global minimizer? Use seq(from=0.1,to =6*pi,by=0.001) to generate x.list containing the values of x over the domain.
(d) (4 points) Find the global minimizer of g(x) by using the bisection search algorithm and carefully choosing the initial interval. Note your initial must have a width larger than 2π.
Problem 2 (14 points)
Suppose that x1, . . . , xn are independent realizations from N(µ, σ2). We know that X¯ ∼ N(µ, σ2n). Suppose we are interested in minimizing the objective function h with respect to a where h is defined as h(a) = (E[aX¯ − µ])2 + Var(aX¯)
Specifically we are interested in finding the global minimizer aˆ, i.e.,aˆ = argmina∈Rh(a),where R+ denote the set of positive real numbers.
(a) (7 points) Find ∇h(a) and ∇2h(a).
(b) (7 points) Based on ∇h(a) find the value a¯ such that ∇h(¯a) = 0. Prove that a¯ is the global minimizer by checking the value of ∇2h(a).
Problem 3 (20 points)
Let X1, . . . , Xn be iid observation from N(µ, σ2), where µ and σ2 are usually unknown in real data analysis.
Previously, we’ve been using the estimators µˆ =1n∑ni=1 Xi and σˆ2 =1n−1∑ni=1(Xi − X¯)2. Here we are interested in deriving the maximum likelihood estimators for µ and σ2.
(a) (5 points) Write down the loglikelihood function l(µ, σ2; x1, . . . , xn).
(b) (7 points) Now treat σ2 as fixed. Minimize the negative loglikelihood function with respect to µ get µˆmle. And you will see µˆmle does not depend on σ2. (Hint: you may want to refer to Example 1.3 on notes)
(c) (8 points) To get the MLE for σ2, we plug in µˆmle for µ in the loglikelihood function, take differentiate the loglikelihood function with respect to σ2 and set it to 0. That is, the MLE σ2,mle solve the equation dl(ˆµmle, σ2; x1 . . . , xn)/dσ2 = 0.

STAT 3701 作业 6

(a)（4 分）导出 ∇g(x)。
(b)（4 分）使用二分搜索算法 b 从初始区间 [a0, b0] =[0.1, 6π] 的音符中搜索。 令 x¯ 为算法返回的临界点。 g(¯x) 的值是多少？
(c)（4 分）在域 (0, 6π) 上绘制 g(x)。您在 (b) 部分中找到的值 x¯ 是全局最小值吗？使用 seq(from=0.1,to =6 *pi,by=0.001) 生成 x.list，其中包含域上 x 的值。
(d)（4 分）通过使用二分搜索算法并仔细选择初始区间找到 g(x) 的全局最小值。 请注意，您的首字母必须具有大于 2π 的宽度。

(a) (7 分) 求∇h(a) 和∇2h(a)。
(b) (7 分) 基于∇h(a) 求值a¯ 使得∇h(¯a) = 0。通过检查∇2h(a) 的值证明a¯ 是全局最小值。

(a)（5 分）写出对数似然函数 l(µ, σ2; x1, . . . , xn)。
(b)（7 分）现在将 σ2 视为固定值。 最小化关于 µ 的负对数似然函数 get µ^mle。 你会看到 µ^mle 不依赖于 σ2。 （提示：您可能需要参考注释中的示例 1.3）
(c)（8 分）为了得到 σ2 的 MLE，我们在对数似然函数中插入 µ^mle for µ，将对数似然函数关于 σ2 微分并将其设置为 0。即，MLE σ2,mle 求解 方程 dl(^µmle, σ2; x1 . . . , xn)/dσ2 = 0。