rename_states: Rename the States of SSModel Object

View source: R/rename_states.R

rename_statesR Documentation

Rename the States of SSModel Object

Description

A simple function for renaming the states of SSModel object. Note that since KFAS version 1.2.3 the auxiliary functions such as SSMtrend have argument state_names which can be used to overwrite the default state names when building the model with SSModel.

Usage

rename_states(model, state_names)

Arguments

model

Object of class SSModel

state_names

Character vector giving new names for the states.

Value

Original model with dimnames corresponding to states renamed.

Examples

custom_model <- SSModel(1:10 ~ -1 + 
SSMcustom(Z = 1, T = 1, R = 1, Q = 1, P1inf = 1), H = 1) 
custom_model <- rename_states(custom_model, "level")
ll_model <- SSModel(1:10 ~ SSMtrend(1, Q = 1), H = 1)
test_these <- c("y", "Z", "H", "T", "R", "Q", "a1", "P1", "P1inf")
identical(custom_model[test_these], ll_model[test_these])


KFAS documentation built on Sept. 8, 2023, 5:56 p.m.