setup {CollocInfer} | R Documentation |
Setup Functions for proc and lik objects
Description
These functions set up lik and proc objects of squared error and multinormal processes.
Usage
LS.setup(pars,coefs=NULL,fn,basisvals=NULL,lambda,fd.obj=NULL,
more=NULL,data=NULL,weights=NULL,times=NULL,quadrature=NULL,
likfn = make.id(), likmore = NULL,eps=1e-6,
posproc=FALSE,poslik=FALSE,discrete=FALSE,names=NULL,sparse=FALSE)
multinorm.setup(pars,coefs=NULL,fn,basisvals=NULL,var=c(1,0.01),fd.obj=NULL,
more=NULL,data=NULL,times=NULL,quadrature=NULL,eps=1e-6,posproc=FALSE,
poslik=FALSE,discrete=FALSE,names=NULL,sparse=FALSE)
Arguments
pars |
Initial values of parameters to be estimated processes. |
coefs |
Vector giving the current estimate of the coefficients in the spline. |
fn |
A function giving the right hand side of a differential/difference equation. The function should have arguments
It should return a matrix of the same dimension of If
These functions take the same arguments as
|
basisvals |
Values of the collocation basis to be used. This can either be a basis object from the
For discrete systems, it may also be specified as a matrix, in which case If left as NULL, it is taken from |
lambda |
( |
var |
( |
fd.obj |
(Optional) A functional data object; if this is non-null, |
more |
An object specifying additional arguments to |
data |
The data to be used, this can be a matrix, or a three-dimensional array. If the latter, the middle dimension is taken to be replicates. The data are returned, if replicated they are returned in a concatenated form. |
weights |
( |
times |
Vector observation times for the data. If the data are replicated, times are returned in a concatenated form. |
quadrature |
Quadrature points, should contain two elements (if not NULL)
|
eps |
Finite differencing step size, if needed. |
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 |
poslik |
Should the state be exponentiated before being compared to the data? When the state is represented
on the log scale |
discrete |
Is this a discrete or continuous-time system? |
names |
The names of the state variables if not given by the column names of |
sparse |
Should sparse matrices be used for basis values? This option can save memory when
|
likfn |
Defines a map from the trajectory to the observations. This should be in the same form as
|
likmore |
A list containing additional inputs to |
Details
These functions provide basic setup utilities for the collocation inference methods. They define
lik
and proc
objects for sum of squared errors and multivariate normal log likelihoods with
nonlinear transfer functions describing the evolution of the state vector.
LS.setup Creates sum of squares functions
multinorm.setup Creates multinormal log likelihoods for a continuous-time system.
Value
A list with elements
coefs |
Starting values for |
lik |
The |
proc |
The |
data |
The data matrix, concatenated if from a 3d array. |
times |
The vector of observation times, concatenated if data is a 3d array. |
See Also
inneropt
, outeropt
, Profile.LS
, Profile.multinorm
, Smooth.LS
, Smooth.multinorm
Examples
# FitzHugh-Nagumo
t = seq(0,20,0.05) # Observation times
pars = c(0.2,0.2,3) # Parameter vector
names(pars) = c('a','b','c')
knots = seq(0,20,0.2) # Create a basis
norder = 3
nbasis = length(knots) + norder - 2
range = c(0,20)
bbasis = create.bspline.basis(range=range,nbasis=nbasis,norder=norder,breaks=knots)
lambda = 10000 # Penalty value
coefs = matrix(0,nbasis,2) # Coefficient matrix
profile.obj = LS.setup(pars=pars,coefs=coefs,fn=make.fhn(),basisvals=bbasis,
lambda=lambda,times=t)
# Using multinorm
var = c(1,0.01)
profile.obj = multinorm.setup(pars=pars,coefs=coefs,fn=make.fhn(),
basisvals=bbasis,var=var,times=t)
# Henon - discrete
hpars = c(1.4,0.3)
t = 1:200
coefs = matrix(0,200,2)
lambda = 10000
profile.obj = LS.setup(pars=hpars,coefs=coefs,fn=make.Henon(),basisvals=NULL,
lambda=lambda,times=t,discrete=TRUE)