| profile.kalman.ar | R Documentation |
Computes the log-likelihood of a kalman.ar model over a
range of lambda, keeping the series, order and prior of the
fit. It shows how well the data determine lambda and what a
value set by hand costs.
## S3 method for class 'kalman.ar'
profile(fitted, lambda = 10^seq(-14, 0, by = 0.5), ...)
## S3 method for class 'kalman.profile'
plot(x, drop = 20, ylim = NULL,
xlab = expression(lambda),
ylab = gettext("Log-likelihood", domain = "R-dplR"), ...)
## S3 method for class 'kalman.profile'
print(x, digits = 4, ...)
fitted |
an object of class |
lambda |
|
x |
an object of class |
drop |
|
ylim |
limits of the vertical axis, in place of
|
xlab, ylab |
axis labels. |
digits |
number of significant digits to print. |
... |
for |
The model is fitted again at each value of lambda. If
the fit had variance = "varying", its variance path is kept
as it is and not estimated again. The
plot shows the log-likelihood against lambda on a log
scale, with a dashed line at the log-likelihood of the ordinary AR
model with fixed coefficients and a circle at the fit that was
profiled.
A curve that is nearly level over several powers of ten says that the
series holds little information about lambda. The
maximum likelihood value then deserves little weight, and so does a
comparison of AIC with the fixed model. A curve that falls
away steeply above some value says that larger values make the
one-step predictions clearly worse.
The number of years in which the coefficients are not those of a
stationary process is given for each lambda. It usually
rises with lambda and is another guide to how far it can
be pushed.
Under prior = "rw2" the model at lambda = 0 has
coefficients that change along straight lines, and its log-likelihood,
loglik.zero, is not that of the fixed model.
An object of class "kalman.profile", a list with elements:
lambda |
the values, sorted. |
loglik |
log-likelihood at each. |
n.nonstationary |
years with non-stationary coefficients at each. |
loglik.zero |
log-likelihood at |
loglik.fixed |
log-likelihood of the AR model with fixed coefficients. |
fit.lambda, fit.loglik, lambda.estimated |
from the fit. |
order, prior |
from the fit. |
n.lik |
years in the likelihood. |
n.yrs |
years with coefficients. |
This function is experimental and may change in future releases, as
may kalman.ar.
Andy Bunn
kalman.ar, kalman.spec
ss <- datasets::sunspot.year
fit <- kalman.ar(as.numeric(ss), yrs = as.numeric(time(ss)), order = 30,
lambda = 1e-3)
pr <- profile(fit)
pr
plot(pr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.