# Perform a 95% significance test, give a p-value and a 95% confidence interval. In a random sample of 40 customers of a particular coffee shop, where each were asked "Do you own a pet, yes or no?",...

Perform a 95% significance test, give a p-value and a 95% confidence interval.

In a random sample of 40 customers of a particular coffee shop, where each were asked "Do you own a pet, yes or no?", 28 answered yes and 12 answered no.

Devise a hypothesis test that tests whether the proportion of the shop's customer base that are pet owners is greater than 50%.

### 3 Answers | Add Yours

**Final answer.**

The null hypothesis is that 50% of the customer base have a pet. In a representative sample of 40 customers, we would expect under the null to find that the count of yes's `x` is 20 (ie `E(X) = mu = 20` ) . We write

`H_0: mu_0 = 20`

To test whether the proportion is in fact higher than 50%, we specify the one-sided alternative hypothesis:

`H_1: mu_1 >= 20`

Our sample estimate for the count ```X`, `hat(u)`, is `28` .

Assume that the sample count (over repeated sampling of 40 customers) is Binomial `(n,p)` where `n=40`, `p` the proportion of yes's. This assumption will be considerably more accurate than an assumption of Normality of the proportion `X/n` .

Under the null hypothesis, the count follows Binomial (40,0.5). The upper 95% point of this distribution is (using look-up tables, or using the Binomial Theorem) `25`. Our sample value of the count is `28`. Since this is greater than 25 we reject the null at the 95% level.

The p-value associated with a sample value of 28 is (again using look-up tables)

p-value = `0.997`

The p-value obtained from a z-test is

`Phi((0.7-0.5)/(sqrt(0.5((1-0.5))/n))) = Phi(0.2/0.0791) = Phi(2.530) = 0.994`

where `Phi` is the Normal cumulative distribution function. This is smaller than that under the (more accurate) assumption that the count is Binomially distributed.

Using the sampled test data and assuming the count is then Binomial(40,= 28/40=0.7), a *one-sided *95% confidence interval for the proportion with pets in the customer base is, using look-up tables,

Assuming that the sampled count will follow Binomial(40,), the true proportion will fall in the calculated confidence interval (note, this is *different* for each sample of 40 collected!) 95% of the time (over repeated samples). Note, it is NOT CORRECT to say that the probability that this particular interval (0,0.825) contains the true proportion is 95%.

The assumption of Normality gives a one-sided interval

The upper limit (the interesting one, as we are concerned with how large the proportion is) is lower than when we assume the count is Binomially distributed.

**The cut-off for a significance test at the 95% level is 25, so we reject the null at the 5% level.**

**The p-value is 0.997**

**A one-sided 95% confidence interval is [0,0.825].**

It can be noted that you want to perform a test on one population proportion. A population proportion (p or *p*-*hat)* from a sample, by the way, is the ratio of the number of units possessing the attribute of interest (a) to the number of units in the sample (n). In order to perform the test, the observations should be drawn indepently and randomly from a population. In addition, it is also assumed that the obervations have come from a sequence of independent and identical Bernoulli trials. Z test may be used when the number of samples is large enough (when n>25) or when np(1-p)>3 is satisfied. In performing Z-test, the following are to be used:

Ho: P=Po (where Po is the hypothesized value of proportion)

Test statistic: Zc=(p-hat-Po)/√((Po(1-Po))/n)

Alternative Hypothesis

Test Procedure

Decision Rule( when n>25; At specified α(alpha;significance level), reject Ho if

Ha: P≠Po

Two-tailed Z test

|Zc| > Z α/2

Ha: P>Po

One-tailed Z-test

Zc > Z α

Ha: P<Po

One-tailed Z-test

Zc| > Z α/2

Fail to reject Ho otherwise

From your problem, they hypothesize value of proportion is 0.5. The null hypothesis(Ho) is P=0.5 while the alternative hypothesis (Ha) is P>0.5. The test procedure is one-tailed Z-test. You can use the common significance level of 0.05 or 0.01. The p hut in the problem is 28/40 since attribute of interest is the customers that own pets.

For your second question, the equation to be used in estimating the proportion of yes responses is p-hat ±Zα/2√((p-hat(1-p-hat))/n)

p-hat= (28/40)= 0.7

Zα/2 = 1.96

(p-hat(1-p-hat))/n = (0.7(1-0.7))/40 =0.00525

√(p-hat(1-p-hat))/n = 0.07245688373

Zα/2√((p-hat(1-p-hat))/n) = 0.1420154921

Thus,

p-hat ±Zα/2√((p-hat(1-p-hat))/n) = [0.7-0.1420154921, 0.7+0.1420154921] = [0.5580,0.8420]

To interpet the computed interval estimate, we could say that:

If confidence intervals were constructed for each of those 40 samples, then 95% of those samples will contain the true proportion or yes responses. Thus, we say we are 95% confident that the computed interval [0.5580,0.8420] actually contains the true proportion of yes responses.

It can be noted that you want to perform a test on one population proportion. A population proportion (p or *p*-*hat)* from a sample, by the way, is the ratio of the number of units possessing the attribute of interest (a) to the number of units in the sample (n). In order to perform the test, the observations should be drawn indepently and randomly from a population. In addition, it is also assumed that the obervations have come from a sequence of independent and identical Bernoulli trials. Z test may be used when the number of samples is large enough (when n>25) or when np(1-p)>3 is satisfied. In performing Z-test, the following are to be used:

Ho: P=Po (where Po is the hypothesized value of proportion)

Test statistic: Zc=(p-hat-Po)/√((Po(1-Po))/n)

Alternative Hypothesis: Ha: P≠Po/Ha: P>Po/Ha: P<Po

- For alternative hypothesis P≠Po, the test procedure is two-tailed Z test and the decision rule ( when n>25) is at specified α (alpha;significance level), reject Ho if |Zc| > Z α/2 and fail to reject Ho otherwise.
- For alternative hypothesis P>Po, the test procedure is one-tailed Z-test and the decision rule ( when n>25) is at specified α (alpha;significance level), reject Ho if Zc > Zα and fail to reject Ho otherwise.
- For alternative hypothesis P<Po, the test procedure is one-tailed Z-test and the decision rule ( when n>25) is at specified α (alpha;significance level), reject Ho if Zc <- Zα and fail to reject Ho otherwise.

From your problem, they hypothesize value of proportion is 0.5. The null hypothesis(Ho) is P=0.5 while the alternative hypothesis (Ha) is P>0.5. The test procedure is one-tailed Z-test. You can use the common significance level of 0.05 or 0.01. The p-hat in the problem is 28/40 since attribute of interest is the customers that own pets.

For your second question, the equation to be used in estimating the proportion of yes responses is p-hat ±Zα/2√((p-hat(1-p-hat))/n)

p-hat= (28/40)= 0.7

Zα/2 = 1.96

(p-hat(1-p-hat))/n = (0.7(1-0.7))/40 =0.00525

√(p-hat(1-p-hat))/n = 0.07245688373

Zα/2√((p-hat(1-p-hat))/n) = 0.1420154921

Thus,

p-hat ±Zα/2√((p-hat(1-p-hat))/n) = [0.7-0.1420154921, 0.7+0.1420154921] = [0.5580,0.8420]

To interpet the computed interval estimate, we could say that:

If confidence intervals were constructed for each of those 40 samples, then 95% of those samples will contain the true proportion or yes responses. Thus, we say we are 95% confident that the computed interval [0.5580,0.8420] actually contains the true proportion of yes responses.

**Sources:**