Is.constant () in auto.arima () R

In R, looking at the source code auto.arima(), I noticed a function called is.constant().

What is the functionality of this function? I saw the same function in ndiffs(). Can someone explain what is being done about this is.constant()?

+4
source share
1 answer

Typing

library(forecast)
forecast:::is.constant

you can see its code:

function (x)
{
    x <- as.numeric(x)
    y <- rep(x[1], length(x))
    isequal <- all.equal(c(x), y)
    return(isequal == TRUE)
}

Obviously, it returns true when all values ​​of its argument, if interpreted as numbers, are “almost equal” as determined by the utility function all.equal(whose man page is easily found). Otherwise, it returns false.

, , x NA x .

+4

All Articles