library(Sim.DiffProc) ## Application to real data ## CKLS modele vs CIR modele ## CKLS (mod1): dX(t) = (theta1+theta2* X(t))* dt + theta3 * X(t)^theta4 * dW(t) ## CIR (mod2): dX(t) = (theta1+theta2* X(t))* dt + theta3 * sqrt(X(t)) * dW(t) set.seed(1234) data(Irates) rates <- Irates[,"r1"] rates <- window(rates, start=1964.471, end=1989.333) fx1 <- expression(theta[1]+theta[2]*x) gx1 <- expression(theta[3]*x^theta[4]) gx2 <- expression(theta[3]*sqrt(x)) fitmod1 <- fitsde(rates,drift=fx1,diffusion=gx1,pmle="euler",start = list(theta1=1,theta2=1, theta3=1,theta4=1),optim.method = "L-BFGS-B") fitmod2 <- fitsde(rates,drift=fx1,diffusion=gx2,pmle="euler",start = list(theta1=1,theta2=1, theta3=1),optim.method = "L-BFGS-B") summary(fitmod1) summary(fitmod2) coef(fitmod1) coef(fitmod2) confint(fitmod1,parm=c('theta2','theta3')) confint(fitmod2,parm=c('theta2','theta3')) AIC(fitmod1) AIC(fitmod2)