ParsMatch | R Documentation |
Objective function and derivatives to estimate parameters with a fixed smooth.
ParsMatchOpt(pars,coefs,proc,active=1:length(pars),meth='nlminb',control=list())
ParsMatchErr(pars,coefs,proc,active=1:length(pars),allpars,sgn=1)
ParsMatchDP(pars,coefs,proc,active=1:length(pars),allpars,sgn=1)
ParsMatchList(pars,coefs,proc,active=1:length(pars),allpars,sgn=1)
pars |
Initial values of parameters to be estimated processes. |
coefs |
Vector giving the current estimate of the coefficients in the spline. |
proc |
|
active |
Incides indicating which parameters of |
allpars |
Vector of all parameters, the assignment |
sgn |
Is the minimizing (1) or maximizing (0)? |
meth |
Optimization function currently one of 'nlminb', 'MaxNR', 'optim' or 'trust'. |
control |
Control object for optimization function. |
These routines fix the estimated states at the value given by coefs
and estimate pars
to maximize agreement between the fixed state and the objective
given by the proc
object.
A number of optimization routines have been implemented in FitMatchOpt
, some experimentation is advised.
ParsMatchOpt |
A list containing:
|
ParsMatchErr |
The value of the process likelihood at the current estimated states. |
ParsMatchDP |
The derivative fo |
ParsMatchList |
A list with entries |
FitMatchErr
, SplineCoefsErr
, inneropt
data(FhNdata)
###############################
#### Basis Object #######
###############################
knots = seq(0,20,0.2)
norder = 3
nbasis = length(knots) + norder - 2
range = c(0,20)
bbasis = create.bspline.basis(range=range(FhNtimes),nbasis=nbasis,
norder=norder,breaks=knots)
# Initial values for coefficients will be obtained by smoothing
DEfd = smooth.basis(FhNtimes,FhNdata,fdPar(bbasis,1,0.5)) # Smooth to estimate
# coefficients first
coefs = DEfd$fd$coefs
colnames(coefs) = FhNvarnames
#################################
### Initial Parameter Guesses ###
#################################
profile.obj = LS.setup(pars=FhNpars,coefs=coefs,fn=make.fhn(),basisvals=bbasis,
lambda=1000,times=FhNtimes)
lik = profile.obj$lik
proc= profile.obj$proc
pres = ParsMatchOpt(FhNpars,coefs,proc)
npars = pres$pars
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.