首页 > > 详细

辅导留学生matlab、matlab辅导留学生、辅导留学生matlab、r辅导留学生

STAT 2011 Statistical Models { Semester 1, 2018
Computer Practical Sheet Week 11
Computer Problems for Week 11
Note: Submit this completed work (as a pdf) throgh turnitin on canvas. This will give you a
practice/training to submit the practical exmination in week13 during your class time.
1. Generate a random sample of size n = 200 from exp(5) using rexp(.) in R and store in d1.
The corresponding likelihood function with an unknown parameter based on random
sample of size n from fY (y; ) = 1 e y= is given by
L( ) = nlog( ) + log(nYi=1yi) 1 nXi=1yi:
Following the approach in Q2(d) in week10 and using your data in d1 (treating is
unknown), nd the mle for :
2. The Weibull distribution with shape parameter a and scale parameter b has density given
by
fY (y) = (a=b)(y=b)a 1exp( (x=b)a):
Generate a random sample of size n = 200 from a weibull distribution with a = 2 and
b = 3 using rweibull(.,.,.) in R. Store them in d2. Using the likelihood function and
following the approach in Q2(d) in week10 for the data in d2 (treating the both a and b
are unknown), nd the mle for = (a;b):
3. Generate a random sample of size 50 from N(2;32) and store them in d3. Assuming these
data are from an N( ;32); nd a 95% CI for using your data in d3. You may follow
the steps below:
mu=2
Sigma=3
n=50
d3=rnorm(n,mu,sigma)
LL=mean(d3)-qnorm(0.975)*sqrt(sigma/n)
UL= mean(d3)+qnorm(0.975)*sqrt(sigma/n)
CI=c(LL,UL)
(a) Investigate this interval (a 95% CI for ) and check whether the true mean = 2
is in your interval. If not repeat this process until you obtain a satisfactory sample
and an interval to include = 2:
(b) Contruct a 90% CI for using your sample in d3.
PTO
1
4. Generate a sample of 100 from the standard normal distribution and store them in d4.
Assuming this data come from N( ;1) with unknown mean ; construct a 95% CI for
this mean, : Repaeat this process 50 times and plot all 50 CIs following the steps:
samsize 0 | confint[,2]<0, 2, 1)
plot(c(0, 0), c(1, replicates), col="black", typ="l",
ylab="Samples",
xlab="Confidence Interval")
segments(confint[,1], 1:replicates, confint[,2], 1:replicates,
col=outside)
How many CIs do not include 0 (the true population mean)? How many CIs do you
expect not to include the true population mean? Repeat this process until you obtain
satisfactory samples to include = 0 approximately 95%.
5. Repear Q4 to construct 90% CI for the population mean assuming that it is unknown
and coming from N( ;1):
6. Generate a sample of 100 from N(5;22) distribution and store the data in d6. Assuming
the data in d6 are from N( ;22); construct a 92% CI for the population mean, : Repaeat
this process 50 times and plot all 50 CIs following the steps in Q4. Comment on your
results.
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!