这个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
显示所有工作。 在 Canvas 上以 pdf 文档的形式提交您的解决方案。 在 pdf 文件中包含您的 R 代码(必须注释并正确缩进)。 同时提交一个文本文件,其中包含您所有的 R 代码(注释和所有代码),并清楚地标明问题所在。 这必须正确缩进。 在使用随机抽样的每个解决方案之前使用 set.seed(3701)。
问题一(16分)
对于这个问题,令目标函数 g 为 g(x) = sin(x)x, x ∈ (0, 6π]
我们有兴趣使用二分法搜索方法来找到全局最小值 x^,即 x^ = argmin x∈(0,6π]g(x)
(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π 的宽度。
问题2(14分)
假设 x1, . . . , xn 是 N(µ, σ2) 的独立实现。 我们知道 X¯ ∼ N(µ, σ2n)。 假设我们有兴趣最小化关于 a 的目标函数 h,其中 h 定义为 h(a) = (E[aX¯ − µ])2 + Var(aX¯)
具体来说,我们感兴趣的是找到全局最小值 a^,即 a^ = argmina∈Rh(a),其中 R+ 表示正实数集。
(a) (7 分) 求∇h(a) 和∇2h(a)。
(b) (7 分) 基于∇h(a) 求值a¯ 使得∇h(¯a) = 0。通过检查∇2h(a) 的值证明a¯ 是全局最小值。
问题3(20分)
让 X1, . . . , Xn 是来自 N(µ, σ2) 的独立观测值,其中 µ 和 σ2 在实际数据分析中通常是未知的。
以前,我们一直在使用估计量 µ^ =1n∑ni=1 Xi 和 σ^2 =1n−1∑ni=1(Xi − X¯)2。 这里我们感兴趣的是推导 µ 和 σ2 的最大似然估计。
(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。