STEP 2: Collect (or load) the data

preference <- read.csv("preference.csv")
preference
##    preference primed
## 1         1.8      0
## 2         0.1      0
## 3         4.0      0
## 4         2.1      0
## 5         2.4      0
## 6         3.4      0
## 7         1.7      0
## 8         2.2      0
## 9         1.9      0
## 10        1.9      0
## 11        0.1      0
## 12        3.3      0
## 13        2.1      0
## 14        2.0      0
## 15        1.4      0
## 16        1.6      0
## 17        2.3      0
## 18        1.8      0
## 19        3.2      0
## 20        0.8      0
## 21        1.7      1
## 22        1.7      1
## 23        4.2      1
## 24        3.0      1
## 25        2.9      1
## 26        3.0      1
## 27        4.0      1
## 28        4.1      1
## 29        2.9      1
## 30        2.9      1
## 31        1.2      1
## 32        4.0      1
## 33        3.0      1
## 34        3.9      1
## 35        3.1      1
## 36        2.5      1
## 37        3.2      1
## 38        4.1      1
## 39        3.9      1
## 40        1.1      1
## 41        1.9      1
## 42        3.1      1

STEP 3: Describe the data

This data set consists of 42 rows with two columns. The rows in the data set contain each customer surveyed, and the columns indicate their level of preference and whether they were primed or unprimed. Preference measures the customer’s attitude toward a product rated from 0 (dislike very much) to 6 (like very much). The customers are also separeated into 20 unprimed and 22 primed, and the second coulmn denotes this by labeling unprimed individuals with (0) and primed individuals with (1). Participants who were primed are defined as having thought about the image they were shown earlier and in another context, and participants who were unprimed were not. As a result, both variables are quantitative because the numbers are representative the means of preference.

STEP 4: Identify the purpose of the study

The study is looking at whether individuals who are considered primed have differences in preference as opposed to those who are considered unprimed.

STEP 5: Visualize the data

library(ggplot2)
ggplot(data=preference, mapping = aes(x=as.factor(primed), y=preference)) + geom_point()

STEP 6: Interpret the plot

The plot suggests that primed individuals have higher values for preference as opposed to unprimed inidivduals. That said, the results could be due to chance without having done a test of significance. We also need a p-value to indicate whether the means of primed and unprimed individuals are equal or different, and a lower p-value will indicate that it is more likely that they are different.

STEP 7: Formulate the null hypothesis

The population for this study is all people. The study’s null hypothesis would be that the mean of primed individuals’ preferences is equal to the mean of unprimed individuals’ preferences and that the difference between these means is 0.

STEP 8: Identify the alternative hypothesis

The alternative hypothesis would be that the means of primed and unprimed individuals’ preferences are different or unequal.

STEP 9: Decide on type of test

The type of test that would be best for this case would be a t-test because we are testing the hypotheses in regard to the means–a quatitiative value–of the primed and unprimed groups’ preferences.

STEP 10: Choose one sample or two

We will use a two sample test because the samples come from two groups–primed and unprimed.

STEP 11: Check Assumptions

gg <- ggplot(data=preference)
gg + geom_qq(mapping=aes(sample=preference, color=as.factor(primed)))

The data are normal for both unprimed and primed individuals, but it is less so for the primed group.

STEP 12: Decide on a level of significance of the test

The level of significance for this case will be the traditional value of 0.05.

STEP 13: Perform the test

t.test(formula=preference~as.factor(primed), data=preference)
## 
##  Welch Two Sample t-test
## 
## data:  preference by as.factor(primed)
## t = -3.2072, df = 39.282, p-value = 0.002666
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.577912 -0.357543
## sample estimates:
## mean in group 0 mean in group 1 
##        2.005000        2.972727

STEP 14: Interpret the p-value

The p-value (0.002666) is far lower than the level of significance (0.05), so this would cause us to reject the null hypothesis.

STEP 15: Interpret the confidence interval

0 is not a value represented within the confidence interval, this result is consistent with the result of STEP 14. In other words, because 0 is not a value represented within the confidence interval, this upholds our rejection of the null hypothesis in STEP 14 because it is unlikely that the means are equal.

STEP 16: Interpret the sample estimates

So far, we have determined that the means of the primed and unprimed groups are not equal. According to our t-test, the mean of unprimed individuals is 2.005000 and the mean of primed individuals is 2.972727. From this, we can see that preference of primed individuals is not demonstrably larger than unprimed individuals.

STEP 17: State your conclusion

Though STEP 16 shows that primed individuals have a slightly higher mean than unprimed individuals, there is not a very large difference between the two groups.