ParsMatch {CollocInfer}R Documentation

Estimate of Parameters from Smooth

Description

Objective function and derivatives to estimate parameters with a fixed smooth.

Usage

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)

Arguments

pars

Initial values of parameters to be estimated processes.

coefs

Vector giving the current estimate of the coefficients in the spline.

proc

proc object defining the state process.

active

Incides indicating which parameters of allpar should be estimated; defaults to all of them.

allpars

Vector of all parameters, the assignment allpar[active]=pars is made initially.

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.

Details

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.

Value

ParsMatchOpt

A list containing:

  • parsThe entire parameter vector after optimization.

  • resThe output of the optimization routine.

ParsMatchErr

The value of the process likelihood at the current estimated states.

ParsMatchDP

The derivative fo ParsMatchErr with respect to pars[active].

ParsMatchList

A list with entries value and gradient given by the output of ParsMatchErr and ParsMatchDP respectively.

See Also

FitMatchErr, SplineCoefsErr, inneropt

Examples


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

[Package CollocInfer version 1.0.4 Index]