Learn R Programming

capm (version 0.14.0)

PlotModels: Plot results of capm model functions

Description

Plot results of one of the following functions: SolveIASA, SolveSI or SolveTC.

Usage

PlotModels(model.out = NULL, variable = NULL, col = "red",
  col1 = c("cadetblue1", "yellow", "red"), col2 = c("blue",
  "darkgreen", "darkred"), x.label = "Years", y.label = NULL,
  legend.label = NULL, pop = NULL)

Arguments

model.out

output of one of the function previously mentioned.

variable

string to specify the variable to be ploted.

For SolveSI function:

"n" (population size).

"q" (proportion of sterilized animals).

For SolveIASA function using only point estimates:

"f1" (owned intact females).

"fs1" (owned sterilized females).

"m1" (owned intact males).

"ms1" (owned sterilized males).

"f2" (unowned intact females).

"fs2" (unowned sterilized females).

"m2" (unowned intact males).

"ms2" (unowned sterilized males).

"n1" (owned intact animals).

"ns1" (owned sterilized animals).

"n2" (unowned intact animals).

"ns2" (unowned sterilized animals).

"N1" (owned animals).

"N2" (unowned animals).

"N" (total population).

For SolveIASA function using *.range arguments:

"f" (intact females).

"fs" (sterilized females).

"m" (intact males).

"ms" (sterilized males).

"n" (intact animals).

"ns" (sterilized animals).

"N" (Total population stratified by reproductive status).

For SolveTC function:

"n" (fertile animals).

"g" (sterilized animals).

"u" (cumulative of sterilized animals)

col

string indicating the color of ploted line, when s.range is NULL.

col1

character vector indicating the color of lowest (highest) population sizes (proportion of sterilized animals), when s.range is not NULL.

col2

character vector indicating the color of highest (lowest) population sizes (proportion of sterilized animals), when s.range is not NULL.

x.label

string with the name for x axis.

y.label

string with the name for y axis.

legend.label

string with the name of the legend, for plots of SolveIASA output.

pop

value indicating the output of SolveIASA to be ploted. When NULL (default), plots for owned and unowned populations under scenarios created by immigartion rate are created. If 1, the plots of owned population for the minimum immigartion rate are ploted. When 2, the plots of unowned population for the minimum immigartion rate are ploted. If 3, the plots of owned population for the maximum immigartion rate are ploted. When 4, the plots of owned population for the maximum immigartion rate are ploted.

Details

Font size of saved plots is usually different to the font size seen in graphic browsers. Before changing font sizes, see the final result in saved (or preview) plots.

Other details of the plot can be modifyed using appropriate functions from ggplot2 package.

References

Chang W (2012). R Graphics Cookbook. O'Reilly Media, Inc.

http://oswaldosantos.github.io/capm

See Also

plot.deSolve.

Examples

Run this code
# NOT RUN {
## IASA model

## Parameters and intial conditions.
data(dogs)
dogs_iasa <- GetDataIASA(dogs,
                         destination.label = "Pinhais",
                         total.estimate = 50444)

# Solve for point estimates.
solve_iasa_pt <- SolveIASA(pars = dogs_iasa$pars,
                           init = dogs_iasa$init,
                           time = 0:15,
                           alpha.owned = TRUE,
                           method = 'rk4')
solve_iasa_rg <- SolveIASA(pars = dogs_iasa$pars,
                           init = dogs_iasa$init, 
                           time = 0:10,
                           alpha.owned = TRUE,
                           s.range = seq(0, .4, l = 15), 
                           a.range = c(0, .2), 
                           alpha.range = c(0, .05),
                           v.range = c(0, .1),
                           method = 'rk4')

## Plot unowned population sizes using point estimates
# }
# NOT RUN {
PlotModels(solve_iasa_pt, variable = "ns2")

## Plot all scenarios and change the label for the scenarios.
## Not run
PlotModels(solve_iasa_rg, variable = "ns")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab