svyhist                package:survey                R Documentation

_H_i_s_t_o_g_r_a_m_s _a_n_d _b_o_x_p_l_o_t_s

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

     Histograms and boxplots weighted by the sampling weights.

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

     svyhist(formula, design, breaks = "Sturges",
           include.lowest = TRUE, right = TRUE, xlab = NULL,
            main = NULL, probability = TRUE, freq = !probability, ...)
     svyboxplot(formula, design,...)

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

 formula: One-sided formula for 'svyhist', two-sided for 'svyboxplot'

  design: A survey design object

    xlab: x-axis label

    main: Main title

probability,freq: Y-axis is probability density or frequency

breaks, include.lowest, right: As for 'hist'

     ...: Other arguments to 'hist' or 'bxp'

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

     The histogram breakpoints are computed as if the sample were a
     simple random sample of the same size.

     The grouping variable in 'svyboxplot', if present, must be a
     factor.

     The boxplot whiskers go to the maximum and minimum observations or
     to 1.5 interquartile ranges beyond the end of the box, whichever
     is closer. The maximum and minimum are plotted as outliers if they
     are beyond the ends of the whiskers, but other outlying points are
     not plotted. This may  change in the future.  'svyboxplot'
     requires a two-sided formula; use 'variable~1' for a single
     boxplot.

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

     'svyplot'

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

     data(api)
     dstrat <- svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat, 
         fpc = ~fpc)
     opar<-par(mfrow=c(1,3))
     svyhist(~enroll, dstrat, main="Survey weighted",col="purple",ylim=c(0,1.3e-3))
     hist(apistrat$enroll,  main="Sample unweighted",col="purple",prob=TRUE,ylim=c(0,1.3e-3))
     hist(apipop$enroll,  main="Population",col="purple",prob=TRUE,ylim=c(0,1.3e-3))

     par(mfrow=c(1,1))
     svyboxplot(enroll~stype,dstrat)
     svyboxplot(enroll~1,dstrat)
     par(opar)

