Statistic work
Review: Confidence Intervals
• What was their purpose again?
• How did we calculate them again?
Review: Confidence Intervals
• Our sample mean ( 𝑋) is our best estimate of the true population mean (μ)
• We know however that because of sampling error 𝑋 is likely to deviate from μ
• The standard error of the mean tells us on average how far off 𝑋 is likely to be from μ
• We can use this to construct a range of mean values around our sample mean 𝑋 that contains μ with some level of probability • This is called a confidence interval
Review: Confidence Intervals
Standard Error of the Mean Estimated Standard Error of the Mean
Formula 𝜎 𝑋 = 𝜎
𝑁 𝑆 𝑋 =
𝑆
𝑁 − 1
Distribution Z Distribution T Distribution (small samples) Z Distribution (large samples)
Review: The 95% Confidence Interval
• An interval around our sample mean ( 𝑋) that contains our population mean (μ) 95% of the time
• Formula:
95% 𝐶𝑜𝑛𝑓𝑖𝑑𝑒𝑛𝑐𝑒 𝐼𝑛𝑡𝑒𝑟𝑣𝑎𝑙 = 𝑋 +
− (1.96)(𝜎 𝑋)
Exercises
• See textbook page 194-195 for example
• See textbook page 212, question 21 and 22 for practice
Review: Confidence Intervals with the T Distribution • We use the T distribution if:
• We estimate the standard error of the mean using the 𝑆 𝑋 = 𝑆
𝑁 −1 formula
• AND if our sample size is small
• There is actually a family of T distributions • The number of degrees of freedom you have will tell you which distribution is
applicable
• Formula: 𝐷𝑒𝑔𝑟𝑒𝑒𝑠 𝑜𝑓 𝐹𝑟𝑒𝑒𝑑𝑜𝑚 𝑑𝑓 = 𝑁 − 1
Review: Using the T Table
• Alpha (α)- the area in the tails of the distribution • Formula:
𝛼 = 1 − 𝑙𝑒𝑣𝑒𝑙 𝑜𝑓 𝑐𝑜𝑛𝑓𝑖𝑑𝑒𝑛𝑐𝑒
• Degrees of freedom (df)- the number of free observations • Formula:
𝑑𝑓 = 𝑁 − 1
Review: Calculating Confidence Intervals with the T table
• Confidence intervals based on the T distribution
• Formula:
𝐶𝑜𝑛𝑓𝑖𝑑𝑒𝑛𝑐𝑒 𝐼𝑛𝑡𝑒𝑟𝑣𝑎𝑙 = 𝑋 +
− 𝑡 (𝑆 𝑋)
Exercises
• See textbook page 201-203 for example
• See textbook page 212, question 26 and 27 for practice
Review: Difference of Means Hypothesis Testing • Assume that the null hypothesis is correct (i.e. the difference
between population means is 0) • 𝜇1 − 𝜇2 = 0
• Calculate the observed difference of means between the samples • 𝑋1 − 𝑋2
• Calculate the probability that we would obtain a difference as extreme as the one we found if the null hypothesis is true
• Reject the null hypothesis if this probability is small enough • P < .05
Difference of Means Testing- Overview
• Calculate the sample means 𝑋1 𝑎𝑛𝑑 𝑋2 • Calculate the difference between sample means
• 𝑋1 − 𝑋2
• Translate the mean difference into a T score
• 𝑇 = 𝑋1 − 𝑋2
𝑆 𝑋1 − 𝑋2 𝑆 𝑋1 − 𝑋2 =
𝑁1 𝑆1 2+ 𝑁2𝑆2
2
𝑁1+𝑁2 −2
𝑁1+ 𝑁2
𝑁1𝑁2
• Compare the observed T value to the table T value whereby df = N1 + N2 – 2 and alpha = 0.05 • If observed T > Table T, you can reject the null
• If observed T < Table T, you fail to reject the null
Exercises
• See textbook page 239-242 for example
• See textbook page 265, question 17, 18, and 19 for practice
• Calculate expected frequencies for each category. • Divide total number of observations by K, the number of categories.
• Calculate Chi-Square statistic • Consult textbook page 323
Review: The One Way Chi Square Test
Review: The One Way Chi Square Test
• Look up the critical Chi Square value in the table (p.557) • Degrees of Freedom = K-1
• Compare critical Chi Square to calculated Chi square • If your calculated Chi Square is > your critical Chi square you reject the null
hypothesis
• If your calculated Chi Square is < you critical Chi Square you fail to reject the null hypothesis
Exercises
• See textbook page 323-325 for example
• See textbook page 350-351, question 10 and 11 for practice
Review: The Two Way Chi Square Test
Review: The Two Way Chi Square Test
The Two Way Chi Square Test – Example
Democrat Republican Total
Obama 20 10 30
Romney 5 65 70
Total 25 75 100
Row Marginal Totals
Column Marginal Totals
N
Exercises
• See textbook page 331-333 for example
• See textbook page 357, question 31 and 32 for practice
The Correlation Coefficient (r)
• A coefficient that tells us about the strength and direction of a relationship
• Always ranges from -1 to 1
• Direction: • Positive numbers indicate a positive relationship
• Negative numbers indicate a negative relationship
• Strength:
-1 Perfect Neg. Correlation
1 Perfect Pos. Correlation
-.6 Strong Neg. Correlation
.6 Strong Pos. Correlation
-.3 Moderate Neg. Correlation
.3 Moderate Pos. Correlation
-.1 Weak Neg. Correlation
.1 Weak Pos. Correlation
No Correlation 0
The Correlation Coefficient (r)
The Computational Formula for r
Testing the Significance of r
Correlation – Specific Steps
Correlation – Specific Steps cont.
• Find the critical r in the table • Calculate the degrees of freedom
• N - 2
• α = .05
• Compare calculated r to critical r • If our calculated r is > critical r we reject the null hypothesis
• If our calculated r is < critical r we fail to reject the null hypothesis
Exercises
• See textbook page 377-379 for example
• See textbook page 393, question 16, 17, and 18 for practice
Partial Correlation
Find the Partial Correlation Coefficient- Specific Steps
Find the Partial Correlation Coefficient- Specific Steps
• Calculate the degrees of freedom • N – 3
• Look up the critical value in the Table H • alpha = .05
• Compare the calculated correlation to the critical value • If the calculated value is > critical value we reject the null hypothesis
• If the calculated value is < critical value we fail to reject the null hypothesis
Review- Regression
Exercises
• See textbook page 385-386 for example
• See textbook page 397, question 30 and 31 for practice
Review- Regression
Review- Regression Analysis Example
Regression Analysis- Example Cont.
Y = 1.56 + .86 X
(0, 1.56)
(4, 5)
Exercises
• See textbook page 403-406 for example
• See textbook page 435, question 6 and 7 for practice (a-d only)
Interpreting Regression Output
_cons 1.545455 1.420253 1.09 0.326 -2.105423 5.196332
x1 .8636364 .3246104 2.66 0.045 .0291988 1.698074
y1 Coef. Std. Err. t P>|t| [95% Conf. Interval]
Total 28 6 4.66666667 Root MSE = 1.5226
Adj R-squared = 0.5032
Residual 11.5909091 5 2.31818182 R-squared = 0.5860
Model 16.4090909 1 16.4090909 Prob > F = 0.0449
F( 1, 5) = 7.08
Source SS df MS Number of obs = 7
b a
T values P Values Confidence Intervals
N
Interpreting Regression Output
_cons 11 1.359676 8.09 0.004 6.672905 15.32709
x2 -.5 .2118296 -2.36 0.099 -1.174136 .1741364
y2 Coef. Std. Err. t P>|t| [95% Conf. Interval]
Total 10 4 2.5 Root MSE = 1.0801
Adj R-squared = 0.5333
Residual 3.5 3 1.16666667 R-squared = 0.6500
Model 6.5 1 6.5 Prob > F = 0.0994
F( 1, 3) = 5.57
Source SS df MS Number of obs = 5
Interpreting Regression Output
_cons .1500793 1.503553 0.10 0.921 -2.799602 3.099761
partyid7 11.81617 .3270595 36.13 0.000 11.17454 12.4578
obamatherm Coef. Std. Err. t P>|t| [95% Conf. Interval]
Total 1592752.78 1289 1235.64994 Root MSE = 24.783
Adj R-squared = 0.5029
Residual 791073.363 1288 614.187394 R-squared = 0.5033
Model 801679.413 1 801679.413 Prob > F = 0.0000
F( 1, 1288) = 1305.27
Source SS df MS Number of obs = 1290
. reg obamatherm partyid7
Interpreting Regression Output
_cons 52.86189 2.239573 23.60 0.000 48.46827 57.2555
poliinterest -2.110292 .9567143 -2.21 0.028 -3.987184 -.2333998
obamatherm Coef. Std. Err. t P>|t| [95% Conf. Interval]
Total 1592279.44 1287 1237.20236 Root MSE = 35.121
Adj R-squared = 0.0030
Residual 1586277.95 1286 1233.49763 R-squared = 0.0038
Model 6001.48622 1 6001.48622 Prob > F = 0.0276
F( 1, 1286) = 4.87
Source SS df MS Number of obs = 1288
Categorical/Ordinal
Dependent Variable
Interval Dependent
Variable
Categorical/ Ordinal
Independent Variable Chi Square Difference of Means
Interval Independent
Variable Not Covered! Correlation OR
Regression (bivariate)
Which method to use?
• You want to know whether there is a relationship between gender (male-female) and the vote (voted-did not vote). What test do you use?
• You want to know whether growing up in Long Island makes you more likely to be vote Republican (0 – not likely at all to 10 – very likely). What test do you use?
• You want to know whether there is a relationship between years of education and perceived competence of President Obama (0- not competent at all to 10 – very competent). What test do you use?