if (FALSE) {
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)
}
Run the code above in your browser using DataLab