kf.rw: Kalman filter run

kf.rwR Documentation

Kalman filter run

Description

Kalman filter run

Usage

kf.rw(initial, x, y)

Arguments

initial

List of initial values for variables to be estimated. The names of the list elements must be

  • initial$mean.a Initial value for mean of intercept in recursive calculations

  • initial$var.a Initial value for variance of intercept in recursive calculations

  • initial$b Starting value of slope for ML estimation

  • initial$ln.sig.e, initial$ln.sig.w Starting values for natural logarithms of error terms in observation and system equations

  • initial$Ts Number of observations at start of data set to omit for calculation of variance in observation equation and concentrated likelihood function.

  • initial$Estb True/False: Should Ricker b parameter be estimated within the KF?

x

Independent variable in obs. equation

y

Dependent variable in obs. equation

Value

Returns a list of:

  • x (independent variable in obs. equation)

  • y (dependent variable in obs. equation)

  • prior.mean.a (time-series of prior means of intercept, a)

  • prior.var.a (time-series of prior variances of intercept, a)

  • y.hat (predicted value of y(t) given y(t-1))

  • f (time-series of prediction variances)

  • v (time-series of prediction error)

  • post.mean.a (time-series of posterior means of intercept, a)

  • post.var.a (time-series of posterior variances of intercept, a)

  • filter.y (filtered estimate of y)

  • neg.log.like (time-series of negative log-likelihoods)

  • p.star (ratio of the posterior variance in year r, to the prior variance in year t+1 of intercept, a)

  • smoothe.mean.a (time-series of smoothed posterior means of interecept, a)

  • smoothe.var.a (time-series of smoothed posterior variances of interecept, a)

  • smoothe.y (smoothed estimate of y)

  • cum.neg.log.lik (cumulative negative log-likelihood)

  • init.mean.a (starting mean for intercept)

  • init.var.a (starting variance for intercept)

  • a.bar (mean intercept value, not implemented)

  • b (slope parameter)

  • sig.e (standard deviation of observation error)

  • sig.w (standard deviation of system error)

  • rho (autocorrelation in intercept estimates, not implemented)

  • N.tot (number of non-NA years in spawner time-series)

  • N.cond (Number of years to omit when calculating the concentrated likelihood for the data set. See Visser and Molenaar (1988). Default is 1)

  • Param (number of parameter estimated in the maximum likelihood)

  • AICc (Akaike Information Criterion for small sample sizes)

  • Report (output from the maximum likehood estimation of b, ln.sig.e and ln.sig.w)

Examples

data(Stellako) #Effective total spawners, ETS, and recruitment, Rec for a salmon stock, Stellako
x <-Stellako$ETS
y <-log(Stellako$Rec/Stellako$ETS)
initial <- list()
initial$mean.a <- lm(y~x)$coef[1]
initial$var.a <- 1
initial$b <- -lm(y~x)$coef[2]
initial$ln.sig.e <- log(1)
initial$ln.sig.w <- log(1)
initial$Ts <- 1
initial$EstB <- "True"
## Not run: 
  kf.rw(initial=initial,x=x,y=y)

## End(Not run)

carrieholt/KF-funcs documentation built on July 26, 2022, 7:24 a.m.