Tagloss_model: Return the daily rate of tag loss.

View source: R/Tagloss_model.R

Tagloss_modelR Documentation

Return the daily rate of tag loss.

Description

This function compute a model of daily tag loss rate for days t based on a set of parameters, par or a fitted tag loss model in x.
Parameters are described in Tagloss_fit.

Usage

Tagloss_model(
  t = NULL,
  par = NULL,
  Hessian = NULL,
  mcmc = NULL,
  model_before = NULL,
  model_after = NULL,
  model = stop("You must specify which tag loss rate you want."),
  method = NULL,
  replicates = NULL,
  x = NULL
)

Arguments

t

Time for which values of model must be estimated

par

Parameters

Hessian

Hessian matrix of parameters

mcmc

A mcmc result

model_before

Function to be used before estimation of daily tagloss rate

model_after

Function to be used after estimation of daily tagloss rate

model

The model of parameter to be used, can be 1, 2, L1, L2, R1 or R2

method

Can be NULL, "delta", "SE", "Hessian", "MCMC", or "PseudoHessianFromMCMC"

replicates

Number of replicates to estimate se of output

x

A Tagloss fitted model

Details

Tagloss_model returns the daily rate of tag loss.

Value

Return the daily rate of tag loss if hessian is null or a data.frame with distribution of daily rate of tag loss if hessian is not null.

Author(s)

Marc Girondot marc.girondot@gmail.com

See Also

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

Examples

## Not run: 
library(phenology)

# Example
t <- 1:1000
par <- c(D1=200, D2D1=100, D3D2=200, 
         A=-logit(0.02), B=-logit(0.05), C=-logit(0.07))
y <- Tagloss_model(t, par, model="1")
plot(x=t, y, type="l")
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))
y <- Tagloss_model(t, par, model="1")
phenology:::plot.Tagloss(x=list(), t=1:1000, fitted.parameters=par, model="1")

# Fig1A in Rivalan et al. 2005 (note an error for a0; a0 must be negative)
par <- c(a0=-1E5, a1=-2000, a2=0, a3=2*max(t), a4=0.1)
y <- Tagloss_model(t, par)
plot(x=t, y, type="l")

# Fig1B in Rivalan et al. 2005
par <- c(a0=-0.5, a1=-2000, a2=-0.001, a3=0, a4=0.1)
y <- Tagloss_model(t, par)
plot(x=t, y, type="l")

# Fig1C in Rivalan et al. 2005
par <- c(a0=-1, a1=-6, a2=0, a3=0, a4=0)
y <- Tagloss_model(t, par)
plot(x=t, y, type="l")

# Fig1D in Rivalan et al. 2005
par <- c(a0=-1, a1=-6, a2=0, a3=0, a4=0.1)
y <- Tagloss_model(t, par)
plot(x=t, y, type="l")

# Fig1E in Rivalan et al. 2005
par <- c(a0=-0.1, a1=-10, a2=-0.2, a3=60, a4=0.1)
y <- Tagloss_model(t, par)
plot(x=t, y, type="l")

# Fig1F in Rivalan et al. 2005
par <- c(a0=-0.1, a1=-10, a2=0.2, a3=60, a4=0.1)
y <- Tagloss_model(t, par)
plot(x=t, y, type="l")

# Example with fitted data
data_f_21 <- Tagloss_format(outLR, model="21")
# Without the N20 the computing is much faster
data_f_21_fast <- subset(data_f_21, subset=(is.na(data_f_21$N20)))
par <- c('D1_2' = 49.086835072129126, 
         'D2D1_2' = 1065.0992647723231, 
         'D3D2_2' = 6.15531475922079, 
         'A_2' = 5.2179675647973758, 
         'B_2' = 8.0045560376751386, 
         'C_2' = 8.4082505219581876, 
         'D1_1' = 177.23337287498103, 
         'D2D1_1' = 615.42690323741033, 
         'D3D2_1' = 2829.0806609455867, 
         'A_1' = 28.500118091731551, 
         'B_1' = 10.175426055942701, 
         'C_1' = 6.9616630417169398)
o <- Tagloss_fit(data=data_f_21_fast, fitted.parameters=par)
t <- 1:10
y <- Tagloss_model(t, o$par, model="1")
y <- Tagloss_model(t, x=o, method=NULL, model="1")
y <- Tagloss_model(t, x=o, method="Hessian", model="1", replicates=1000)

## End(Not run)

phenology documentation built on Oct. 16, 2023, 9:06 a.m.