plot.poplab: Plot the age profile of a simulated population

Description Usage Arguments Details See Also Examples

Description

Plot a comparison between the simulated population and real population age profiles, 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.

Usage

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

Arguments

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 containing age-specific counts from the real female population (e.g. "populationfem.txt").

population.male

name (quoted) of the tab-separated file containing 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 R_HOME/library/poplab/extdata/ directory, where R_HOME is the location where R is installed on your computer (see Examples below).

...

further arguments used e.g., other plot options

Details

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.

See Also

create.baseline.complete, simped, print.poplab

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## 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 1954-2007:

load (file = file.path(system.file("extdata", 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("extdata", package = "poplab")) 

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

poplab documentation built on May 2, 2019, 5:53 p.m.

Related to plot.poplab in poplab...