Companion Animal Population Management

Quantitative analysis to support companion animal population management. Some functions assist survey sampling tasks (calculate sample size for simple and complex designs, select sampling units and estimate population parameters) while others assist the modelling of population dynamics. For demographic characterizations and population management evaluations see: "Baquero, et al." (2018), . For modelling of population dynamics see: "Baquero et al." (2016), . For sampling methods see: "Levy PS & Lemeshow S" (2013), "ISBN-10: 0470040076"; "Lumley" (2010), "ISBN: 978-0-470-28430-8".

capm is a package for R, a free software environment for statistical computing and graphics.

capm stands for Companion Animal Population Management and is an initiative to guide and automate quantitative analysis to support companion animal population management.

Current version offers functions that allow users to implement the following workflow:

  1. Sample size calculation.
  2. Selection of sampling units for simple and complex surveys.
  3. Mapping primary sampling units to be visited (complex surveys).
  4. Estimation of population parameters.
  5. Construction of population pyramids, conditioned on sex, age and another categorical variable such as reproductive status.
  6. Assessment of the effect produced by population management interventions, through mathematical modelling.
  7. Prioritization of interventions according to the effect they produce, through sensitivity analysis.

To install the development version, run install_github("oswaldosantos/capm") in (ideally) RStudio. devtools package must be previously loaded.

To install the production version, run install.packages("capm") in (ideally) RStudio.

If you find any error or have suggestions to improve or include functionality to capm, I will glad to know it. Please get in touch so I can better understand your needs.


capm 0.13.10

PlotPopPyramid: bug fixed in the order of age categories.

capm 0.13.9

MapkmlPSU: bug fixed in the argument "path".

capm 0.13.8

MapkmlPSU: new argument "path".

capm 0.13.7

PlotImmigrationFlow: bug fixed to properly select the first sources of immigration.

capm 0.13.6

SolveIASA: bug fixed, new argument immigration.reference, and new default for alpha.owned.

capm 0.13.5

  • Remove shiny from imports.

capm 0.13.4

  • Updated examples.

capm 0.13.3

  • PlotPopPyramid: support for ages in a character or factor vector.

capm 0.13.2

  • FreqTab: bug fix to deal with NAs.

capm 0.13.1

  • Calculate2StageSampleSize: deprecated.

capm 0.13.0

  • GraphicInterface: removed.

capm 0.12.15

  • GetDataIASA and PlotImmigrationFlow: new functions.

capm 0.12.14

  • FreqTab: Support for contingency frequencies.

capm 0.12.13

  • PlotPopPyramid: new appearance and simplified code.

capm 0.12.12

  • More selective imports.

capm 0.12.11

  • SolveIASA: truncate non-negative values.

capm 0.12.10

  • New functions: FreqTab and PlotSHHxSpecies.

  • theme_minimal to all plot functions.

capm 0.12.9

  • SolveIASA: New argument dd2.

capm 0.12.8

  • SolveSI: additional option to specify the argument dd.

capm 0.12.7

  • SolveIASA: bug fixed, related to alpha term.

capm 0.12.6

  • Default colors changed.

  • CalculatePopChange: updated to accept outputs from CalculateGlobalSens.

capm 0.12.5

  • PlotPopPyramid: support for non numeric stages.

capm 0.12.4

  • SolveIASA: new argument alpha.owned.

capm 0.12.3

  • CalculateStratifiedSampleSize: bug fixed.

capm 0.12.2

  • PlotModels and PlotGlobalSens: default ylim.

capm 0.12.1

  • SolveIasa: immigration rate defined in terms of N1.

capm 0.12.0

  • MapkmlPSU: now based on sf package.

capm 0.11.2

  • SummarySurvey: "." replaced by "_" in the prefix of estimated variables.

capm 0.11.1

  • DesignSurvey: First-stage sampling fraction redefined.

capm 0.11.0

  • DesignSurvey: allows calibration using a population total.

capm 0.10.3

  • PlotPopPyramid: sex.col and str.col are not restricted to be factors.

capm 0.10.2

  • PlotPopPyramid: centered titles and same limits on x axis for each sex. Fixed bug that introduced NA.

capm 0.10.1

  • DesignSurvey: arguments cal.col and cal.N allow calibration based on a population total.

capm 0.9.1

  • Selective import of sp package's functions.

  • Selective import of maptools package's function.

capm 0.9.0

  • Selective import of rgdal package's functions.

  • Selective import of grid package's functions.

  • PlotLocalSens: new argument to control the angle of rotation for x axis text.

  • PlotPopPyramid: margim improvements.

  • CITATION: update.

capm 0.8.0

  • CalculatePopChange: more informative uotput.

capm 0.7.3

  • PlotPopPyramid: argument legend.label added. x-axis marks are now correctly displayed.

capm 0.7.2

  • PlotGlobalSens: changes in arugment names: nam.leg to legend.label; mm.leg to mm.label; sd.leg to sd.label.

capm 0.7.1

  • PlotModels: bug fix for facet names. Changes in arugment names: leg.label to legend.label and scen.label to scenarios.label.

  • PlotLocalSens: Descending oreder (left to right) for L1 and L2. Change in argument name: ax.size to label.size. Plots are returned explicitly to allow further ggplot2 arguments.

  • SolveTC: bug fix in equations.

capm 0.7.0

  • Changes intended to appear in version 0.6.0 were not included. Now they appear in this version.

capm 0.6.0

  • SolveIASA: change in abbreviations for abandonment, adoption and immigration range.

  • SolveTC: change in abbreviation for parameters of sterilized animals.

capm 0.5.2

  • NAMESPACE and capm-package.R: Generated by roxygen2 (4.1.0).

capm 0.5.1

  • Now depends on Depends: R (>= 3.1.2).

  • GraphicInterface: bug fix to avoid an error when Windows users define a path directory using the "SelectSamplingUnits" interface.

  • GraphicInterface (CalculateSampleSize): name of a function argument corrected. New argument for Calculate2StageSampleSize is available. Names of function arguments were updated for compatibility with newer shiny versions.

  • GraphicInterface (SelectSamplingUnits): Title added to an uploaded file. Names of function arguments were updated for compatibility with newer shiny versions.

  • GraphicInterface (SurveyAnalysis): summary statistics for sample data now exclude columns with sampling unit ID's (datasets for two stage cluster designs). For printing, uploaded sample data is coerced to character to avoid scientific notation. Names of function arguments were updated for compatibility with newer shiny versions.

  • PlotPopPyramid: "label.size" argument added to allow control labels font size.

  • SampleSystematic: the computed interval size is rounded dwon to make all intervals of the same size.

  • Calculate2StageSampleSize: new argument "minimum.ssu" to define the minimum number of SSU to be selected in each PSU.

capm 0.5

  • Production version of the previous 0.4.3 version.

capm 0.4.3

  • GraphicInterface: support for simple and stratified designs. sidebarPanel layout changed to multiple columns.

  • CalculateSimpleSampleSize: new function to calculate sample size under simple or systematic designs.

  • CalculateStratifiedSampleSize: new function to calculate sample size under simple or systematic designs.

  • DesignSurvey: now supports simple and stratified designs. Arguments for column specification accept names or position to index columns.

  • Calculate2StageSampleSize: level argument renamed as conf.level.

  • SampleSystematic: code adapted to allow sampling in each strata of a stratified sampling design. Arguments ssu and total renamed as su and N, respectively.

  • SummarySurvey: variables created to define the type of design now do not appear as variables to be estimated. Argumetn level renamed as conf.level. Position of the first two arguments exchanged.

  • pilot, psu.ssu and updated to include the rural area of Santos.

capm 0.4.2

  • GraphicInterface (SelectedSamplingUnits): a CSV file with selected sampling units can be downloaded and KML files of selected PSU can be written.

  • GraphicInterface: bug fixed to load the necessary packages and pages are created with fluidPge function.

  • MapkmlPSU: function code simplification.

  • SampleSystematic: rise and error if sample units to be selected are greater than sampling units in the population.

  • CITATION: update.

capm 0.4.1

  • GraphicInterface: bug fixed to load the necessary packages.

capm 0.4

  • CITATION file added.

  • PlotPopPyramid: documentation improvements.

  • GraphicInterface: bug fixed to plot global and local sensitivity analysis when "SolveIasa" argument is used (thanks to Ricardo Dias who detected the bug).

capm 0.3.2

  • Calculate2StageSampleSize: minor documentation improvements.

  • CalculatePopChange: minor documentation improvements.

  • new variables to improve examples.

  • GraphicInterface: update in SurveyAnalysis to use examples based on

capm 0.3.1

pilot, psu.ssu, updated data files to improve examples. pilot file now represents 10 PSU and 5 SSU per SSU (a more realistic pilot sample). file now has 469 observations.

  • PlotPopPyramid: bug fixed to prevent generation of NA's during internal data transformations. Now calling the function do not produce warning messages.

  • shapefile for examples: wkbPolygon with 2 dimensions, insted of 3 dimension do not produce warning messages.

capm 0.3

  • First stable version.

  • Packages dependencies removed. Packages are now imported.

capm 0.2.6

  • GraphicInterface: documentation improvements.

capm 0.2.5

  • References to the capm web page.

capm 0.2.4

  • capm-package.R: "capm" alias removed to avoid duplicaed help pages.

  • GraphicInterface: documentation improvements.

capm 0.2.3

  • General documentation improvements.

  • GraphicInterface: In SurveyAnalysis interface, the "Estimates" Tab now have a field to specifcy the confidence level required.

capm 0.2.2

  • GraphicInterface: bug fixed in SelectSamplingUnits to show example map.

  • GraphicInterface: CalculateSampleSize interface now have an appropriate title.

  • Calculate2StageSampleSize: documentation improvements.

  • CalculateGlobalSens: documentation improvements.

  • CalculateLocalSens: documentation improvements.

capm 0.2.1

  • Encoding field removed from DESCRIPTION file to aovid warning message during package checking.

  • psu.ssu.Rd: accent removed from documentation to aovid warning message during package checking.

capm 0.2.0

  • Package version increment now refletcs changes in the package, using Semantic Versioning as a reference (

  • GraphicInterface: SolveIASA argument now produces a graphic interface with restructured Tab order and contents. The new "Introduction" Tab explains the basic functionality of the interface.

  • GraphicInterface: complete documentation.

  • "Debian" directory removed.

  • Directory tree restructured to match CRAN requirements.

  • Examples for functions simplified to be run in less time.

  • General documentation improvements.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.14.0 by Oswaldo Santos Baquero, a year ago

Browse source code at

Authors: Oswaldo Santos Baquero [aut, cre] , Marcos Amaku [ctb] , Fernando Ferreira [ctb]

Documentation:   PDF Manual  

GPL (>= 2) license

Imports deSolve, FME, survey, ggplot2, dplyr, tidyr, magrittr, grid, stats, circlize, utils, sf

See at CRAN