Learn R Programming

population (version 0.3)

plot_projection: Plot population projections

Description

Plot population projections.

Usage

plot_projection(projection, kind)

Arguments

projection

A list obtained after running functions 'project' or 'project_cores'.

kind

(optional) A string indicating which quantity should be plotted ("median" or "mean"). If missing, all projections are shown.

Value

No returned value, plot created

Details

Plot all population projections or the median or mean with 95% confidence interval. Only total population sizes are displayed.

Examples

Run this code
# NOT RUN {
years <- 10
runs <- 100

init.pop <- c(30, 20, 15, 12, 10, 9, 8, 7, 6, 5)

surv.md <- c(0.5, 0.7, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9)
surv.sd <- c(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1)
surv.msd <- cbind(surv.md, surv.sd)

litter.md <- c(0.2, 1.1, 2.8, 2.8, 2.8, 2.8, 2.8, 2.8, 1.8, 0.2)
litter.sd <- c(0.1, 0.2, 0.15, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1)
litter.msd <- cbind(litter.md, litter.sd)

nclass <- 4 # vary number of classes

projection <- project(
	years = years,
	runs = runs,
	initial_population = init.pop[1:nclass],
	survival = surv.msd[1:nclass,],
	litter = litter.msd[1:nclass,]
	)

plot_projection(projection)
plot_projection(projection, kind="median")
# }

Run the code above in your browser using DataLab