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