Skip to main content
Statistics LibreTexts

1.8: Analysis of Variance

  • Page ID
    51964
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Introduction to ANOVA

    Analysis of variance (ANOVA) involves testing the statistical significance of differences among the mean scores of two or more groups on one or more variables. It serves as an extension of the t-test discussed in our previous class. The ANOVA procedure involves calculating an F ratio, which compares the variance between the groups to the variance within the groups. A large F ratio indicates greater variability between groups, attributed to the independent variable, compared to within each group, which represents random variability.

    Media Exposure and Perceptions of the Police

    Crime analysts do not always focus on numbers related to crime. Their research subjects can involve how people feel about crime or what people think about the police because residents' perceptions of crime and police can impact the operations of criminal justice professionals. In this chapter, we will use a trimmed version of data collected firsthand, focusing on a study I conducted. In my experiment (Choi, 2018), participants were randomly assigned to watch one of three video clips. The "police misconduct" condition depicted victims or their family members reflecting on police use of force. The "positive police" condition focused on the risks of police work and the sacrifices made by police officers. The "mixed" condition combined elements from both the "police misconduct" and "positive police" conditions to generate mixed messages about the police.

    This study aimed to examine whether there are differences in perceptions of the police among groups assigned to watch different police-related videos. There are various methods to measure such perceptions, which have been a subject of debate among policing scholars (Brown & Benedict, 2002; Cao, 2015). In my study, I employed confidence in the police scale, which was consistent with previous research (Gau, 2011; Reisig et al., 2007). This scale includes the following items:

    • People’s basic rights are well-protected by police officers in my community.
    • Police officers can be trusted to make decisions that are right for my community.
    • Most police officers in my community do their jobs well.
    • Police officers in my community are generally honest.

    Participants' responses to these survey items were measured on visual analog scales, which are psychometric scales allowing respondents to specify their responses visually on a continuous line between two ends.

    One-Way Analysis of Variance

    In this chapter, we will focus on one-way ANOVA, a statistical method used to analyze differences among the means of three or more independent groups on a single dependent variable. It is important to note that there are other types of ANOVA as well. For instance, two-way ANOVA examines the effects of two categorical independent variables on a single continuous dependent variable.

    You will first need to load the data. You will download the file from the shared Google Drive folder containing the media and police.sav data. Since the data is an SPSS file, you will follow the steps that we covered previously. Each row represents each participant. Condition refers to the experimental condition to which each participant was assigned. ConPolT1 represents respondents’ confidence in the police before watching the video, and ConPolT2 represents respondents’ confidence in the police after watching the video.

    library(haven)

    media_and_police <- read_sav("C:/Users/75JCHOI/OneDrive - West

    Chester University of PA/WCU Research/R/data/media and police.sav")

    View(media_and_police)

    When importing an SPSS file into an R environment, you might encounter the need for data recoding to effectively manage and clean your data. For instance, you may need to adjust the data type of certain variables for better suitability. In this case, let's focus on recoding the "Condition" variable. We aim to change the data type of the "Condition" variable to a factor and add category labels to enhance clarity. Specifically, we will label the categories as follows:

    • 1 = positive police image
    • 2 = negative police image
    • 3 = mixed police image (both positive and negative police images)

    We learned how to recode a variable and add category labels in a previous chapter.

    library(tidyverse)

    media_and_police_cleaned <-media_and_police %>%

    mutate(Condition = as.factor(Condition))

    class(x = media_and_police_cleaned$Condition)

    media_and_police_cleaned <- media_and_police_cleaned %>%

    mutate(Condition = recode(Condition,

    "1" = "Positive Police Video",

    "2" = "Negative Police Video",

    "3" = "Mixed Police Video"))

    summary(media_and_police_cleaned)

    NHST Steps for One-Way ANOVA

    We may want to determine whether there is a significant difference in the mean scores for confidence in the police across groups who watched different videos. As mentioned in previous chapters, NHST intends to draw conclusions about the population based on the data from our sample.

    Step 1: Formulate the Null and Alternative Hypotheses.

    • H0: The mean scores for confidence in the police are equal across groups who watched different videos.
    • HA: The mean scores for confidence in the police are not equal across groups who watched different videos.

    Step 2: Calculate the Test Statistic.

    police.by.con <- oneway.test(formula = ConPolT2 ~ Condition,

    data = media_and_police_cleaned,

    var.equal = TRUE)

    police.by.con

    The F statistic is 0.49287.

    Step 3: Determine the Probability (P-Value) of Obtaining a Test Statistic at Least as Extreme as the Observed Value, Assuming no Relationship Exists.

    The p-value obtained is 0.6114, which is considerably larger than the conventional significance level of 0.05. When the p-value is this large, it suggests that the observed result is not statistically significant, indicating no evidence to reject the null hypothesis. It is common to observe such small F-statistics when the null hypothesis is true.

    Steps 4 & 5: If the P-Value is Very Small, Typically Less Than 5%, Reject the Null Hypothesis, but if the P-Value is Not Small,Typically 5% or Greater, Retain the Null Hypothesis.

    With a p-value > 0.05, the ANOVA indicates that these groups likely came from a population with similar mean scores for confidence in the police by different experimental conditions.

    Reporting the Results From One-Way ANOVA

    A one-way ANOVA was conducted to explore the impact of media exposure on confidence in the police. Participants were randomly assigned to watch one of the three conditions (Group 1: Positive Police Video, Group 2: Negative Police Video, and Group 3: Mixed Police Video). There was no statistically significant difference at the p < .05 level in confidence in the police F(2, 296) = 0.49, p = 0.61.

    Post-Hoc Test

    A post-hoc test is a statistical test conducted after ANOVA to assess the significance of differences between group means when an overall difference is detected. The F ratio from ANOVA indicates the presence of significant differences among the groups, and post-hoc tests aim to identify the specific nature and location of these differences (Vogt & Johnson, 2011).

    While the results from our one-way ANOVA suggest that the mean scores for confidence in the police are equal across groups who watched different videos, we will conduct a post-hoc test for demonstration purposes.

    There are many types of post-hoc tests, but I will use Tukey’s honestly significant difference (HSD) test to identify which groups differ.

    tukey.police.by.con <-TukeyHSD(x = aov(formula = ConPolT2 ~

    Condition, data = media_and_police_cleaned))

    tukey.police.by.con

    The "diff" column represents the difference between the means in the sample. The "lwr" and "upr" columns denote the lower and upper bounds of a confidence interval around the "diff" value. The "p adj" column displays the adjusted p-value, indicating the statistical significance of the difference after adjusting for multiple comparisons. Not surprisingly, confidence in the police was not significantly different between any of these groups.

    Conclusion

    In this chapter, we covered ANOVA, which compares the mean scores of more than two groups. In the next chapter, we will learn about correlation.

    References

    Brown, B., & Benedict, W. R. (2002). Perceptions of the police: Past findings, methodological issues, conceptual issues and policy implications. Policing: An International Journal of Police Strategies & Management, 25(3), 543-580.

    Cao, L. (2015). Differentiating confidence in the police, trust in the police, and satisfaction with the police. Policing: An International Journal of Police Strategies & Management, 38(2), 239-249. https://doi.org/10.1108/pijpsm-12-2014-0127

    Choi, J. (2018). Media exposure, confidence in the police, and police legitimacy Indiana University of Pennsylvania]. Indiana, PA.

    Gau, J. M. (2011). The Convergent and Discriminant Validity of Procedural Justice and Police Legitimacy: An Empirical Test of Core Theoretical Propositions. Journal of Criminal Justice, 39(6), 489-498. https://doi.org/10.1016/j.jcrimjus.2011.09.004

    Reisig, M. D., Bratton, J., & Gertz, M. G. (2007). The Construct validity and refinement of process-based policing measures. Criminal Justice and Behavior, 34(8), 1005-1028. https://doi.org/10.1177/0093854807301275

    Vogt, W. P., & Johnson, R. B. (2011). Dictionary of statistics & methodology: A nontechnical guide for the social sciences (4th ed.). Sage.


    This page titled 1.8: Analysis of Variance is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Jaeyong Choi (The Pennsylvania Alliance for Design of Open Textbooks (PA-ADOPT)) via source content that was edited to the style and standards of the LibreTexts platform.