Skip to content

Dealing with call issues in predict #73

@moritzpschwarz

Description

@moritzpschwarz

As discussed with @gsucarrat, there remains an issue with call when using isat or arx in a sub-function:

## call issue with arx and isat

library(gets)
set.seed(123)
x <- rnorm(100)

estimate_module_fun <- function(x, ar){
  ar_test = ar 
  isat(x, ar = ar_test)
}


predict_module_fun <- function(obj){
  predict(obj, newmxreg = rnorm(10))
}

is_obj <- estimate_module_fun(x, ar = 2)
predict_module_fun(is_obj)


## same in arx

library(gets)
set.seed(123)
x <- rnorm(100)

estimate_module_fun <- function(x, ar){
  ar_test = ar 
  arx(x, ar = ar_test)
}


predict_module_fun <- function(obj){
  predict(obj, newmxreg = rnorm(10))
}

arx_obj <- estimate_module_fun(x, ar = 2)
predict_module_fun(is_obj)

This would need to be fixed in the predict functions. One potential fix could be by not relying on call as this only evaluates when executed - while making sure that it evaluates earlier (e.g. in isat.default() rather than later in predict.isat) could resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions