spect
estimates the power spectrum of time series data and model simulations and compares the results.
It can be used to diagnose goodness of fit and/or as the basis for frequency-domain parameter estimation (spect.match
). spect.match
tries to match the power spectrum of the model to that of the data.
It calls an optimizer to adjust model parameters to minimize the discrepancy between simulated and actual data.
## S3 method for class 'pomp':
spect(object, params, vars, kernel.width, nsim, seed = NULL,
transform = identity,
detrend = c("none","mean","linear","quadratic"),
...)
## S3 method for class 'spect.pomp':
spect(object, params, vars, kernel.width, nsim, seed = NULL, transform,
detrend, \dots)
spect.match(object, start, est = character(0),
vars, nsim, seed = NULL,
kernel.width, transform = identity,
detrend = c("none","mean","linear","quadratic"),
weights, method = c("subplex","Nelder-Mead","SANN"),
verbose = getOption("verbose"),
eval.only = FALSE, fail.value = NA, ...)
pomp
.params=coef(object)
.rownames(obs(object))
.
By default, the spectrum will be computed for all observables.NULL
, the random number generator will be initialized with this seed for simulations.
See simulate-pomp.weights
can be specified either as a vector (which must have length eTRUE
, no optimization is attempted.
Instead, the probe-mismatch value is simply evaluated at the start
parameters.NA
, this value is substituted for non-finite values of the objective function.spec
, these are currently ignored.
In the case of spec.match
, these are passed to optim
or subplex
in the control
list.spect
returns an object of class spect.pomp
, which is derived from class pomp
and therefore has all the slots of that class.
In addition, spect.pomp
objects have the following slots:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
spect.match
returns an object of class spect.matched.pomp
, which is derived from class {spect.pomp}
and therefore has all the slots of that class.
In addition, spect.matched.pomp
objects have the following slots:
[object Object],[object Object],[object Object],[object Object]spect
results in the estimation of the power spectrum for the (transformed, detrended) data and nsim
model simulations.
The results of these computations are stored in an object of class spect.pomp
.
A call to spect.match
results in an attempt to optimize the agreement between model and data spectrum over the parameters named in est
.
The results, including coefficients of the fitted model and power spectra of fitted model and data, are stored in an object of class spect.matched.pomp
.
probe
,
probe.match
data(ou2)
good <- spect(
ou2,
vars=c("y1","y2"),
kernel.width=3,
detrend="mean",
nsim=500
)
summary(good)
plot(good)
ou2.bad <- ou2
coef(ou2.bad,c("x1.0","x2.0","alpha.1","alpha.4")) <- c(0,0,0.1,0.2)
bad <- spect(
ou2.bad,
vars=c("y1","y2"),
kernel.width=3,
detrend="mean",
nsim=500
)
summary(bad)
plot(bad)
Run the code above in your browser using DataLab