Learn R Programming

phenology (version 10.1)

plot.phenology: Plot the phenology from a result.

Description

The function plot.phenology plots the phenology graph from a result object.
If cofactors have been added, the plot does not show their effects.
plot.objects can be "observations", "ML" for maximum likelihood, "ML.SD" for dispersion of observations, "ML.quantiles" or "MCMC.quantiles" if a mcmc object is given

Usage

# S3 method for phenology
plot(
  x,
  ...,
  series = "all",
  moon = FALSE,
  replicate.CI = 10000,
  resultmcmc = NULL,
  season = NULL,
  chain = 1,
  replicate.CI.mcmc = "all",
  level = 0.95,
  plot.objects = c("observations", "ML", "ML.SD", "ML.quantiles", "MCMC.quantiles"),
  col.ML = "black",
  col.SD = "red",
  col.SD.polygon = rgb(red = 1, green = 0, blue = 0, alpha = 0.2),
  col.MCMC.quantiles = "purple",
  col.MCMC.quantiles.polygon = rgb(red = 160/255, green = 32/255, blue = 240/255, alpha =
    0.2),
  col.ML.quantiles = "black",
  col.ML.quantiles.polygon = rgb(red = 0, green = 0, blue = 0, alpha = 0.2),
  col.observations = "black",
  col.minimum.observations = "blue",
  col.grouped.observations = "green"
)

Value

A list with four objects: synthesis is a data.frame with global estimate of nesting.

details_MCMC, details_ML and details_mean are lists with day by day information for each series.

Arguments

x

A result file generated by fit_phenology

...

Parameters used by plot

series

Name or number of series to be plotted or 'all'

moon

If TRUE, the moon phase is ploted. Default is FALSE

replicate.CI

Number of replicates for estimation of confidence interval

resultmcmc

A mcmc object

season

Which season to plot

chain

The number of chain to be used in resultmcmc

replicate.CI.mcmc

Number of iterations to be used or "all"

level

Level to estimate confidence interval or credibility interval

plot.objects

What to plot?

col.ML

Color of the ML mean curve

col.SD

Color of the SD curve (distribution of observations)

col.SD.polygon

Color of the polygon of the SD curve. If FALSE not shown.

col.MCMC.quantiles

Color of the quantiles curve based on mcmc

col.MCMC.quantiles.polygon

Color of the credibility interval polygon based on MCMC. If FALSE not shown.

col.ML.quantiles

Color of the SE curve based on ML

col.ML.quantiles.polygon

Color of the confidence interval polygon based on ML. If FALSE not shown.

col.observations

Color of the points

col.minimum.observations

Color of the points indicating minimum counts

col.grouped.observations

Color of the lines indicating grouped observations

Author

Marc Girondot marc.girondot@gmail.com

Details

plot.phenology plots the phenology.

See Also

Other Phenology model: AutoFitPhenology(), BE_to_LBLE(), Gratiot, LBLE_to_BE(), LBLE_to_L(), L_to_LBLE(), MarineTurtles_2002, MinBMinE_to_Min(), adapt_parameters(), add_SE(), add_phenology(), extract_result(), fit_phenology(), likelihood_phenology(), logLik.phenology(), map_Gratiot, map_phenology(), par_init(), phenology(), phenology2fitRMU(), phenology_MHmcmc(), phenology_MHmcmc_p(), plot.phenologymap(), plot_delta(), plot_phi(), print.phenology(), print.phenologymap(), print.phenologyout(), remove_site(), result_Gratiot, result_Gratiot1, result_Gratiot2, result_Gratiot_Flat, result_Gratiot_mcmc, summary.phenology(), summary.phenologymap(), summary.phenologyout()

Examples

Run this code
if (FALSE) {
library(phenology)
# Read a file with data
data(Gratiot)
# Generate a formatted list nammed data_Gratiot 
data_Gratiot <- add_phenology(Gratiot, name = "Complete", 
		reference = as.Date("2001-01-01"), format="%d/%m/%Y")
# Generate initial points for the optimisation
parg <- par_init(data_Gratiot, fixed.parameters=NULL)
parg <- c('Max_Complete' = 33.076044848500167, 25, 
          'MinB_Complete' = 0.21758630798131923, 
          'MinE_Complete' = 0.42493953463205936, 
          'LengthB' = 96.158007568020523, 
          'Peak' = 174.62435300274245, 
          'LengthE' = 62.084876419654634, 
          'Flat' = 0, 
          'Theta' = 3.5864650991821954)
# Run the optimisation
result_Gratiot <- fit_phenology(data=data_Gratiot, 
		                             fitted.parameters=parg, 
		                             fixed.parameters=NULL)
data(result_Gratiot)
# Plot the phenology and get some stats
output <- plot(result_Gratiot)
# Plot only part of the nesting season
ptoutput <- plot(result_Gratiot, xlim=c(as.Date("2001-03-01"),as.Date("2001-08-31")))
# Use month names in English
Sys.setlocale(category = "LC_TIME", locale = "en_GB.UTF-8")
output <- plot(result_Gratiot)
# set back the month name in local R language
Sys.setlocale(category = "LC_TIME", locale = "")
# plot based on quantiles of mcmc object
plot(result_Gratiot, resultmcmc=result_Gratiot_mcmc, 
            plot.objects=c("observations", "MCMC.quantiles"))
plot(result_Gratiot, resultmcmc=result_Gratiot_mcmc, 
            plot.objects=c("observations", "ML.SD", "ML.quantiles"))
plot(result_Gratiot, resultmcmc=result_Gratiot_mcmc, 
            plot.objects=c("observations", "ML.SD", "MCMC.quantiles"))
plot(result_Gratiot, resultmcmc=result_Gratiot_mcmc, 
            plot.objects=c("observations", "ML.quantiles", "MCMC.quantiles"))
}

Run the code above in your browser using DataLab