The built-in ldeaths data set contains measurements giving the
monthly deaths from bronchitis, emphysema and asthma in the UK,
19741979, both sexes. We can easily access this data with the
assignment x <- as.vector(ldeaths). We can also get the data by
entering the values 1 by 1. (You would be wise to not do the 1 by 1
entry.) The following is a screen print of the data values:s:
[1] 3035 2552 2704 2554 2014 1655 1721 1524 1596 2074 2199 2512
2933 2889
[15] 2938 2497 1870 1726 1607 1545 1396 1787 2076 2837 2787 3891
3179 2011
[29] 1636 1580 1489 1300 1356 1653 2013 2823 3102 2294 2385 2444
1748 1554
[43] 1498 1361 1346 1564 1640 2293 2815 3137 2679 1969 1870 1633
1529 1366
[57] 1357 1570 1535 2491 3084 2605 2573 2143 1693 1504 1461 1354
1333 1492
[71] 1781 1915
Assume these values are a random sample from a normal population
with unknown mean μ and unknown standard deviation
σ.
Call the vector of observations x,using the assignment above, x
<- as.vector(deaths)
a) Calculate the maximum value of x.
b) Calculate the minimum value of x.
c) Calculate the sample mean of x.
d) Calculate the sample variance of x.
e) Calculate the sample standard deviation s of x.
f) Calculate the sample median of x using R.
> x <- as.vector(ldeaths)
> x
[1] 3035 2552 2704 2554 2014 1655 1721 1524 1596 2074 2199 2512
2933 2889 2938
[16] 2497 1870 1726 1607 1545 1396 1787 2076 2837 2787 3891 3179
2011 1636 1580
[31] 1489 1300 1356 1653 2013 2823 3102 2294 2385 2444 1748 1554
1498 1361 1346
[46] 1564 1640 2293 2815 3137 2679 1969 1870 1633 1529 1366 1357
1570 1535 2491
[61] 3084 2605 2573 2143 1693 1504 1461 1354 1333 1492 1781
1915
a) The maximum value of X
> max(x)
[1] 3891
b) The minimum value of X
> min(x)
[1] 1300
c) Sample mean of X
> mean(x)
[1] 2056.625
d) Sample variance of X
> var(x)
[1] 371911.8
e) Sample standard deviation of X
> sd(x)
[1] 609.8457
f) Sample median of X
> median(x)
[1] 1870
Get Answers For Free
Most questions answered within 1 hours.