• 加州大学伯克利分校Stat2.3x Inference 统计推断学习笔记: Section 1 Estimating unknown parameters


    Stat2.3x Inference(统计推断)课程由加州大学伯克利分校(University of California, Berkeley)于2014年在edX平台讲授。

    PDF笔记下载(Academia.edu)

    Summary

    • Estimating population means and percents
      Sampling assumptions:
      • Simple Random Sample (SRS)
      • Large enough so that the probability histogram for the sample mean / percents is roughly normal, by Central Limit Theorem.
      • Small enough relative to the population size that the correction factor is close to 1.
    • Confidence Interval (CI) $$mu: ar{X}pm Zcdot SE$$ $$p:hat{p}pm Zcdot SE$$ where $ar{X}, mu$ are sample mean and population mean respectively, $hat{p}, p$ are sample percents and population percents respectively. For calculating $Z$ can use R function, for instance, 90% CI
      z = qnorm((1 - 0.9) / 2)

    ADDITIONAL PRACTICE PROBLEMS FOR EXERCISE SET 1 PROBLEM 1

    A simple random sample of size 300 is taken from a population of hundreds of thousands of adults. The average weight of the sampled people is 150 pounds and the SD of their weights is 30 pounds. a) The average weight of the population is estimated to be _______ pounds; the SE for this estimate is about ______ pounds. b) An approximate 99%-confidence interval for the average weight in the population goes from ________ pounds to _________ pounds.

    Solution

    a) $$ar{X}=150, sigma=30, n=300$$ $$Rightarrow SE=frac{sigma}{sqrt{n}}=frac{30}{sqrt{300}}doteq1.732051$$ Thus the estimated population mean is 150, the SE is 1.732051.

    b) In roughly 99% of all samples, the population mean is in the range $$ar{X}pm Zcdot SE$$ Calculating in R:

    x = 150; sd = 30; n = 300
    se = sd / sqrt(n)z = qnorm((1 - 0.99) / 2)
    x + se
    [1] 145.5385
    x - se
    [1] 154.4615

    Therefore, $$ar{X}pm Zcdot SE=[145.5385, 154.4615]$$

    PROBLEM 2

    In a simple random sample of size 400 taken from over 500,000 workers, 21% of the sampled workers are in carpools.

    a) In the population, the percent of workers in carpools is estimated to be _____%; the SE for this estimate is about _____%.

    b) An approximate 95%-confidence interval for the percent of carpooling workers in the population goes from _____ % to _____ %.

    Solution

    a) $$hat{p}=0.21, n=400$$ $$Rightarrow SE=frac{sqrt{hat{p}cdot(1-hat{p})}}{sqrt{n}}=frac{sqrt{0.21 imes0.79}}{sqrt{400}}doteq0.02036541$$

    b) $$hat{p}pm Zcdot SE=[0.1700845, 0.2499155]$$ R code:

    p = 0.21; n = 400
    se = sqrt(p * (1 - p) / n)
    z = qnorm((1 - 0.95) / 2)
    p + z * se
    [1] 0.1700845
    p - z * se
    [1] 0.2499155

    PROBLEM 3

    A simple random sample of 150 undergraduates is taken at a large university. The average MSAT score of the sampled students is 528 with an SD of 90. Construct an approximate 90%-confidence interval for the average MSAT score of undergraduates at the university.

    Solution $$ar{X}=528, sigma=90, n=150Rightarrow SE=frac{sigma}{sqrt{n}}$$ Thus the 90%-confidence interval for the average is $$ar{X}pm Zcdot SE=[515.9128, 540.0872]$$ R code:

    x = 528; sd = 90; n = 150
    se = sd / sqrt(n); z = qnorm((1 - 0.9) / 2)
    x + z * se
    [1] 515.9128
    x - z * se
    [1] 540.0872

    PROBLEM 4

    In a simple random sample of 500 students taken at a large university, 180 have undeclared majors. Construct an approximate 85%-confidence interval for the percent of students at the university who have undeclared majors.

    Solution $$hat{p}=frac{180}{500}=0.36, n=500Rightarrow SE=frac{sqrt{hat{p}cdot(1-hat{p})}}{sqrt{n}}$$ Thus the 85%-confidence interval of the percentage is $$hat{p}pm Zcdot SE=[0.3290987, 0.3909013]$$ R code:

    p = 180 / 500; n = 500
    se = sqrt(p * (1 - p) / n); z = qnorm((1 - 0.85) / 2)
    p + z * se
    [1] 0.3290987
    p - z * se
    [1] 0.3909013

    PROBLEM 5

    A simple random sample of 900 households is taken in a city. The average household size in the sample is 2.2 people, with an SD of 2 people.

    a) Pick one of the two options: The average household size in the sample is (i) known to be 2.2. (ii) estimated to be 2.2.

    b) Pick one of the two options: The average household size in the city is (i) known to be 2.2. (ii) estimated to be 2.2.

    c) Pick one of the two options (justify your answer carefully). The distribution of household sizes in the sample (i) is approximately normal. (ii) is not normal, not even approximately.

    d) Do you think the distribution of household sizes in the city is approximately normal? Explain.

    e) Pick one of the two options (justify your answer carefully). The normal curve (i) can be used (ii) cannot be used to construct an approximate 95%-confidence interval for the average household size in the city. If you picked option (i), construct the interval.

    f) True or false (explain): Approximately 95% of the households had sizes in the range 2.07 to 2.33 people.

    Solution

    a) $$ar{X}=2.2$$ is known. So (i) is correct.

    b) $$mu=ar{X}=2.2$$ is estimated. So (ii) is correct.

    c) More than $frac{2.2}{2}=1.1$ SD of the values are smaller than 0, which means more than 13.57% households size are lower than 0. This is impossible. Thus the distribution cannot be normal. R code:

    1 - pnorm(1.1)
    [1] 0.1356661

    d) If the large SRS (simple random sample) is not normal then the population would not be normal, too.

    e) The confidence interval is constructed using the probability histogram for the sample average. The sample size is large. By the Central Limit Theorem, this probability histogram will be approximately normal no matter what the shape of the distribution of the population. $$ar{X}=2.2, sigma=2, n=900Rightarrow SE=frac{sigma}{sqrt{n}}$$ Thus the 95%-confidence interval for the average household size in the city is $$ar{X}pm Zcdot SE=[2.069336,2.330664]$$ R code:

    mu = 2.2; sd = 2; n = 900
    se = sd / sqrt(n); z = qnorm((1 - 0.95) / 2)
    mu + z * se
    [1] 2.069336
    mu - z * se
    [1] 2.330664

    f) False. The number of household size should be integer. That is, no household contains between 2.07 and 2.33 people. This interval only provides an estimation for the average household size.

    PROBLEM 6

    A survey organization took a simple random sample of 275 units out of all the rental units in a city. The average monthly rent of the sampled units was $920 and the SD was $500. There were 964 people living in the sampled units, and there were 120 children among the these 964 people. In parts (a)-(c) construct an approximate 68%-confidence interval for the given quantity, if possible. If this is not possible, explain why not.

    a) the average monthly rent of the sampled units

    b) the average monthly rent of all the rental units in the city

    c) the percent of children among all people living in rental units in the city

    d) "About 68% of the sampled units had rents in the range $420 to $1420." Do you agree with the quoted statement? Why or why not?

    Solution

    a) Not possible. It is known to be 920.

    b) $$ar{X}=920, n=275, sigma=500Rightarrow SE=frac{sigma}{sqrt{n}}$$ Thus the 68%-confidence interval of the average monthly rent of the population is $$ar{X}pm Zcdot SE=[890.016,949.984]$$ R code:

    mu = 920; sd = 500; n = 275
    se = sd / sqrt(n); z = qnorm((1 - 0.68) / 2)
    mu + z * se
    [1] 890.016
    mu - z * se
    [1] 949.984

    c) Not possible. The 964 people are not a SRS of the population, but instead it is a cluster sample of the population.

    d) Disagree. Because the sample is not normal. 2 SDs below average takes into negative number: $920-500 imes2 < 0$.

    EXERCISE SET 1 PROBLEM 1

    A simple random sample of 100 people is taken from all the people in a city. The ages of the sampled people have an average of 35 years and an SD of 15 years.

    1A 35 years is known to be the average age of the people in the sample city

    1B The interval "32 years to 38 years" is an approximate 95% confidence interval for the average age of the people in the sample city

    1C In the interval in Problem 2 above, the observed average age of the people in the sample city is being used as an estimate of the unknown average age of the people in the sample city

    1D Pick all of the options that will correctly complete the sentence: The normal curve used in the construction of the interval in Problem 2 is an approximation to the

    a) histogram of ages in the sample

    b) histogram of ages in the city

    c) probability histogram of the average age in a simple random sample of 100 people drawn from the city

    d) probability histogram of the average age in the city

    e) histogram of the averages of all possible simple random samples of 100 people drawn from the city

    Solution

    1A) in the sample.

    1B) The average age of the people in the city is unknown, so it needs to be estimated. $$mu=ar{X}=35, sigma=15, n=100Rightarrow SE=frac{sigma}{sqrt{n}}$$ Thus the 95%-confidence interval is $$mupm Zcdot SE=[32, 38]$$ R code:

    mu = 35; sd = 15; n = 100
    se = sd / sqrt(n); z = qnorm((1 - 0.95) / 2)
    mu + z * se
    [1] 32.06005
    mu - z * se
    [1] 37.93995

    1C) The observed average age of the people in the sample is being used as an estimate of the unknown average age of the people in the city.

    1D) c) and e) are correct. By Central Limit Theorem, this is a simple random sample from a large population so its probability histogram is normal. Note that the histogram of ages in the sample is not normal because $ar{X}-3sigma=-10 < 0$, but the age cannot be negative. Thus a) and b) are incorrect. d) is the point probability which is 100%.

    PROBLEM 2

    A simple random sample of 400 households is taken in a large city, and the number of cars in each sampled household is noted. The average number of cars in the sampled households is 1.8 and the SD is 1.3. Among the sampled households, 10% had no car.

    2A An approximate 90% confidence interval for the average number of cars among households in the city goes from _____ to ____.

    2B An approximate 99% confidence interval for the percent of city households that have no car goes from _____% to ____%.

    Solution

    2A) $$ar{X}=1.8, sigma=1.3, n=400Rightarrow SE=frac{sigma}{sqrt{n}}$$ Thus the 90%-confidence inter val for the average number of cars in the population is $$ar{X}pm Zcdot SE=[1.693085, 1.906915]$$ R code:

    mu = 1.8; sd = 1.3; n = 400
    se = sd / sqrt(n); z = qnorm((1 - 0.9) / 2)
    mu + z * se
    [1] 1.693085
    mu - z * se
    [1] 1.906915

    2B) $$hat{p}=0.1, n=400Rightarrow SE=frac{sqrt{hat{p}cdot(1-hat{p})}}{sqrt{n}}$$ Thus the 99%-confidence interval for the percent of the population is $$hat{p}pm Zcdot SE=[0.06136256, 0.1386374]$$ R code:

    p = 0.1; n = 400
    se = sqrt(p * (1 - p) / n); z = qnorm((1 - 0.99) / 2)
    p + z * se
    [1] 0.06136256
    p - z * se
    [1] 0.1386374

    PROBLEM 3

    A simple random sample of 400 students is taken at a large university. The average height of the sampled students is 68 inches and the SD is 2 inches. The distribution of heights in the sample follows the normal curve very closely.

    3A An approximate 68% confidence for the average height of students at the university is 68 inches plus or minus _____ inches.

    3B Approximately 68% of the students in the sample have heights in the range 68 inches plus or minus _____ inches.

    Solution

    3A) $$sigma=2, n=400Rightarrow Zcdot SE=Zcdotfrac{sigma}{sqrt{n}}=0.09944579$$ R code:

    sd = 2; n = 400
    se = sd / sqrt(n)
    se = sd / sqrt(n); z = qnorm((1 - 0.68) / 2)
    z * se
    [1] -0.09944579

    3B) The distribution of heights in the sample is close to normal. Thus 68%-confidence interval will be "average plus or minue one SD", that is, the answer is 2 inches.

    PROBLEM 4

    A simple random sample of voters is taken from the voters in a large state. Using the methods of our course, researchers construct an approximate 99% confidence interval for the percent of the state’s voters who will vote for Candidate A. The interval goes from 37.3% to 48.7%.

    4A In the sample, the percent of voters who will vote for Candidate A is equal to ____%.

    4B An approximate 95% confidence interval for the percent of the state’s voters who will vote for Candidate A goes from ___% to __%.

    Solution

    4A) The sample percent is the center of the interval: $$hat{p}=(37.3\%+48.7\%) imesfrac{1}{2}=43\%$$

    4B) $$ ext{CI}_{99\%}=hat{p}pm Z_1cdot SE=[0.373, 0.487]$$ Thus the 95%-confidence interval is $$hat{p}pm Z_2cdot SE=[0.3866284, 0.4733716]$$ R code:

    p = 0.43; z1 = qnorm((1 - 0.99) / 2); z2 = qnorm((1 - 0.95) / 2)
    p + (0.487 - p) / z1 * z2
    [1] 0.4733716
    p - (0.487 - p) / z1 * z2
    [1] 0.3866284

    PROBLEM 5

    A simple random sample of voters will be taken in a large state. Researchers will use the methods of our course to construct an approximate 95% confidence interval for the percent of the state’s voters who will vote for Candidate X. The minimum sample size needed to ensure that the width of the interval (right end minus left end) is at most 6% is __________. (Fill in the blank with a positive integer; correct to the nearest 50 is OK.)

    Solution $$hat{p}=0.5, ext{CI}_{95\%}=hat{p}pm Zcdot SE$$ $$Rightarrow 2cdot Zcdot SEleq6\%$$ $$Rightarrow SEleqfrac{0.06}{2cdot Z}$$ $$Rightarrow frac{sqrt{hat{p}cdot(1-hat{p})}}{sqrt{n}}leqfrac{0.06}{2cdot Z}$$ $$Rightarrowfrac{hat{p}cdot(1-hat{p})}{n}leq(frac{0.06}{2cdot Z})^2$$ $$Rightarrow ngeqfrac{hat{p}cdot(1-hat{p})}{(frac{0.06}{2cdot Z})^2}$$ $$Rightarrow ngeq1067.072$$ R code:

    p = 0.5; z = -qnorm((1 - 0.95) / 2)
    p * (1 - p) / (0.06 / (2 * z))^2
    [1] 1067.072


    作者:赵胤
    出处:http://www.cnblogs.com/zhaoyin/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    jQuery选择器
    ViewState对象与Session对象、Cookie对象
    angularjs关于$scope的生命周期详解(转)
    了解AngularJS的$scope的工作原理和生命周期(转载)
    angularjs route 路由
    angularJS--依赖注入
    angularjs动画-ngAnimate--快速上手、使用
    深入浅出理解AngularJS模块
    Angular入门1-之-基础概览02
    Angular入门1-之-基础概览01
  • 原文地址:https://www.cnblogs.com/zhaoyin/p/4173046.html
Copyright © 2020-2023  润新知