Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Imports:
magrittr,
methods,
purrr,
rlang,
tidyr,
robcor
LinkingTo: Rcpp, RcppArmadillo
Expand Down
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export(update_obj)
export(value)
importFrom(Rcpp,evalCpp)
importFrom(broom,glance)
importFrom(dplyr,filter_)
importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,mutate)
importFrom(grDevices,col2rgb)
Expand All @@ -145,6 +145,7 @@ importFrom(methods,is)
importFrom(purrr,map)
importFrom(purrr,map_dbl)
importFrom(purrr,map_df)
importFrom(rlang,.data)
importFrom(robcor,robacf)
importFrom(scales,math_format)
importFrom(scales,trans_breaks)
Expand Down
11 changes: 5 additions & 6 deletions R/model_selection.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,18 @@ select_ma = function(xt, q.min = 0L, q.max = 3L,
#' q.min = 1L, q.max = 3L)
#' best_model(x, ic = "hq")
#'
#' @importFrom dplyr filter_
#' @importFrom dplyr filter
#' @importFrom rlang .data
best_model = function(x, ic = "aic"){

criterion = switch(tolower(ic),
"aic" = "AIC",
"bic" = "BIC",
"hq" = "HQ",
stop("`criterion` not supported!"))

crt = paste0("ic == '", criterion,"' & (minval == TRUE)")


x %>%
filter_(crt) -> o
filter(.data[["ic"]] == criterion & .data[["minval"]] == TRUE) -> o

o$models[[1]]$call$order = eval(parse(text=paste0("c(",o$p,",",o$d,",",o$q,")")))

Expand Down