Saltar al contenido principal
LibreTexts Español

11.4: Simulación de ANOVA de un factor

  • Page ID
    150335
  • \( \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}}} \)

    A continuación se construyen datos simulados para un ANOVA de un factor, apropiado para un diseño entre sujetos. Construimos el marco de datos con una columna para los niveles de factor de grupo y una columna para el DV. Entonces, ejecutamos el ANOVA y lo imprimimos.

    library(xtable)
    N <- 10
    groups <- rep(c("A","B","C"), each=10)
    DV <- c(rnorm(100,10,15),   # means for group A
            rnorm(100,10,15),   # means for group B
            rnorm(100,20,15)    # means for group C
            )
    sim_df<-data.frame(groups,DV)
    aov_results <- summary(aov(DV~groups, sim_df))
    knitr::kable(xtable(aov_results))
      Df Suma Sq Cuadrados medios Valor F Pr (>F)
    grupos 2 1187.127 593.5635 2.683555 F)" style="vertical-align:middle;">0.0699765
    Residuales 297 65692.093 221.1855 NA F)" style="vertical-align:middle;">NA

    En este siguiente ejemplo, simulamos el mismo diseño 100 veces, guardamos\(p\) los valores -y determinamos la proporción de simulaciones significativas.

    N <- 10
    save_p<-length(100)
    for(i in 1:100){
      groups <- rep(c("A","B","C"), each=10)
      DV <- c(rnorm(100,10,15),   # means for group A
              rnorm(100,10,15),   # means for group B
              rnorm(100,20,15)    # means for group C
              )
      sim_df<-data.frame(groups,DV)
      
      aov_results <- summary(aov(DV~groups, sim_df))
      save_p[i]<-aov_results[[1]]$`Pr(>F)`[1]
    }
    length(save_p[save_p<0.05])/100
    0.07

    This page titled 11.4: Simulación de ANOVA de un factor is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Matthew J. C. Crump via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.