Docsity

Indicate - Introduction to Statistics - Solved Exam, Exams of Statistics

Toggle sidebar
bg1
SOLUTIONS
MAT 167: Statistics
Test II: Chapters 4-7
Instructor: Anthony Tanbakuchi
Fall 2007
Name:
Computer / Seat Number:
No books, notes, or friends. Show your work. You may use the attached
equation sheet, R, and a calculator. No other materials. If you choose to use R,
copy and paste your work into a word document labeling the question number it
corresponds to. When you are done with the test print out the document. Be sure
to save often on a memory stick just in case. Using any other program or having
any other documents open on the computer will constitute cheating.
You have until the end of class to finish the exam, manage your time wisely.
If something is unclear quietly come up and ask me.
If the question is legitimate I will inform the whole class.
Express all final answers to 3 significant digits. Probabilities should be given as a
decimal number unless a percent is requested. Circle final answers, ambiguous or
multiple answers will not be accepted. Show steps where appropriate.
The exam consists of 4 questions for a total of 25 points on 9 pages.
This Exam is being given under the guidelines of our institution’s
Code of Academic Ethics. You are expected to respect those guidelines.
Points Earned: out of 25 total points
Exam Score:
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Indicate - Introduction to Statistics - Solved Exam and more Exams Statistics in PDF only on Docsity!

SOLUTIONS

MAT 167: Statistics

Test II: Chapters 4-

Instructor: Anthony Tanbakuchi

Fall 2007

Name:

Computer / Seat Number:

No books, notes, or friends. Show your work. You may use the attached

equation sheet, R, and a calculator. No other materials. If you choose to use R,

copy and paste your work into a word document labeling the question number it

corresponds to. When you are done with the test print out the document. Be sure

to save often on a memory stick just in case. Using any other program or having

any other documents open on the computer will constitute cheating.

You have until the end of class to finish the exam, manage your time wisely.

If something is unclear quietly come up and ask me.

If the question is legitimate I will inform the whole class.

Express all final answers to 3 significant digits. Probabilities should be given as a

decimal number unless a percent is requested. Circle final answers, ambiguous or

multiple answers will not be accepted. Show steps where appropriate.

The exam consists of 4 questions for a total of 25 points on 9 pages.

This Exam is being given under the guidelines of our institution’s

Code of Academic Ethics. You are expected to respect those guidelines.

Points Earned: out of 25 total points

Exam Score:

1. Assume that men’s waists are normally distributed with μ = 35 in and σ = 2.3 in.

Solution: Let’s write down the given information:

> mu = 35

> sigma = 2. 3

(a) (1 point) If 1 man is randomly selected, find the probability that his waist size is greater

than 34 in.

Solution: Find P (x > 34) using the normal distribution and the given parameters:

> p = 1 − pnorm ( 3 4 , mean = mu, sd = sigma )

> s i g n i f ( p , 3 )

[ 1 ] 0. 6 6 8

(b) (1 point) If 20 men are randomly selected, find the probability that their mean waist size

is less than 34 in.

Solution: Find P (¯x < 34) using the normal distribution for the sampling distribution

of ¯x (since the CLT applies). The standard deviation will be the standard error:

> n = 20

> s t d. e r r = sigma / s q r t ( n )

> p = pnorm ( 3 4 , mean = mu, sd = s t d. e r r )

> s i g n i f ( p , 3 )

[ 1 ] 0. 0 2 5 9

(c) (1 point) You are designing sweat pants that are “one size fits all”. In reality, the pants

only stretch out to fit the bottom 90% of the male waist sizes, what is the maximum waist

size that the pants will stretch to?

Solution: Solve for a in P (x < a) = 0.90, therefore use the inverse normal cumulative

distribution using the given parameters:

> a = qnorm ( 0. 9 , mean = mu, sd = sigma )

> s i g n i f ( a , 3 )

[ 1 ] 3 7. 9

> s = sd ( x )

> s

[ 1 ] 1. 1 5 8 8 7 9

> s t d. e r r = s / s q r t ( n )

> s t d. e r r

[ 1 ] 0. 5 1 8 2 6 6 3

> t. c r i t = qt ( 1 − alpha / 2 , d f = n − 1 )

> t. c r i t

[ 1 ] 2. 7 7 6 4 4 5

> E = t. c r i t ∗ s t d. e r r

> E

[ 1 ] 1. 4 3 8 9 3 8

The confidence interval is: 38. 2 ± 1 .44 or (36. 8 , 39 .7)

(c) (1 point) Why is the margin of error in your calculated confidence interval greater than

our original desired margin of error of 1 in?

Solution: The sample size of 5 was much smaller than the needed 21.

3. As mentioned before, the CMA states that men’s waists are normally distributed with μ = 35

in. Lately, you are getting allot of returns on your one size fit’s all sweat pants (that you

designed in a previous question) because they are too small.

You believe that the mean waist size of men is actually greater than 35 in. Using the same study

data from the previous question of 5 randomly sampled men (shown below again), conduct a

hypothesis test to test your claim. Use a significance level of 0.01 and assume σ is unknown.

(a) (1 point) What type of hypothesis test will you use?

Solution: Use a one sample mean test with σ unknown.

(b) (1 point) What are the test’s requirements?

Solution: (1) Simple random samples, (2) CLT applies.

(c) (1 point) Are the requirements satisfied? State how they are satisfied.

Solution: Yes. Simple random samples used, and population was normally dis-

tributed.

(d) (1 point) What are the hypothesis?

Solution: H

: μ = 35, H

a

(e) (1 point) What α will you use?

Solution: α = 0. 01

(f) (1 point) Conduct the hypothesis test. What is the p-value?

Solution:

> x

[ 1 ] 3 6. 8 3 8. 3 3 7. 8 4 0. 0 3 8. 3

> r e s = t. t e s t ( x , mu = 3 5 , a l t e r n a t i v e = ” g r e a t e r ” , c o n f. l e v e l = 1 −

> r e s

One Sample t−t e s t

data : x

t = 6. 2 5 1 6 , d f = 4 , p−v a l u e = 0. 0 0 1 6 6 9

a l t e r n a t i v e h y p o t h e s i s : t r u e mean i s g r e a t e r than 35

99 p e r c e n t c o n f i d e n c e i n t e r v a l :

3 6. 2 9 8 0 8 I n f

sample e s t i m a t e s :

4. A newly married couple does not want to get pregnant during their first year of marriage and

decides to only use condoms as a contraceptive device. Studies

have shown that the probability

of pregnancy per use of a condom is 0.15% (individual probability of pregnancy). During the

first year the couple use a condom every time for a total of 162 times.

(a) (1 point) Find the probability of 0 pregnancies over 1 year.

Solution: This question deals with pregnant or not pregnant, therefore the binomial

distribution applies (two possible outcomes). Since np  5 the normal approxima-

tion will not yield sufficiently accurate results. Just directly use the binomial density

formula or function. Find P (x = 0):

> x = 0

> n = 162

> p = 0. 0 0 1 5

> P. none = dbinom ( x , n , p )

> s i g n i f (P. none , 3 )

[ 1 ] 0. 7 8 4

(b) (1 point) Find the probability of 1 or more pregnancies over 1 year.

Solution: Use the complement of the previous question: P (one or more) = 1−P (x =

> P = 1 − P. none

> s i g n i f (P , 3 )

[ 1 ] 0. 2 1 6

(c) (1 point) Would it be unusual to become pregnant during 1 year of use when only using

this form of contraceptive?

Solution: Since P > 0 .05, it would not be unusual to become pregnant when only

using a condom.

(d) (1 point) What would be the average number of pregnancies that the couple should expect

to have given the above information?

Solution: Use the equation for the mean of the binomial distribution:

> mu = n ∗ p

> s i g n i f (mu, 3 )

[ 1 ] 0. 2 4 3

(e) (1 point) Using the equation for the mean of the binomial distribution, solve for the

number of uses n required to have an average (mean) of 1 pregnancy.

The data presented in this problem are approximate values derived from actual published data based on typical

use effectiveness.

Solution: Recall that μ = np, therefore n = μ/p and μ = 1.

> mu = 1

> n = mu/p

> s i g n i f ( n , 3 )

[ 1 ] 667

(f) (1 point) Based on your above results, if you were the primary care physician for this

couple, what would you tell them about their plan to prevent pregnancy? Would it be

effective?

Solution: Since the probability of a pregnancy would not be unusual, a physician

should tell the couple that this method of contraceptive would not be effective in

meeting their goal. The physician would likely recommend a combination of contra-

ceptives to significantly reduce the probability of pregnancy.

8 Hypothesis Tests Test statistic and R function (when available) are listed for each. Optional arguments: alternative="two.sided" can be: "two.sided" , "less" , "greater" conf.level=0.95 constructs a 95% confidence interval. Standard CI only when alternative="two.sided".

8.1 1-SAMPLE PROPORTION

H 0 : p = p 0 prop.test(x, n, p= p 0 , alternative="two.sided")

z =

ˆp − p 0 √ p 0 q 0 /n

8.2 1-SAMPLE MEAN (σ KNOWN) H 0 : μ = μ 0

z = ¯x − μ 0 σ/

n

8.3 1-SAMPLE MEAN (σ UNKNOWN) H 0 : μ = μ 0 t.test(x, mu= μ 0 , alternative="two.sided") Where x is a vector of sample data.

t = ¯x − μ 0 s/

n

, d f = n − 1 (74)

8.4 2-SAMPLE PROPORTION TEST

H 0 : p 1 = p 2 or equivalently H 0 : ∆p = 0 prop.test(x, n, alternative="two.sided") where: x=c( x 1 , x 2 ) and n=c( n 1 , n 2 )

z = ∆ ˆp − ∆p 0 √ ¯p q¯ n 1 +^

¯p ¯q n 2

, ∆ ˆp = pˆ 1 − pˆ 2 (75)

p¯ =

x 1 + x 2 n 1 + n 2 , ¯q = 1 − p¯ (76)

8.5 2-SAMPLE MEAN TEST

H 0 : μ 1 = μ 2 or equivalently H 0 : ∆μ = 0 t.test(x1, x2, alternative="two.sided") where: x1 and x2 are vectors of sample 1 and sample 2 data.

t =

∆ x¯ − ∆μ 0 √ s^21 n 1 +^

s^22 n 2

d f ≈ min (n 1 − 1 , n 2 − 1 ), ∆ ¯x = ¯x 1 − x¯ 2 (77)

8.6 2-SAMPLE MATCHED PAIRS TEST

H 0 : μd = 0 t.test(x, y, paired=TRUE, alternative="two.sided") where: x and y are ordered vectors of sample 1 and sample 2 data.

t =

d¯ − μ d 0 sd /

n , di = xi − yi, d f = n − 1 (78)

8.7 TEST OF HOMOGENEITY, TEST OF INDEPENDENCE

H 0 : p 1 = p 2 = · · · = pn (homogeneity) H 0 : X and Y are independent (independence)

chisq.test(D) Enter table: D=data.frame(c1, c2, ...) , where c1, c2, ... are column data vectors. Or generate table: D=table(x1, x2) , where x1, x2 are ordered vectors of raw categorical data.

χ 2

(Oi − Ei)^2 Ei , d f = (num rows - 1)(num cols - 1) (79)

Ei = (row total)(column total) (grand total)

= npi (80)

For 2 × 2 contingency tables, you can use the Fisher Exact Test: fisher.test(D, alternative="greater") (must specify alternative as greater)

9 Linear Regression 9.1 LINEAR CORRELATION H 0 : ρ = 0 cor.test(x, y) where: x and y are ordered vectors.

r = ∑ (xi − ¯x)(yi − y¯) (n − 1 )sxsy

, t = r − ρ 0 √ 1 −r^2 n− 2

, d f = n − 2 (81)

9.2 MODELS IN R
MODEL TYPE EQUATION R MODEL

linear 1 indep var y = b 0 + b 1 x 1 y ∼ x

... 0 intercept y = 0 + b 1 x 1 y ∼ 0+x linear 2 indep vars y = b 0 + b 1 x 1 + b 2 x 2 y ∼ x1+x ... inteaction y = b 0 + b 1 x 1 + b 2 x 2 + b 12 x 1 x 2 y ∼ x1+x2+x1*x

9.3 REGRESSION

Simple linear regression steps:

  1. Make sure there is a significant linear correlation.
  2. results=lm(y ∼ x) Linear regression of y on x vectors
  3. results View the results
  4. plot(x, y); abline(results) Plot regression line on data
  5. plot(x, results$residuals) Plot residuals

y = b 0 + b 1 x 1 (82)

b 1 = ∑ (xi − ¯x)(yi − y¯) ∑(xi − x¯)^2

b 0 = ¯y − b 1 x¯ (84)

9.4 PREDICTION INTERVALS

To predict y when x = 5 and show the 95% prediction interval with regression model in results: predict(results, newdata=data.frame(x=5), int="pred")

10 ANOVA
10.1 ONE WAY ANOVA
  1. results=aov(depVarColName ∼ indepVarColName, data=tableName) Run ANOVA with data in TableName, factor data in indepVarColName column, and response data in depVarColName column.
  2. summary(results) Summarize results
    1. boxplot(depVarColName ∼ indepVarColName, data=tableName) Boxplot of levels for factor

11 Loading external data

  • Export your table as a CSV file (comma seperated file) from Excel.
  • Import your table into MyTable in R using: MyTable=read.csv(file.choose())