本次澳洲代写作业案例分享是一个R统计代写的assignment

Suppose we have a single B(m; ) observation X for m known but the success probability parameter  2  = (0; 1) unknown. Consider the decision problem where the decision space is D=  and the loss function L(dj) = 1 fjd j > Cg. Then a \decision” d(X) may be viewed as an estimator of  and the risk is precisely the probability that the resultant interval estimator d(X)C does not cover the true , i.e. the noncoverage probability of the interval. In other words, we are interested in forming a fixed-width interval estimate of  (rather than a \confidence interval”; the main difference is that we are fixing the width, not the coverage probability of the procedure).

We shall consider two different procedures:

• a simple procedure centred at the observed proportion ^ ML = Xm;

• a Bayes procedure using the \ at” prior w()  1; note that in this case this is a \proper prior”,
in fact the beta(1; 1) density, an example of a \conjugate prior” for this problem.

For simplicity, we shall take m = 10 and suppose we wish to form an interval of width 0.2, so C = 0:1.

Since there are only 11 di erent possible observations, we can exhaustively list all possible intervals using both procedures. It is then possible to compute \exactly” the risk functions of the two procedures.

Note also that when X takes the (extreme possible) values 0 and 10, we have a modi ed rule for
constructing the interval, to ensure it remains within (0,1).

1. The simple interval
For observed values x = 1; 2; : : : ; 9, the simple interval is. But for x = 0 the interval is
the same as for x = 1; for x = 10 the interval is the same as for x = 9.

(a) Define x=0:10 and also define two vectors simple.lower and simple.upper giving the lower
and upper endpoints of the simple interval.

(b) Define now th=(1:1000)/1001. The following code computes the risk of the simple interval
for each value in th:

th=(1:1000)/1001
L=length(th)
risk=0
for (i in 1:L)f
probs=dbinom(x,10,th[i])
lower.miss=th[i]<simple.lower
upper.miss=th[i]>simple.upper
risk[i]=sum(probs[lower.miss])+sum(probs[upper.miss])
g

Plot risk against th (as a red line plot).