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 sampling methods see: Levy PS & Lemeshow S. (2013), ISBN-10: 0470040076; Lumley (2010), ISBN: 978-0-470-28430-8. For modelling of population dynamics see: Baquero et al (2016) <>; Baquero et al (2016), ISSN 1679-9216; Amaku et al (2010) <>.

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. Selection of sampling units for simple and complex surveys (pilot/final).
  2. Mapping primary sampling units to be visited (complex surveys).
  3. Calculation of sample size and composition (complex designs).
  4. Repetition of steps 1 and 2, for the final survey, if the workflow begun with a pilot survey.
  5. Estimation of demographic characteristics (totals, proportions, means and ratios).
  6. Construction of population pyramids, conditioned on sex, age and another categorical variable such as reproductive status.
  7. Assessment of the effect produced by population management interventions, through mathematical modelling.
  8. Prioritization interventions according to the effect they produce, through sensitivity analysis.

The current workflow is mainly focused on dog populations but also applies to cat populations. Future versions probably will include functions to address particularities of cat populations.

To install the development version, run install_github('capm', 'oswaldosantos') 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.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.11.0 by Oswaldo Santos Baquero, 5 months 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, reshape2, shiny, grid, rgdal, maptools, sp

See at CRAN