rootogram                package:vcd                R Documentation

_R_o_o_t_o_g_r_a_m_s

_D_e_s_c_r_i_p_t_i_o_n:

     Rootograms of observed and fitted values.

_U_s_a_g_e:

     ## Default S3 method:
     rootogram(x, fitted, names = NULL, scale = c("sqrt", "raw"),
       type = c("hanging", "standing", "deviation"),
       rect_gp = gpar(fill = "lightgray"), lines_gp = gpar(col = "red"),
       points_gp = gpar(col = "red"), pch = 19,
       xlab = NULL, ylab = NULL, ylim = NULL,
       name = "rootogram", newpage = TRUE, pop = TRUE, ...)

_A_r_g_u_m_e_n_t_s:

       x: either a vector or a 1-way table of frequencies.

  fitted: a vector of fitted frequencies.

   names: a vector of names passed to 'grid_barplot', if set to 'NULL'
          the names of 'x' are used.

   scale: a character string indicating whether the values should be
          plotted on the raw or square root scale.

    type: a character string indicating if the bars for the observed
          frequencies should be hanging or standing or indicate the
          deviation between observed and fitted frequencies.

 rect_gp: a '"gpar"' object controlling the grid graphical parameters
          of the rectangles.

lines_gp: a '"gpar"' object controlling the grid graphical parameters
          of the lines.

points_gp: a '"gpar"' object controlling the grid graphical parameters
          of the points.

     pch: plotting character for the points.

    xlab: a label for the x axis.

    ylab: a label for the y axis.

    ylim: limits for the y axis.

    name: name of the plotting viewport.

 newpage: logical. Should 'grid.newpage' be called  before plotting?

     pop: logical. Should the viewport created be popped?

     ...: further arguments passed to 'grid_barplot'.

_D_e_t_a_i_l_s:

     The observed frequencies are displayed as bars and the fitted
     frequencies as a line.  By default a sqrt scale is used to make
     the smaller frequencies more visible.

_A_u_t_h_o_r(_s):

     Achim Zeileis Achim.Zeileis@R-project.org

_R_e_f_e_r_e_n_c_e_s:

     J. W. Tukey (1977), _Exploratory Data Analysis_. Addison Wesley,
     Reading, MA.

     M. Friendly (2000), _Visualizing Categorical Data_. SAS Institute,
     Cary, NC.

_S_e_e _A_l_s_o:

     'grid_barplot'

_E_x_a_m_p_l_e_s:

     ## Simulated data examples:
     dummy <- rnbinom(200, size = 1.5, prob = 0.8)
     observed <- table(dummy)
     fitted1 <- dnbinom(as.numeric(names(observed)),
                        size = 1.5, prob = 0.8) * sum(observed)
     fitted2 <- dnbinom(as.numeric(names(observed)),
                        size = 2, prob = 0.6) * sum(observed)
     rootogram(observed, fitted1)
     rootogram(observed, fitted2)

     ## Real data examples:
     data(HorseKicks)
     HK.fit <- goodfit(HorseKicks)
     summary(HK.fit)
     plot(HK.fit)
     ## or equivalently
     rootogram(HK.fit)

     data(Federalist)
     F.fit <- goodfit(Federalist, type = "nbinomial")
     summary(F.fit)
     plot(F.fit)

