Unformatted text preview:

Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R Lab5 CIs PIs and Hypothesis Testing for Proportions Means and Linear Regression M George Akritas M George Akritas Lab5 CIs PIs and Hypothesis Testing for Proportions Mean Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R Explaining CIs CIs and Tests for Proportions Homework Lab Activity CIs Hypothesis Tests for the Mean and PIs Homework Lab Activity CIs Hypothesis testing and PIs in Regression Homework Lab Activity Supplement to Reading Data in R M George Akritas Lab5 CIs PIs and Hypothesis Testing for Proportions Mean Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R I Each CI is a Bernoulli trial It either contains the true parameter value or not After the CI is constructed we talk about how confident we are that it contains the true value The following commands generate the figure in the next slide m 50 n 20 p 5 toss 20 coins 50 times phat rbinom m n p n divide by n for proportions SE sqrt phat 1 phat n compute SE alpha 0 10 zstar qnorm 1 alpha 2 compute z 2 matplot rbind phat zstar SE phat zstar SE rbind 1 m 1 m type l lty 1 abline v p draw vertical line at p 0 5 M George Akritas Lab5 CIs PIs and Hypothesis Testing for Proportions Mean 0 10 20 CI count 30 40 50 Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R 0 2 0 4 M George Akritas 0 6 0 8 Lab5 CIs PIs and Hypothesis Testing for Proportions Mean Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R Homework Lab Activity R command for Z intervals for a proportion I With T being the number of successes in n trials set phat T n and use the commands phat qnorm 0 975 sqrt phat 1 phat n to obtain q the 95 CI for p i e the pair of values b p b p z0 025 p 1 b n I To obtain 90 or other CIs adjust the 0 975 in the above command accordingly M George Akritas Lab5 CIs PIs and Hypothesis Testing for Proportions Mean Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R Homework Lab Activity Alternative CIs and Hypothesis Testing I With x being the binomial count the command prop test x n is equivalent to the following prop test x n p 0 5 alternative two sided conf level 0 95 correct TRUE It gives the p value for testing H0 p 0 5 against the two sided alternative a 95 CI for p and b p I Try prop test 16 20 Also try prop test 16 20 p 0 6 which does the same except it tests H0 p 0 6 I For one sided alternatives use alternative less and alternative greater But it will return one sided CIs I The default correct TRUE is for continuity correction M George Akritas Lab5 CIs PIs and Hypothesis Testing for Proportions Mean Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R Homework Lab Activity Is there evidence that the proportion p of men who are taller than 6ft is greater than 0 3 Using the fathers heights in the data set http sites stat psu edu mga 401 Data FatherSonHeights txt test at 0 05 and report the p value Also construct a 95 CI Include the R commands and R output with your answer Copy it from the R console and paste it Additional R help I To get the binomial count x i e the number of fathers heights that are 72 put the data in the data frame ht using e g ht read clipboard after copying the data see supplement in the end of this file and do x1 ht F H x sum x1 72 M George Akritas Lab5 CIs PIs and Hypothesis Testing for Proportions Mean Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R Homework Lab Activity R command for the T test and T interval for the mean I With x containing the data set the command t test x is equivalent to the following t test x mu 0 alternative two sided conf level 0 95 It gives the t statistic TH0 the df the p value for testing H0 0 against the two sided alternative the 95 CI for and X I To do the same except test H0 0 e g H0 8 5 replace mu 0 by mu 8 5 or use xc x 8 5 t test xc I For one sided alternatives use alternative less and alternative greater But again it will return one sided CIs M George Akritas Lab5 CIs PIs and Hypothesis Testing for Proportions Mean Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R Homework Lab Activity CIs and PIs through lm I confint lm x 1 level 0 9 is an alternative way of getting the 90 CI for I predict lm x 1 interval predict level 0 9 will give a 90 PI for a new observation but will do so n times Alternatively use x2 rep 1 length x newx data frame x2 1 predict lm x 1 x2 newx interval predict level 0 9 M George Akritas Lab5 CIs PIs and Hypothesis Testing for Proportions Mean Outline Explaining CIs CIs and Tests for Proportions CIs Hypothesis Tests for the Mean and PIs CIs Hypothesis testing and PIs in Regression Supplement to Reading Data in R Homework Lab Activity 1 Is there evidence that the average height of men is more than 6ft Using the sons heights in the data set http sites stat psu edu mga 401 Data FatherSonHeights txt test at 0 05 and report the p value Also construct a regular i e two sided 95 CI 2 An old friend whom you have not seen since fourth grade contacts you through facebook Some time after that you decide to meet in person but you have no idea how tall he turned out to be Using the sons heights data construct an 80 PI for …


View Full Document
Loading Unlocking...
Login

Join to view Linear Regression and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Linear Regression and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?