plot.poplab              package:poplab              R Documentation

_P_l_o_t _t_h_e _a_g_e _p_r_o_f_i_l_e _o_f _a _s_i_m_u_l_a_t_e_d _p_o_p_u_l_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Plot a comparison between the simulated population and real
     population age profiles for a specified calendar year, separately
     for females and males. 

     The function looks in the specified folder for 2 tab-separated
     files containing age-specific counts from the real female and male
     population.

_U_s_a_g_e:

     ## S3 method for class 'poplab':
     plot (x, option, population.fem, 
     population.male, year, folder, ...)

_A_r_g_u_m_e_n_t_s:

       x: an object returned by the 'create.baseline.complete' or the
          'simped' functions.

  option: simulated population source. 2 possible values '"base"' and
          '"current"' (see Details).  The default is '"current"'.

population.fem: name (quoted) of the tab-separated file storing
          age-specific counts from the real female population (e.g.
          '"populationfem.txt"').

population.male: name (quoted) of the tab-separated file storing
          age-specific counts from the real male population (e.g.
          '"populationmale.txt"')

    year: the year for which to plot the comparison

  folder: folder (quoted) where the function looks for the real
          population files. For example,  it might be your
          R_HOME/library/poplab/data/ directory,  where R_HOME is the
          location where R is installed on your computer (see Examples
          below).

     ...: further arguments passed to or from other methods

_D_e_t_a_i_l_s:

     'option' specifies which simulated population to be displayed:
      '"base"' requires a virtual baseline population (an object
     returned by the  'create.baseline.complete' function or the first
     list component  returned by the 'simped' function). 
      '"current"' requires the population alive during the year
     specified by 'year'; this is the second component of the list
     returned by the 'simped' function.

_N_o_t_e:

     (1) If 'yyyy' is the value of 'year' and is smaller than the *last
     simulated year* (either the 'baseyear' when plotting a baseline
     population or the 'endyear' when plotting an evolved population),
     the function will first exclude from the simulated population
     those individuals born after 'yyyy'. 

     (2) If 'yyyy' is greater than the last simulated year, the
     function will plot a comparison of the real population of the year
     'yyyy' and the simulated population that was still alive during
     the last simulated year, only older with the calendar interval
     between the last simulated year and 'yyyy'. This is not a
     recommended use of the function.

_S_e_e _A_l_s_o:

     'create.baseline.complete', 'simped', 'print.poplab'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     For the following examples it is necessary to load the simpop
     object or to use the simped function and assign the result to
     a variable called 'simpop'.
     ## End(Not run)

     ## load simulate the population for the calendar period 1955-2002:

     load (file = file.path(system.file("data", package = "poplab"), 
     "simpop.Rdata"))

     ## plot the simulated population versus the real population
     ## for the calendar year 1990:
     plot.poplab(x = simpop, option = "current", population.fem =
     "populationfem.txt", population.male = "populationmale.txt",
     year = 1990, folder =
     system.file("data", package = "poplab")) 

     ## plot the baseline population versus the real population
     ## for the calendar year 1955:
     plot.poplab(x = simpop, option = "base", population.fem =
     "populationfem.txt", population.male = "populationmale.txt",
     year = 1955, folder =
     system.file("data", package = "poplab")) 

