gsucarrat / gets

R Package for General-to-Specific (GETS) modelling and Indicator Saturation (ISAT) methods
8 stars 5 forks source link

`getsm` error #22

Closed moritzpschwarz closed 4 years ago

moritzpschwarz commented 4 years ago

I get an error when trying to run and print this:

set.seed(123)
y <- arima.sim(list(ar=0.9), 80)
xregs <- matrix(rnorm(2*80), 80, 2)
object <- arx(y,mxreg = xregs)
getsm(object)

# to inspect the outcome, we can save it here - printing it still does not work though
gets_outcome <- getsm(object)

Which I do not get when running this (just adding the ar=1):

set.seed(123)
y <- arima.sim(list(ar=0.9), 80)
xregs <- matrix(rnorm(2*80), 80, 2)
object <- arx(y,mxreg = xregs, ar=1)
getsm(object)

I have traced the error to here: https://github.com/gsucarrat/gets/blob/68e9a9db2497d3113f8aca18540faad2e6c32646/gets/R/gets-base-source.R#L4801 and here https://github.com/gsucarrat/gets/blob/68e9a9db2497d3113f8aca18540faad2e6c32646/gets/R/gets-base-source.R#L4810 where both if statements are asking for is.null but the actual element of gets_outcome is just an empty list of the form list(), which is not NULL.

We could solve this (I think) by changing the condition to length(x$paths) == 0 and length(x$terminals)!=0.

More generally though, is it worth exploring why there are no paths searched? There are two non-significant regressors in the GUM...

gsucarrat commented 4 years ago

The origin of the problem is 'print.gets()', and it occurs when there is no search. In this specific case it is because the GUM does not pass one or more diagnostic tests. If you store the result in gets_outcome, the you can see this in gets_outcome$messages.

I just fixed 'print.gets()', and uploaded/pushed the files to Github.

moritzpschwarz commented 4 years ago

@gsucarrat fixed this, so I'm closing this!