这个作业是来自澳洲的,需要用R语言完成统计学相关题目的统计代写

STAT3023: Statistical Inference

1.一种可能的α级检验是基于Y的“等尾”检验,其中我们拒绝Y <a或Y> b
哪里
P0 {Y <a} = P0 {Y> b} =
α
2

(a)取α= 0.05且n = 5,找到适当的值a和b。
(b)定义sig.sq =(50:150)/ 100相对于sig.sq绘制测试功效。添加水平
虚线表示水平。
2.在第7周的教学中,我们还看到UMPU测试拒绝了较大的
小号
2-对数(S
2

等同于拒绝较小的统计量
T =(n-1)log Y-Y;
要看到这个,写日志(S
2
)= log Y − log(n − 1),乘以n − 1并忽略(n −
1)log(n-1)项。
如果测试的水平为α,则拒绝Y≤c或Y≥d,其中
P0(Y≤c)+ P0(Y≥d)=α(2)

(n-1)log(c)-c =(n-1)log(d)-d (3)
(a)编写以下形式的函数
•计算适当的d,以使c和d满足(2);
•然后计算并输出左侧和右侧之间的差异
在(3)中。
(b) Use the R function uniroot() to find the root (in c) of the equation fn(c,0.05,5)=0. In
your code you will need a command along the lines of
uniroot(fn,lower=0,upper=…,alpha=0.05,n=5)
Consult the week 7 exercise for some hints as to how to choose the upper=…. When you
have worked out the right commands, wrap it all in a function of the form
norm.var.umpu=function(alpha,n) {

}
which returns a list containing elements $c and $d.
(c) Recreate your plot from part (b) of the previous question and add to it the power function
of the UMPU test.
3. The GLRT test of (1) above uses the statistic
Ln = `(X, Y /n ¯ ; X) − `(X, ¯ 1; X) = −
n
2
log 
Y
n


n
2
+
Y
2
which is an increasing function of Y − n log Y (as opposed to the UMPU which rejects for large
Y − (n − 1) log Y ). Adapt your code for the previous question to compute the power of the exact
GLRT, recreate your earlier plot and add a power curve to it so it shows all 3 power curves on the
1 graph. Add an informative heading, legend, etc.. Comment on the main differences between the
3 tests.
4. As a final step, recreate your last plot but use an extended range for the parameter: sig.sq=(1:400)/100.