本次R语言代写的主要内容是一个数据分析的group Project


STA238 – Winter 2021

从赋值2回忆起,对于n-1 i = 1,定义为S2 = 1 n(Xi-X̄)2的样本方差是无偏的

σ2。然后我们回答“为什么我们要除以n − 1而不是n?”。现在,让我们更进一步,研究分配2第1部分中的任一估计量是否为σ2的最大似然估计量。


iid2 2假设X1,…,Xn〜Normal(μ= 0,σ),得出σ的最大似然估计。

注意:在此推导中,您应该:1.明确标识似然函数(以简化形式); 2.明确标识对数似然函数(以简化形式); 3.使用二阶导数检验以确保估计量确实为最大值; 4.确保您对σ2(而不是σ)有所区别。




T 1 = S 2 =(X i − X̄)2 n − 1 i = 1


T2 = S ∗ 2 =(Xi-X̄)2


i = 1














Part 1


Recall from Assignment 2 that the sample variance defined as: S2 = 1 􏰁n (Xi X ̄)2 is unbiased for n1 i=1

σ2. And we answered “Why are we dividing by n 1 and not n?”. Now let’s take this one step further and investigate if either of the estimators in Assignment 2 Part 1 is a maximum likelihood estimator of σ2.

Step 1 (Mathematical Justification)

iid2 2 Assume that X1,…,Xn Normal(μ = 0), derive the maximum likelihood estimator of σ .

NOTE: In this derivation you should: 1. explicitly identify the likelihood function (in a simplified form); 2. explicitly identify the loglikelihood function (in a simplified form); 3. use the second derivative test to ensure that the estimator is indeed a maximum; and 4. make sure you are differentiating with respect to σ2 (and not with respect to σ).

Step 2 (Simulation Justification):

Compare the likelihood (or loglikelihood) of σ2 when evaluated at the two estimators 1n

and .

T 1 = S 2 = 􏰂 ( X i X ̄ ) 2 n 1 i=1


T2=S2= 􏰂(XiX ̄)2



Here you will simulate n Normal(02) random variables to represent your data. Select (at least) 10 different sample sizes. For each simulated sample (i.e, for each n) evaluate the likelihood at T1 and T2 and plot the ratio of these two likelihoods for the different n. So n is on the x-axis, and the ratio of the likelihoods is on the y-axis. So one plot is for one σ2 and the 10 (or more) different sample sizes. Repeat this for another σ2 (I would recommend choosing 2 different values for σ2 one “large” and one “small”). You can put both lines on one plot (make sure it’s clear which plot is for which σ2) or put each line on it’s own plot.

Once these plots are created provide some commentary on whether your simulation results are inline with your derivations in Step 1.

Here is an example of one of the lines-plots for the comparison of the likelihood. This example is for data that is exponential with parameter (mean) θ. The likelihood is evaluated at the sample median and sample mean (the MLE). The code to produce this is in the Assignment4.Rmd.

General Notes (for Part 1):

  • This question is open book, so you can use outside sources (i.e., textbooks, academic papers, credible websites, etc.), especially in Step 1, to prove/show the MLE derivation. Just make sure you properly credit any outside sources.
  • You will likely need to use LaTeX code in your Rmd file. Please have a look at our course Resources page, as well as the synchronous lecture in Week 4.
  • Grammar is not the main focus of the assessment, but it is important that you communicate in a clear and professional manner. I.e., no slang or emojis should appear.
  • You may want to include a bibliography in this section. If it is clear that you (or the reader) looked up something that is not common knowledge (and it was not cited) then you will lose points.
  • Use inline referencing

Part 2


In this question you will write a report on a data analysis in which your main methodology will be to derive at least two confidence intervals. One confidence interval should be for a mean and should be calculated via critical values (i.e., NOT via bootstrapping). The other confidence interval should be for another measure, that is not the mean, median, or a proportion (e.g., a percentile, ratio, variance, standard deviation, etc.) to be calculated via bootstrapping. Both confidence intervals should be meaningful/appropriate based on the data. The report will consist of 5 sections: Introduction, Data, Methods, Results, and Conclusions.

There should be no evidence that Part 2 is an assignment, I should be able to take a screenshot of this section and paste it into a newspaper/blog. There should be no raw code. All output, tables, figures, etc. should be nicely formatted.

EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!

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