title: Error while executing ucm code on time series
body: <p>Consider the following code. The invocation of ucm <em>without</em> the function wrapper works correctly. (See the comment "THE FOLLOWING STATEMENT WORKS CORRECTLY".) But the function call errors out with the error below. Can someone help me debug? In a way similar to how I scale the time series values before passing them to the stand-alone ucm function, I scale the time series values in the else part of the function which ends up being executed on invocation of the function, but yet I see this error.  </p>
  
  <pre><code> Error in is.SSModel(do.call(updatefn, args = c(list(inits, model), update_args)),  : 
        System matrices (excluding Z) contain NA or infinite values, covariance matrices contain values larger than 1e+07
  
  
   library(rucm)
      reg1&lt;-data.frame()
      h&lt;-4
      x&lt;-ts(c(5979511 ,13608701,  6193970 , 5269967 ,10424370 , 9504397, 4564657, 5665863, 3435868,9845647,5454546,2454657),frequency=365.25/52)
      x&lt;-x/100000
      print(x)
      # THE FOLLOWING STATEMENT WORKS CORRECTLY
      fit_ucm&lt;- ucm(formula = x~0, data = x, level = TRUE, slope=TRUE,cycle=TRUE,cycle.period=365.52/52)
  
      u&lt;-ucm_Forecast(x,h,reg1)   &lt;-This call errors out
      u
  
  
      ucm_Forecast=function(x,h,xreg){
  
        if (ncol(xreg)&gt;=1){
  
          xregFit=data.frame(xreg[1:length(x),],check.names=FALSE)
          x&lt;-x/10000
          d&lt;-cbind(data.frame(x=x),xregFit)
          independent &lt;- paste0("`", names(d)[-1], "`", collapse = " + ")
          fit_ucm&lt;- ucm(as.formula(paste0("`",names(d[1]),"` ~", independent)), data = d, level = TRUE, slope=TRUE, cycle = TRUE, cycle.period = 365.25/52)
          print("right before predict")
  
  
  
          newdata1 &lt;- SSModel(as.formula(paste0("rep(NA,h) ~ ", independent, 
                                                "+ SSMtrend(2, Q =  list(fit_ucm$est.var.level,fit_ucm$est.var.slope))",
                                                "+ SSMcycle(365.25/52, Q = fit_ucm$est.var.cycle)")), H = fit_ucm$irr.var, data=as.data.frame(xreg[(length(x)+1):(length(x)+h),]))
          fcst&lt;-predict(fit_ucm$model, newdata=newdata1)
  
          #fcst&lt;-predict(fitucm$model, xreg=xreg[(length(x)+1):(length(x)+h),])
          print("right after predict")
          fcst&lt;-fcst*10000
          print(fcst)
  
        } else {
          x&lt;-x/100000
          print(x)
          fit_ucm&lt;- ucm(formula = x~0, data = x, level = TRUE, slope=TRUE,cycle=TRUE,cycle.period=365.52/52)
  
  
              newdata1 &lt;- SSModel(as.formula(paste0("rep(NA,h) ~ ",  
                                                " SSMtrend(2, Q =  list(fit_ucm$est.var.level,fit_ucm$est.var.slope))",
                                                "+ SSMcycle(365.25/52, Q = fit_ucm$est.var.cycle)")), H = fit_ucm$irr.var)
  
          fcst&lt;-predict(fit_ucm$model, newdata=newdata1, n.ahead = h)
          fcst&lt;-fcst*100000
          fcst
        }
  
        return(fcst)
      }
  </code></pre>