Hypothesis Testing Known Standard Deviation

## Description

Given the IQ test scores for 31 seventh-grade girls in a Midwest school district. If we treat the 31 students as a simple random sample of all seventh-grade girls in the district, we can use R commands to see if there is there significant evidence at the 5% level that the mean IQ score of all girls in the district differs from 100. Assume that the population standard deviation is $\sigma = 15$.

To use R in a Sage cell, the language must be set to R. See https://github.com/sagemath/sagecell/blob/master/doc/embedding.rst for details.

## Sage Cell

#### Code

```
iq_data <- c(114, 102, 103, 120, 118, 111, 107, 112, 100, 91, 105, 132, 119, 103, 103, 112, 104, 114, 108, 111, 86, 74, 98, 93, 89, 114, 130, 128, 72, 112, 96)
xbar = mean(iq_data) # sample mean
muO = 100 # hypothesized value
sigma = 15 # population standard deviation
n = length(iq_data) # sample size
z = (xbar - muO)/(sigma/sqrt(n))
z # test statistic
pval = 2*pnorm(z) - 1 # two tail pâvalue
pval
```

## Options

None

## Tags

Primary Tags: statistics

Secondary Tags: hypothesis testing

## Related Cells

- Hypothesis Testing with Unknown Standard Deviation using R
- Calculating Confidence Intervals with Known Standard Deviation using R
- Calculating Confidence Intervals with Unknown Standard Deviation using R

## Attribute

Permalink:

Author: T. Judson

Date: 19 Jul 2017 16:41

Submitted by: Tom Judson