Description Usage Arguments Value Author(s) Examples
This function runs generalized profiling for DDE models. This function carry out the profiled optimization method for DDe models using a sum of squared errors criteria for both fit to data and the fit of the derivatives to a delay differential equation.
1 2 3 4 5 6  Profile.LS.DDE(fn, data, times, pars, beta, coefs = NULL, basisvals = NULL,
lambda, fd.obj = NULL, more = NULL, weights = NULL, quadrature = NULL,
in.meth = "nlminb", out.meth = "nls", control.in = list(),
control.out = list(), eps = 1e06, active = NULL, posproc = FALSE,
poslik = FALSE, discrete = FALSE, names = NULL, sparse = FALSE,
basisvals0 = NULL, coefs0 = NULL, nbeta, ndelay, tau)

fn 
A named list of functions giving the righthand side of a delay differential equation. The functions should have arguments
The list of functions should contain the elements:

data 
Matrix of observed data values. 
times 
Vector observation times for the data. 
pars 
Initial values of parameters to be estimated processes. 
beta 
Initial values of the contribution of lags for the delay. 
coefs 
Vector giving the current estimate of the coefficients in the spline. 
basisvals 
Values of the collocation basis to be used. This should be a basis object from the fda package. 
lambda 
Penalty value trading off fidelity to data with fidelity to dif ferential equations. 
fd.obj 
A functional data object; if this is nonnull, coefs and basisvals is extracted from here. 
more 
An object specifying additional arguments to fn. 
weights 
Weights for weighted estimation. 
quadrature 
Quadrature points, should contain two elements (if not

in.meth 
Inner optimization function currently one of 
out.meth 
Outer optimization function to be used, depending on the type of method.

control.in 
Control object for inner optimization function. 
control.out 
Control object for outer optimization function. 
eps 
Finite differencing step size, if needed. 
active 
Incides indicating which parameters of pars should be estimated; defaults to all of them. 
posproc 
Should the state vector be constrained to be positive? If this is the case, the state is represented by an exponentiated basis expansion in the proc object. 
poslik 
Should the state be exponentiated before being compared to the data? When the state is represented on the log scale (posproc=TRUE), this is an alternative to taking the log of the data. 
discrete 
Is it a discrete process? 
names 
The names of the state variables if not given by the column names of coefs. 
sparse 
Should sparse matrices be used for basis values? This option can save memory when using 'trust' optimization method. 
basisvals0 
Values of the collocation basis to be used for the history part of the data. This should be a basis object from the fda package. 
coefs0 
Vector giving the estimate of the coefficients in the spline for the history part of the data. 
nbeta 
The number of lags for the delay. 
ndelay 
A vector inidicating which state process has a delay term. 
tau 
A list of delay lags. 
A list with elements
The matrix for the observed data.
The inner optimization result.
The estimated coefficients.
The lik
object generated.
The proc
object generated.
The estimated parameters.
The estimated contribution of lags for the delay.
The times at which the data are observed.
The functional data object for the estimated state process.
The functional data object for the estimated state process of the history part.
The lags of delays.
Ziqian Zhou
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36  yout < DSIRdata
times < seq(0.5, 30, by = 0.1)
yout0 < yout[times >= 0, ]
yout.d < yout[times >= 5, ]
colnames(yout.d) < c("S","I")
times0 < times[times>=0]
times.d < times[times>=5]
norder = 3
nbasis.d = length(times.d) + norder  2
nbasis0 < length(times0) + norder  2
basis0 < create.bspline.basis(range=range(times0),
nbasis=nbasis0, norder=norder, breaks=times0)
basis.d < create.bspline.basis(range=range(times.d),
nbasis=nbasis.d, norder=norder, breaks=times.d)
fdnames=list(NULL,c('S', 'I'),NULL)
bfdPar0 = fdPar(basis0,lambda=1,int2Lfd(1))
bfdPar.d < fdPar(basis.d,lambda=1,int2Lfd(1))
DEfd0 < smooth.basis(times0, yout0, bfdPar0,fdnames=fdnames)$fd
coefs0 < DEfd0$coefs
colnames(coefs0) = c("S","I")
initPars < c(5, 0.0012)
names(initPars) < c("gamma", "beta")
initBeta < rep(0, 11)
initBeta[c(4,5,11)] < c(0.611, 0.362, 0.026)
tau < list(seq(0,1, length.out = 11))
lambda = 1000
DSIRfn < DSIRfn.make()
## Not run:
dde.fit < Profile.LS.DDE(DSIRfn, yout.d, times.d, pars = initPars,
beta = initBeta, coefs = DSIRInitCoefs, basisvals = basis.d,
lambda = 1000,
in.meth='nlminb', basisvals0 = basis0, coefs0 = coefs0,
nbeta = length(initBeta), ndelay = 2, tau = tau,
control.out = list(method = "nnls.eq", maxIter = 2, echo = TRUE))
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.