[R] A question about SDE package

Shojaei Arani, Mohammad babak.shojaeirani at wur.nl
Sun Oct 18 16:08:10 CEST 2015


Hello Friends,


I am trying to use the functions ksdrift and ksdiff both in SDE package. Unfortunately. It does not work for my data (attached). The following code shows how I tried to use it:




setwd("D:/Mohammad/Different/New folder")
mydata <- read.csv("Best.csv", header=FALSE)
myts<-ts(mydata,start=c(0, 1), end=c(523, 1), frequency=1)

X<-myts
set.seed(123)
theta <- c(-2026651,-146668.995,-3531.84,-28.3,-46740,-2238,-26.57)
b <- function(x)
theta[1]+theta[2]*x+theta[3]*x^2+theta[4]*x^3
sigma <- function(x)
theta[5]+theta[6]*x+theta[7]*x^2
minX <- min(X)
maxX <- max(X)
par(mfrow=c(2,1))
curve(b,minX, maxX)
lines(ksdrift(X))
curve(sigma,minX, maxX)
lines(ksdiff(X))

Although I do not get any error message I do not get any solution to my problem.

I would be very grateful if any of you can help me on this.

Kind regards,

Babak,

Wageningen University


More information about the R-help mailing list