Saltar al contenido principal
LibreTexts Español

5.6: Computación de una distribución acumulativa (Sección 4.2.2)

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

    Calculemos una distribución acumulativa para la variable SleePhrsNight en NHANES. Esto se parece mucho a lo que vimos en la sección anterior.

    # create summary table for relative frequency of different
    # values of SleepHrsNight 
    
    SleepHrsNight_cumulative <- 
      NHANES_unique %>%
      # drop NA values for SleepHrsNight variable
      drop_na(SleepHrsNight) %>%
      # remove other variables
      dplyr::select(SleepHrsNight) %>%
      # group by values
      group_by(SleepHrsNight) %>%
      # create summary table
      summarize(AbsoluteFrequency = n()) %>%
      # create relative and cumulative frequencies
      mutate(
        RelativeFrequency = AbsoluteFrequency / sum(AbsoluteFrequency),
        CumulativeDensity = cumsum(RelativeFrequency)
      )
    
    kable(SleepHrsNight_cumulative)
    SleePhrsNight AbsoluteFrequency RelativoRequency Densidad Acumulativa
    2 9 0.00 0.00
    3 49 0.01 0.01
    4 200 0.04 0.05
    5 406 0.08 0.13
    6 1172 0.23 0.36
    7 1394 0.28 0.64
    8 1405 0.28 0.92
    9 271 0.05 0.97
    10 97 0.02 0.99
    11 15 0.00 1.00
    12 17 0.00 1.00

    This page titled 5.6: Computación de una distribución acumulativa (Sección 4.2.2) is shared under a not declared license and was authored, remixed, and/or curated by Russell A. Poldrack via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.