plot.Tagloss: Plot the daily rate of tag loss.

View source: R/plot.Tagloss.R

plot.TaglossR Documentation

Plot the daily rate of tag loss.

Description

Plot the daily rate of tag loss.
To use this function without a result of Tagloss_fit(), see the hack in examples.

Usage

## S3 method for class 'Tagloss'
plot(
  x,
  t = NULL,
  fitted.parameters = NULL,
  fixed.parameters = NULL,
  scale = 1,
  model_before = NULL,
  model_after = NULL,
  model = c("1", "2", "R1", "R2", "L1", "L2", "cumul", "cumul1", "N2", "N1", "N0", "NLR",
    "N0R", "NL0", "N00"),
  col = rev(grey.colors(4, start = 0.9, end = 0.3)),
  text.col = grey.colors(4, start = 0.9, end = 0.3),
  label.col = "black",
  add = FALSE,
  mcmc = FALSE,
  Hessian = NULL,
  replicates = NULL,
  method = NULL,
  probs = c(0.025, 0.975),
  progressbar = FALSE,
  decoration = FALSE,
  ...
)

Arguments

x

Object obteined from Tagloss_fit()

t

Time for which values of model must be ploted

fitted.parameters

Set of parameters

fixed.parameters

Another set of parameters without standard error associated

scale

Scale value. When Cumul is used, scale is always 1.

model_before

Transformation of parameters before to use Tagloss_model()

model_after

Transformation of parameters after to use Tagloss_model()

model

Can be 1, 2, R1, R2, L1, L2 or Cumul (2 tags) or Cumul1 (1 tag)

col

The colors of shading areas of cumul or the color of line

text.col

The text color for cumul model

label.col

The text color used for labels when decoration is true

add

Should the data be added to a previous plot?

mcmc

The mcmc result

Hessian

Hessian matrix of parameters

replicates

Number of replicates for confidence interval

method

Which method to use to estimate confidence interval

probs

Quantiles to show for confidence interval

progressbar

Is shown a progressbar?

decoration

Try to add name of parameters on the graph

...

Parameters transmitted to plot

Details

plot.tagloss plots the daily rate of tag loss.

Value

An invisible dataframe with values used for plotting.

Author(s)

Marc Girondot

See Also

Other Model of Tag-loss: Tagloss_L(), Tagloss_LengthObs(), Tagloss_cumul(), Tagloss_daymax(), Tagloss_fit(), Tagloss_format(), Tagloss_mcmc(), Tagloss_mcmc_p(), Tagloss_model(), Tagloss_simulate(), logLik.Tagloss(), o_4p_p1p2, plot.TaglossData()

Examples

## Not run: 
library(phenology)
# Example
t <- 1:1000

par <- c(D1_1=200, D2D1_1=100, D3D2_1=200, 
         A_1=-logit(0.02), B_1=-logit(0.05), C_1=-logit(0.07))
phenology:::plot.Tagloss(x=list(), t=t, fitted.parameters=par, model="1")
phenology:::plot.Tagloss(x=list(), t=t, fitted.parameters=par, model="1", 
                         scale=1000, decoration = TRUE)

par <- c(D1_2=200, D2D1_2=100, D3D2_2=200, 
         A_2=-logit(0.05), B_2=-logit(0.03), C_2=-logit(0.03))
phenology:::plot.Tagloss(x=list(), t=t, fitted.parameters=par, ylim=c(0, 1), 
                         scale = 10, model="2", decoration = TRUE)

par <- c(D1_L2=200, D2D1_L2=100, D3D2_L2=200, 
         A_L2=-logit(0.05), B_L2=-logit(0.07), C_L2=-logit(0.07))
phenology:::plot.Tagloss(x=list(), t=t, fitted.parameters=par, model="L2")

par <- c(D1_R2=200, D2D1_R2=0, D3D2_R2=700, 
         A_R2=-logit(0.02), B_R2=-logit(0.05), C_R2=-logit(0.07))
phenology:::plot.Tagloss(x=list(), t=t, fitted.parameters=par, model="R2", 
                         col="red", add=TRUE)

par <- c(D1_L1=200, D2D1_L1=2000, D3D2_L1=2000, 
        A_L1=-logit(0.05), B_L1=-logit(0.02), C_L1=-logit(0.1))
phenology:::plot.Tagloss(x=list(), t=t, fitted.parameters=par, model="L1")

# To plot the history of individuals
par <- c(D1_1=200, D2D1_1=100, D3D2_1=200, 
         A_1=-logit(5E-4), B_1=-logit(4E-4), C_1=-logit(5E-4), 
         D1_2=200, D2D1_2=100, D3D2_2=200, 
         A_2=-logit(6E-4), B_2=-logit(5E-4), C_2=-logit(6E-4))
phenology:::plot.Tagloss(x=list(), t=1:1000, fitted.parameters=par, 
                         model="Cumul", 
                         decoration = TRUE)
phenology:::plot.Tagloss(x=list(), t=1:1000, fitted.parameters=par, 
                         model="Cumul", 
                         decoration = TRUE, col=c("red", "green", "blue"))
                         
# To plot the history of individuals
par <- c(D1_R1=200, D2D1_R1=300, D3D2_R1=200, 
         A_R1=-logit(5E-4), B_R1=-logit(4E-4), C_R1=-logit(5E-4), 
         D1_R2=200, D2D1_R2=200, D3D2_R2=200, 
         A_R2=-logit(6E-4), B_R2=-logit(5E-4), C_R2=-logit(6E-4), 
         D1_L1=200, D2D1_L1=400, D3D2_L1=200, 
         A_L1=-logit(5E-4), B_L1=-logit(4E-4), C_L1=-logit(5E-4), 
         D1_L2=200, D2D1_L2=100, D3D2_L2=200, 
         A_L2=-logit(6E-4), B_L2=-logit(5E-4), C_L2=-logit(6E-4))
phenology:::plot.Tagloss(x=list(), t=1:1000, fitted.parameters=par, model="Cumul", 
                         decoration = TRUE)
phenology:::plot.Tagloss(x=list(), t=1:1000, fitted.parameters=par, model="R1", 
                         decoration = TRUE)                         
phenology:::plot.Tagloss(x=list(), t=1:1000, fitted.parameters=par, model="R2", 
                         decoration = TRUE)
# Example of fit

data_f_21 <- Tagloss_format(outLR, model="21")
data_f_21_fast <- subset(data_f_21, subset=(is.na(data_f_21$N20)))
par <- c('D1_2' = 49.78891736351531, 
         'D2D1_2' = 1059.3635769732305, 
         'D3D2_2' = 12.434313273804602, 
         'A_2' = 5.2238379144659683, 
         'B_2' = 8.0050044071275543, 
         'C_2' = 8.4317863609499675, 
         'D1_1' = 701.80273287212935, 
         'D2D1_1' = 0.010951749100596819, 
         'D3D2_1' = 3773.6290607434876, 
         'A_1' = 205.42435592344776, 
         'B_1' = 9.9598342503239863, 
         'C_1' = 6.7234868237164722)
phenology:::plot.Tagloss(x=list(), t=1:1000, fitted.parameters=par, model="1", 
                         decoration = TRUE)
phenology:::plot.Tagloss(x=list(), t=1:1000, fitted.parameters=par, model="2", 
                         decoration = TRUE)
o <- Tagloss_fit(data=data_f_21_fast, fitted.parameters=par, hessian = TRUE)
plot(x=o, model="1", replicates=0, 
     method=NULL, decoration = TRUE)
plot(x=o, model="1", replicates=1000, 
     method="Hessian", decoration = TRUE)

## End(Not run)

phenology documentation built on Sept. 11, 2024, 6:07 p.m.