dynr.taste2 {dynr}R Documentation

Re-fit state-space model using the estimated outliers.

Description

The function dynr.taste2{} update the dynrModel object applying outliers from the dynrTaste object, or outliers from users. The function then re-cook the model.

Usage

dynr.taste2(dynrModel, dynrCook, dynrTaste, delta_inn = c("t", "ind", "jnt",
  "null"), delta_add = c("t", "ind", "jnt", "null"), delta_L = NULL,
  delta_O = NULL, cook = TRUE, verbose = FALSE,
  newOutfile = "new_taste.c")

Arguments

dynrModel

an object of dynrModel class.

dynrCook

an object of dynrCook class.

dynrTaste

an object of dynrTaste class. The default is NULL.

delta_inn

a character string for a method detecting ‘inn’ovative outliers, which must be one of “t” (default), “ind”, “jnt” or “null”. According to the method, corresponding delta estimates (magnitude of estimated outliers) will be included in the new dynrModel in output. ‘t’ represents the t statistic, ‘ind’ represents the independent chi-square statistic, ‘jnt’ represents the joint chi-square statistic. If no outliers are assumed, “null” can be used.

delta_add

a character string for a method detecting ‘add’itive outliers, which must be one of “t” (default), “ind”, “jnt” or “null”. According to the method, corresponding delta estimates will be included in the new dynrModel.

delta_L

a data.frame containing user-specified latent outliers. The delta estimates from dynrTaste will be ignored. The number of rows should equal to the total time points, and the number of columns should equal to the number of latent variables.

delta_O

a data.frame containing user-specified observed outliers. The delta estimates from dynrTaste, and arguments of delta_inn and delta_add will be ignored. The number of rows should equal to the total time points, and the number of columns should equal to the number of observed variables.

cook

a logical specifying whether the newly built model would be cooked by 'dynr.cook' function. The default is TRUE. When 'cook=FALSE', only the newly built model will be saved for the output.

verbose

a logical specifying the verbose argument of the new cook object. The default is FALSE.

newOutfile

a character string for outfile argument of dynr.model function to create new dynrModel object. The default is "new_taste.c".

Details

The argument dynrTaste should be the dynrTaste object that is output of the dynr.taste function the argument dynrModel is applied.

The argument dynrTaste can be NULL, if user-specified outliers are offered by the arguments delta_L and delta_O.

Value

a list with the two arguments; a new dynrModel object the outliers are applied, and a dynrCook object the new dynrModel object is cooked.

Examples

## Not run: 
# See the demo for outlier detection, OutlierDetection.R
dynrCook <- dynr.cook(dynrModel)
dynrTaste <- dynr.taste(dynrModel, dynrCook)

# Detect outliers related to 'eta1' out of, say, three latent
# variables c("eta1", "eta2", "eta3"), and all measured variables.
taste2 <- dynr.taste2(dynrModel, dynrCook, dynrTaste)

## End(Not run)

[Package dynr version 0.1.16-27 Index]