Question
must be Rstudio code. can use other languages to do the problem but please convert to R code

The median is the middle of a dataset. For example, if your observations are c(1,2,3,8,10), the median is 3. Note ã = 1+2+3+8
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1a.~The~pdf~of~N(\mu,\sigma^2)~is\\ f(x)=\frac{1}{\sqrt{2\pi}\sigma}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2} \right )\\\\ \log f(x)=-\frac{1}{2}\log 2\pi-\frac{1}{2}\log \sigma^2-\frac{(x-\mu)^2}{2\sigma^2}\\\\ \frac{\mathrm{d} \log f(x)}{\mathrm{d} \mu}=\frac{x-\mu}{\sigma^2}\Rightarrow \frac{\mathrm{d}^2 \log f(x)}{\mathrm{d} \mu^2}=-\frac{1}{\sigma^2};~\\\\ I(\mu)=Fisher's~information~for~\mu=-nE\left(\frac{\mathrm{d}^2 \log f(x)}{\mathrm{d} \mu^2} \right )=\frac{n}{\sigma^2}\\\\ Efficiency=\frac{\sigma^2/n}{Var(\tilde{x})}\times 100\%=\frac{1}{nVar(\tilde{x})}\times 100\%;~\\\\ where~\tilde{x}=sample~median,~n=sample~size,~\sigma=1.\\\\

R code:

N=1000
n=10
me=1:1000*0
sigma=1:1000*0
for(i in 1:N)
{
x=rnorm(n)
me[i]=median(x)
}
round(mean(me),4)
var(me)
round((1/(n*var(me)))*100,2)

Estimate of \mu =sample median=-0.0040 with efficiency=66.97%.

1b.

1a.~The~pdf~of~N(\mu,\sigma^2)~is\\ f(x)=\frac{1}{\sqrt{2\pi}\sigma}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2} \right )\\\\ \log f(x)=-\frac{1}{2}\log 2\pi-\log \sigma-\frac{(x-\mu)^2}{2\sigma^2}\\\\ \frac{\mathrm{d} \log f(x)}{\mathrm{d} \sigma}=-\frac{1}{\sigma}+\frac{(x-\mu)^2}{\sigma^3}\Rightarrow \frac{\mathrm{d}^2 \log f(x)}{\mathrm{d} \mu^2}=\frac{1}{\sigma^2}-\frac{3(x-\mu)^2}{\sigma^4};~\\\\ I(\sigma)=Fisher's~information~for~\sigma=-nE\left(\frac{\mathrm{d}^2 \log f(x)}{\mathrm{d} \sigma^2} \right )=\frac{2n}{\sigma^2}\\\\ Efficiency=\frac{\sigma^2/2n}{Var(Q)}\times 100\%=\frac{1}{2nVar(Q)}\times 100\%;~\\\\ where~Q=sample~IQR,~n=sample~size,~\sigma=1.\\\\

R code:

N=1000
n=10
Q=1:1000*0
sigma=1:1000*0
for(i in 1:N)
{
x=rnorm(n)
Q[i]=IQR(x)
}
round(mean(Q),4)
var(Q)
round((1/(2*n*var(Q)))*100,2)

Here Q=1.1564 with efficiency=28.61%.

Add a comment
Know the answer?
Add Answer to:
must be Rstudio code. can use other languages to do the problem but please convert to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT