Chapter 10 -Questions 1, 5, 10, 15, and 20, 24-26
Chapter 11 -Questions 4, 8, 14, and 18, 20-24
Chapter 12 -Questions 8, 9, and 11, 21, and 22
Chapter 13 -Question 5
Q: When would the mean grade in a class on a final exam be considered a statistic? When would it be considered a parameter?
A: This would be a parameter since the entire population is known. A parameter is a value calculated in a population. A statistic is a value computed in a sample to estimate a parameter.
Q: When you construct a 95% confidence interval, what are you 95% confident about?
A: If repeated samples were taken and the 95% confidence interval computed for each sample, 95% of the intervals would contain the population mean.
Q: The effectiveness of a blood-pressure drug is being investigated. How might an experimenter demonstrate that, on average, the reduction in systolic blood pressure is 20 or more?
A: First, they would need to have samples of both the non-usage population (the control) and the using population (the test). Or we can assume we already have the target measurable cohort of the control group’s mean systolic blood pressure to test against.
From the test population samples we can start to plot the sample means to determine a standard deviation, also known as the sampling error SDm, calculated by SD / sqrt(N), where N = number of samples. From there we could create the upper and lower limits of our 95% confidence interval by saying the upper limit = M + z.95 * SDm and the lower limit would simply be M - z.95 * SDm. In this case N would be our population Mean 20, and z.95 * SDm would represent 1.96 standard deviations. once we created our upper and lower limits we would be able to say with 95% confidence that Mu fell between those two values LL < Mu < UL. And if the UL of that Confidence interval was 20 points below the control groups mean systolic blood pressure. Then we’d be 95% confidence our blood pressure medication worked!
Q: You take a sample of 22 from a population of test scores, and the mean of your sample is 60. (a) You know the standard deviation of the population is 10. What is the 99% confidence interval on the population mean. (b) Now assume that you do not know the population standard deviation, but the standard deviation in your sample is 10. What is the 99% confidence interval on the mean now?
A:# FIX THIS FIRST YOU USE THE NORMAL. USE T DISTRIBUTION IN PART B.
First I can compute my standard error by divided my population SD (10) by the square root of the the sample size (22) and find SDm = 2.1320072. For a CI of 99% the number of standard deviations + or - from my mean is still 2.576.
Which means my + or - from the mean is = or - 25.76.
Or my upper and lower limits are (54.5079495, 65.4920505)
Because our population variance is unknown, I am using the t distribution to calculate my confidence upper and lower bounds. First I need my degrees of freedom, which is N-1 or 21.
Using a t-table as a guide I know the + or - standard deviations that capture 99% CI are 2.52.
Because know my sample SD, then I know my standard error, and SDm = 10. Which means my + or - from the mean is = or - 25.2.
Or my upper and lower limits are (34.8, 85.2)
Q: True/false: You have a sample of 9 men and a sample of 8 women. The degrees of freedom for the t value in your confidence interval on the difference between means is 16.
A: FALSE! The degrees of freedom is equal to (n1 - 1) + (n2 - 1) where n1 is the sample size of the first group and n2 is the sample size of the second group. In this case n1 = 9 and n2 = 8, so my DOF = 15.
Q: Is there a difference in how much males and females use aggressive behavior to improve an angry mood? For the “Anger-Out” scores, compute a 99% confidence interval on the difference between gender means.
A:
q24file <- read.csv(file = "angry_moods.csv", header = TRUE)
data.frame(table(q24file$Gender))
## Var1 Freq
## 1 1 30
## 2 2 48
q24file_men <- q24file[q24file$Gender == 1,]
q24file_women <- q24file[q24file$Gender == 2,]
men_AO_mean <- mean(q24file_men$Anger.Out)
women_AO_mean <- mean(q24file_women$Anger.Out)
men_AO_var <- var(q24file_men$Anger.Out)
women_AO_var <- var(q24file_women$Anger.Out)
#From the description of the data set that 1 = males, 2 = female - we have 30 males and 48 females sampled.
#The first step is to compute the estimate of the standard error of the difference between means
std.err.delta.q24 <- sqrt((men_AO_var/30)+(women_AO_var/48))
# The next step is to find the t to use for the confidence interval (tCL)
# To calculate tCL, we need to know the degrees of freedom.
# From my t table I can see the 99% CI value with DOF = 76 is 2.6421
DOF <- (29+47)
tCL <- 2.6421
#Now we calculate the difference in the means
d.means.q24 <- men_AO_mean - women_AO_mean
#And from there we can create the upper and lower limits
c10.q24.ul <- d.means.q24 + tCL * std.err.delta.q24
c10.q24.ll <- d.means.q24 - tCL * std.err.delta.q24
The raw difference in means for gender anger out scores is 16.5666667 minus 15.7708333 = 0.7958333
Our T table 99% confidence interval is 2.6421
Our Standard error of the difference in means estimate is 0.9956087
That leaves us with a upper and lower threshold of a 99% confidence interval of (-1.8346644, 3.4263311)
Q: Calculate the 95% confidence interval for the difference between the mean Anger-In score for the athletes and non-athletes. What can you conclude?
A:
q25file <- read.csv(file = "angry_moods.csv", header = TRUE)
data.frame(table(q25file$Sports))
## Var1 Freq
## 1 1 25
## 2 2 53
q25file_ath <- q25file[q25file$Sports == 1,]
q25file_non_ath <- q25file[q25file$Sports == 2,]
ath_AI_mean <- mean(q25file_ath$Anger.In)
non_ath_AI_mean <- mean(q25file_non_ath$Anger.In)
ath_AI_var <- var(q25file_ath$Anger.In)
non_ath_AI_var <- var(q25file_non_ath$Anger.In)
#From the description of the data set that 1 = athletes, 2 = non-athletes - we have 25 athletes & 53 non sampled.
#The first step is to compute the estimate of the standard error of the difference between means
std.err.delta.q25 <- sqrt((ath_AI_var/25)+(non_ath_AI_var/53))
# The next step is to find the t to use for the confidence interval (tCL)
# To calculate tCL, we need to know the degrees of freedom.
# From my t table I can see the 99% CI value with DOF = 76 is 2.6421
#Now we calculate the difference in the means
d.means.q25 <- non_ath_AI_mean - ath_AI_mean
#And from there we can create the upper and lower limits
c10.q25.ul <- d.means.q25 + tCL * std.err.delta.q25
c10.q25.ll <- d.means.q25 - tCL * std.err.delta.q25
The raw delta in means for non/athletes anger-in scores is 19.4716981 minus 16.68 = 2.7916981
Our T table 99% confidence interval is still 2.6421 since we have the same sample size.
Our Standard error of the difference in means estimate is 0.9963762
That leaves us with a upper and lower threshold of a 99% confidence interval of (0.1591725, 5.4242237)
Q: Find the 95% confidence interval on the population correlation between the Anger-Out and Control-Out scores.
A:
q26file <- read.csv(file = "angry_moods.csv", header = TRUE)
q26_AI <- q26file$Anger.In
q26_AO <- q26file$Anger.Out
q26file_AI_corr <- cor(q26_AI,q26_AO)
z_trans = 0.5 * (log(1+q26file_AI_corr) - log(1-q26file_AI_corr))
N=78
z_trans_st_error = 1/sqrt(N-3)
q26_ul <- q26file_AI_corr + (1.96 * z_trans_st_error)
q26_ll <- q26file_AI_corr - (1.96 * z_trans_st_error)
The correlation coefficient between the anger out and anger in scores is 0.0160864
Because the Pearson’s sampling correlation coefficient is not normally distributed we need to use Fisher’s z-transformation of formula z’ = .5[ln(1+r) – ln(1-r)].
In this case r = q26file_AI_corr which is the correlation coefficient between the anger out and anger in scores, 0.0160864, which would makes our z’ = 0.0160878.
We can then use this z’ to calculate the new transformed and roughly normally distributed standard error of z_trans_st_error, or 0.1154701
From here we can simply take our correlation value and add and subtract our 95%CI terms of 1.96 * z’ and we get:
The upper and lower limits of (-0.2102349,0.2424077)
Q: State the null hypothesis for:
1. An experiment testing whether echinacea decreases the length of colds.
2. A correlational study on the relationship between brain size and intelligence.
3. An investigation of whether a self-proclaimed psychic can predict the outcome of a coin flip.
4. A study comparing a drug with a placebo on the amount of pain relief. (A one-tailed test was used.)
A:1. The average mean of cold duration for those who took echinacea and those who did not are equal.
2. There is no statistically significant correlation betweeen brain size and intelligence.
3. The mean probability of the pyschic’s predictions = 0.5
4. The drug’s affect on pain is better than a placebo’s affect.
Q: A significance test is performed and p = .20. Why can’t the experimenter claim that the probability that the null hypothesis is true is .20?
A: The probability value is the probability of an outcome given the hypothesis. It is not the probability of the hypothesis given the outcome. In the aforementioned statement the experimenter is doing exactly the latter, which is incorrect.
Q: Why is “Ho:”M1 = M2" not a proper null hypothesis?
A: It could be if we defined M1 and M2 and we clearly spelled out the difference in our original hypothesis. But in this standalone version, without context, we cannot.
Q: You choose an alpha level of .01 and then analyze your data. (a) What is the probability that you will make a Type I error given that the null hypothesis is true? (b) What is the probability that you will make a Type I error given that the null hypothesis is false?
A: “By one common convention, if the probability value is below 0.05, then the null hypothesis is rejected. Another convention, although slightly less common, is to reject the null hypothesis if the probability value is below 0.01. The threshold for rejecting the null hypothesis is called the α (alpha) level or simply α. It is also called the significance level.” “It is better to interpret the probability value as an indication of the weight of evidence against the null hypothesis than as part of a decision rule for making a reject or do-not-reject decision. Therefore, keep in mind that rejecting the null hypothesis is not an all-or-nothing decision.”
Because our alpha level (significance level) is so low, the chances we will reject the null hypothesis by mistake, is therefore also extremely low. With a value of 0.01 we can feel confident we will not make a type I error by mistakenly rejecting the null hypothesis.
The second type of mistake that can be made is a Type II error, or failing to reject a false null hypothesis when we should have. Because we don’t know enough about the data set or null hypothesis that lead to these alpha levels we cannot really say what the likelihood of a Type II error is. “Unlike a Type I error, a Type II error is not really an error. When a statistical test is not significant, it means that the data do not provide strong evidence that the null hypothesis is false. Lack of significance does not support the conclusion that the null hypothesis is true. Therefore, a researcher should not make the mistake of incorrectly concluding that the null hypothesis is true when a statistical test was not significant. Instead, the researcher should consider the test inconclusive. Contrast this with a Type I error in which the researcher erroneously concludes that the null hypothesis is false when, in fact, it is true.”
Q: True/false: It is easier to reject the null hypothesis if the researcher uses a smaller alpha (α) level.
A: TRUE: See comments in question 18. If we have a small probability of an event happening by “one common convention, if the probability value is below 0.05, then the null hypothesis is rejected”
Q: True/false: You are more likely to make a Type I error when using a small sample than when using a large sample.
A: FALSE: See comments in question 18. The sample size is not the determining factor when concerning yourself over the risk of a Type I Error. It’s the size of the probability of the weight of evidence against the null hypothesis that helps you avoid a Type I Error.
Q: True/false: You accept the alternative hypothesis when you reject the null hypothesis.
A: TRUE: “If the null hypothesis is rejected, then the alternative to the null hypothesis (called the alternative hypothesis) is accepted.”
Q: True/false: You do not accept the null hypothesis when you fail to reject it.
A: TRUE: There could be infinite Null Hypotheses, failing to reject one does not mean you accept all.
Q: True/false: A researcher risks making a Type I error any time the null hypothesis is rejected.
A: TRUE: Since by definition a Type I error is mistakenly rejecting a null hypotheses, you’ve automatically made yourself (the researcher has) vulnerable to this type of error.
Q: Participants threw darts at a target. In one condition, they used their preferred hand; in the other condition, they used their other hand. All subjects performed in both conditions (the order of conditions was counterbalanced). Their scores are shown below.
Preferred <- c(12,7,11, 13, 10)
Non_Preferred <- c(7,9,8,10,9)
darts_matrix <- cbind(Preferred, Non_Preferred)
darts_matrix
## Preferred Non_Preferred
## [1,] 12 7
## [2,] 7 9
## [3,] 11 8
## [4,] 13 10
## [5,] 10 9
A: Because we have one population we’re testing two ways, we should use a paired T-Test.
A: Below
#We use var.test to check that the variances of our two data groups are unequal. If they ARE unequal then we can let the t.test() function default to Welch's test. If they are EQUAL we will need to set var.equal=TRUE within the t.test() function.
var.test(Preferred, Non_Preferred)
##
## F test to compare two variances
##
## data: Preferred and Non_Preferred
## F = 4.0769, num df = 4, denom df = 4, p-value = 0.2022
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.4244792 39.1569295
## sample estimates:
## ratio of variances
## 4.076923
# Since they are unequal we can run a standard Welch's t.test() on the data. By default R runs a two-tailed test, so we need to set the Alternative argument equal to "greater" or "less" for a one-tailed test.
t.test(Preferred, Non_Preferred, alternative = "greater", paired=TRUE)
##
## Paired t-test
##
## data: Preferred and Non_Preferred
## t = 1.6903, df = 4, p-value = 0.08312
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -0.5224351 Inf
## sample estimates:
## mean of the differences
## 2
t.test(Preferred, Non_Preferred, alternative = "less", paired=TRUE)
##
## Paired t-test
##
## data: Preferred and Non_Preferred
## t = 1.6903, df = 4, p-value = 0.9169
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf 4.522435
## sample estimates:
## mean of the differences
## 2
#Running it again without an alternative argument will give us the two-tailed test results
t.test(Preferred, Non_Preferred, paired=TRUE)
##
## Paired t-test
##
## data: Preferred and Non_Preferred
## t = 1.6903, df = 4, p-value = 0.1662
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -1.285134 5.285134
## sample estimates:
## mean of the differences
## 2
Q: Assume the data in the previous problem were collected using two different groups of subjects: One group used their preferred hand and the other group used their non-preferred hand. Analyze the data and compare the results to those for the previous problem
A: Below
# Rerunning it without the paired = TRUE argument gives us
t.test(Preferred, Non_Preferred, alternative = "greater")
##
## Welch Two Sample t-test
##
## data: Preferred and Non_Preferred
## t = 1.7408, df = 5.8509, p-value = 0.06681
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -0.242774 Inf
## sample estimates:
## mean of x mean of y
## 10.6 8.6
t.test(Preferred, Non_Preferred, alternative = "less")
##
## Welch Two Sample t-test
##
## data: Preferred and Non_Preferred
## t = 1.7408, df = 5.8509, p-value = 0.9332
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf 4.242774
## sample estimates:
## mean of x mean of y
## 10.6 8.6
#Running it again without an alternative argument will give us the two-tailed test results
t.test(Preferred, Non_Preferred)
##
## Welch Two Sample t-test
##
## data: Preferred and Non_Preferred
## t = 1.7408, df = 5.8509, p-value = 0.1336
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.8287445 4.8287445
## sample estimates:
## mean of x mean of y
## 10.6 8.6
Q: In an experiment, participants were divided into 4 groups. There were 20 participants in each group, so the degrees of freedom (error) for this study was 80 - 4 = 76. Tukey’s HSD test was performed on the data. (a) Calculate the p value for each pair based on the Q value given below. You will want to use the Studentized Range Calculator. (b) Which differences are significant at the .05 level?
A: Below
Comparison_of_Groups <- c("A-B","A-C","A-D","B-C","B-D","C-D")
Q_score <- c(3.4, 3.8 ,4.3, 1.7, 3.9, 3.7)
# In order to calculate the P value for each pair based on the Q value given I used the Studentized Range Calculator provided. Q was given form the table, the number of means is 6, and the degrees of freedom is 76. Below is that vector.
p_two_tailed <- c(0.1679, 0.0898, 0.0367, 0.8345, 0.0758, 0.1058)
Comparison_Q_Matrix <- data.frame(Comparison_of_Groups, Q_score, p_two_tailed)
Comparison_Q_Matrix
## Comparison_of_Groups Q_score p_two_tailed
## 1 A-B 3.4 0.1679
## 2 A-C 3.8 0.0898
## 3 A-D 4.3 0.0367
## 4 B-C 1.7 0.8345
## 5 B-D 3.9 0.0758
## 6 C-D 3.7 0.1058
# Based on the output of our p values the differences that are significant with P closest to the 0.05 mark are 3.8 and 4.3. In fact, by back calculating I can find the Studentized T value is actually 4.135 that corresponds to a P value of 0.05.
Q: (AM#17) Do athletes or non-athletes calm down more when angry? Conduct a t test to see if the difference between groups in Control-In scores is statistically significant.
q25file <- read.csv(file = "angry_moods.csv", header = TRUE)
data.frame(table(q25file$Sports))
## Var1 Freq
## 1 1 25
## 2 2 53
q25file_ath <- q25file[q25file$Sports == 1,]
q25file_non_ath <- q25file[q25file$Sports == 2,]
#We use var.test to check that the variances of our two data groups are unequal. If they ARE unequal then we can let the t.test() function default to Welch's test. If they are EQUAL we will need to set var.equal=TRUE within the t.test() function.
var.test(q25file_ath$Control.In, q25file_non_ath$Control.In)
##
## F test to compare two variances
##
## data: q25file_ath$Control.In and q25file_non_ath$Control.In
## F = 0.8972, num df = 24, denom df = 52, p-value = 0.7921
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.4673296 1.8846436
## sample estimates:
## ratio of variances
## 0.897197
#Our variances are close (ratio of 0.89), but not close enough to make a claim against Welch's. So we run a t-test below.
t.test(q25file_ath$Control.In, q25file_non_ath$Control.In)
##
## Welch Two Sample t-test
##
## data: q25file_ath$Control.In and q25file_non_ath$Control.In
## t = 3.1049, df = 49.549, p-value = 0.003144
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 1.225079 5.716807
## sample estimates:
## mean of x mean of y
## 24.32000 20.84906
#I also ran a T.test with assumed consistent variances between our two groups, just to see the difference.
t.test(q25file_ath$Control.In, q25file_non_ath$Control.In, var.equal = TRUE)
##
## Two Sample t-test
##
## data: q25file_ath$Control.In and q25file_non_ath$Control.In
## t = 3.0443, df = 76, p-value = 0.003203
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 1.200155 5.741731
## sample estimates:
## mean of x mean of y
## 24.32000 20.84906
# In BOTH INSTANCES we had p-values well into the statistically significant range. In the former it's 0.003144 and in the latter it's 0.003203.
Q: Do people in general have a higher Anger-Out or Anger-In score? Conduct a t test on the difference between means of these two scores. Are these two means independent or dependent?
mean_AI <- mean(q25file$Anger.In)
mean_AO <- mean(q25file$Anger.Out)
mean_AI
## [1] 18.57692
mean_AO
## [1] 16.07692
var.test(q25file$Anger.In, q25file$Anger.Out)
##
## F test to compare two variances
##
## data: q25file$Anger.In and q25file$Anger.Out
## F = 1.2406, num df = 77, denom df = 77, p-value = 0.3462
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.7910036 1.9457162
## sample estimates:
## ratio of variances
## 1.240592
# The results show that generally, there is not a fair degree of correlation between Anger In and Anger Out. With a p-value of 0.342 we cannot feel good there's a relation.
Q: Alan, while snooping around his grandmother’s basement stumbled upon a shiny object protruding from under a stack of boxes . When he reached for the object a genie miraculously materialized and stated: “You have found my magic coin. If you flip this coin an infinite number of times you will notice that heads will show 60% of the time.” Soon after the genie’s declaration he vanished, never to be seen again. Alan, excited about his new magical discovery, approached his friend Ken and told him about what he had found. Ken was skeptical of his friend’s story, however, he told Alan to flip the coin 100 times and to record how many flips resulted with heads.
What is the probability that Alan will be able convince Ken that his coin has special powers by finding a p value below 0.05 (one tailed). Use the Binomial Calculator (and some trial and error)
A: Because we know that our coin has “special powers” and has a probability of any given flip of 0.6, when plugging in the data into my binomial probability calculator, I can see with an X value at 68 or above I fulfill the probabily of < 0.05 requirement.
If Ken told Alan to flip the coin only 20 times, what is the probability that Alan will not be able to convince Ken (by failing to reject the null hypothesis at the 0.05 level)?
A: Rerunning my numbers for a sample size (flips) of 20 means I need to be at 16 or above to hit a probability below the 0.05 threshold.