Skip to content

Commit

Permalink
multiple critical.value in x13
Browse files Browse the repository at this point in the history
  • Loading branch information
AQLT committed Jun 14, 2023
1 parent 92dff3f commit 9b673a2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/spec_regarima.R
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ set_outlier.default <- function(x,
va_name <- ifelse(is_tramo, "va", "defva")
tcr_name <- ifelse(is_tramo, "tcrate", "monthlytcrate")

if(missing(critical.value) | is.na(critical.value)){
if(missing(critical.value) | any(is.na(critical.value))){
critical.value <- outlier[[va_name]]
}else{
outlier[[va_name]] <- critical.value
outlier[[va_name]] <- critical.value[1]
}
if(is.null(outliers.type) || length(outliers.type) == 0){
if (is_tramo) {
Expand All @@ -486,8 +486,9 @@ set_outlier.default <- function(x,
outlier[[out.name]] <- out.name %in% tolower(outliers.type)
}
} else {
outlier$outliers <- lapply(outliers.type, function(x){
list(type = x, va = critical.value)
critical.value <- rep(critical.value, length(outliers.type))
outlier$outliers <- lapply(seq_along(outliers.type), function(i){
list(type = outliers.type[i], va = critical.value[i])
})
}
}
Expand Down

0 comments on commit 9b673a2

Please sign in to comment.