lab4_ma58bs15_permtest

advertisement

Math 58B - Introduction to Biostatistics

Spring 2015

Jo Hardin

Lab Assignment 4

Lab Goals:

1.

To simulate the sampling distribution of 𝑝^

1

− 𝑝^

2

.

2.

To see why the CLT works for our new statistic: 𝑝^

1

− 𝑝^

2

3.

To understand why we can't use the binomial distribution to calculate exact probabilities in this setting.

In class

During the lab, go through sections (a) through (bb) of Investigation 2.1 (the whole thing).

KEY: Make sure you know how to do a simulation test using R [parts (j) through (t).]

Secondary: Also be sure you can use the normal approximation to find a p-value [parts (u) through (y)] and a confidence interval [parts (z) and (aa)]. You should know how to use iscamtwopropztest, page 128.

Note: if you can't remember what an ISCAM function does, pass it the argument "?". Also, remember to look at the back of each chapter for R summaries. load ( url ( "http://www.rossmanchance.com/iscam2/ISCAM.RData" )) iscamtwopropztest ( "?" )

## Error in iscamtwopropztest("?"): iscamtwopropztest(observed1, n1, observed2, n2, hypothesized=0, alternative=NULL, conf.level=NULL

## This function calculates a two proportion z-test and/or interval.

## Input the observed numbers of successes or sample proportions (assumed if value less than one),

## Input the sample sizes, and the hypothesized difference in probability of success/population proportions (default is zero)

## Optional: Input the form of alternative ("less", "greater", or

"two.sided")

## Optional: Input confidence level(s) for a two-sided confidence interval.

## Optional: Instead of entering the four individual numbers, you can

## pass in the two-way table of counts. Be sure to label the datatable in this case.

##

To turn in

Consider the example in Practice Problem 2.1B.

1.

Provide graphical and numerical summaries of the data.

2.

Using a simulation study [as in parts (m) through (r )], give a complete hypothesis test to the question at hand. Recall that you'll need hypotheses (identify any symbols you

use!), test statistic, p-value, and conclusion in the context of the problem; that is, say something about the credibility of newspapers.

• The R code associated with the simulation study for the hypothesis test should be included in what you turn in.

3.

Using the normal approximation [as in parts (u) through (y)], give a complete hypothesis test to the question at hand. Recall that you'll need hypotheses (identify any symbols you use!), test statistic, p-value, and conclusion in the context of the problem; that is, say something about the credibility of newspapers.

• Here, most of your work should be done by hand / by calculator. The p-value can be calculated using R or an applet. Please show your work.

4.

Could you have used binomial probabilities to compute the exact probabilities for the hypothesis test at hand? If yes, explain how. If no, explain why not.

Download