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"),
                                 bar.col = grey(0.7), line.col = 2,
                                 xlab = NULL, ylab = NULL, ylim = NULL, ...)

_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 barplot, if set to 'NULL' the
          names of 'x' are used.

   scale: a character string indicating wether 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.

 bar.col: bar color (observed frequencies).

line.col: line color (fitted frequencies).

    xlab: a label for the x axis.

    ylab: a label for the y axis.

    ylim: limits for the y axis.

     ...: further arguments passed to '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 log scale is used to make the
     smaller frequencies more visible.

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

     Achim Zeileis

_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.

_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)

