You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
util_difflog_ts<-function(.time_series){
time_series<-.time_seriesf<-stats::frequency(time_series)
min_x<- min(time_series)
# Diff of Logdiff_order<-1while (
(min_x>0) &
(ts_adf_test(diff(log(time_series), diff_order))$p_value>=0.05&
(diff_order<=f))
){
diff_order<-diff_order+1
}
if (diff_order<=f){
rlang::inform(
message= paste0("Differencing of order "
, diff_order
, " made the time series stationary"),
use_cli_format=TRUE
)
# Returnstationary_ts<- diff(log(time_series), diff_order)
return(
list(
stationary_ts=stationary_ts,
ndiffs=diff_order,
adf_stats= ts_adf_test(stationary_ts),
trans_type="diff_log",
ret=TRUE
)
)
} else {
rlang::inform(
message="Data either had a minimum value less than or equal to 0, or requires more than differencing than its frequency, trying double differencing log.",
use_cli_format=TRUE
)
return(list(ret=FALSE))
}
}
Function:
Examples:
The text was updated successfully, but these errors were encountered: