Skip to content

Commit

Permalink
names corrections in sarima_estimate
Browse files Browse the repository at this point in the history
  • Loading branch information
AQLT committed Sep 18, 2023
1 parent 7a3f190 commit c8b8331
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions R/arima.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,24 @@ sarima_estimate<-function(x, order=c(0,0,0), seasonal = list(order=c(0,0,0), per
bytes<-.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "[B", "toBuffer", jestim)
p<-RProtoBuf::read(regarima.RegArimaModel$Estimation, bytes)
res <- .p2r_regarima_estimation(p)
names_xreg <- colnames(xreg)
if (mean) {
names_xreg <- c("intercept", names_xreg)

if (length(res$b) > 0) {

names_xreg <- colnames(xreg)
if (is.null (names_xreg) & !is.null (xreg)){
if (is.matrix(xreg)) {
# unnamed matrix regressors
names_xreg <- sprintf("xreg_%i", seq_len(ncol(xreg)))
} else {
# vector external regressor
names_xreg <- "xreg_1"
}
}
if (mean) {
names_xreg <- c("intercept", names_xreg)
}
names(res$b) <- names_xreg
}
names(res$b) <- names_xreg
names(res$parameters$val) <- c(sprintf("phi(%i)", seq_len(order[1])),
sprintf("bphi(%i)", seq_len(seasonal$order[1])),
sprintf("theta(%i)", seq_len(order[3])),
Expand Down

0 comments on commit c8b8331

Please sign in to comment.