'Transform constrained parameters used in likelihood evaluation
to unconstrained parameters used by the optimizer
Used primarily to reverse enforcement of stationarity of the
autoregressive lag polynomial and invertibility of the moving average
lag polynomial.
Parameters
constrained : array_like
Constrained parameters used in likelihood evaluation.
Returns
constrained : array_like
Unconstrained parameters used by the optimizer.
Notes
If the lag polynomial has non-consecutive powers (so that the
coefficient is zero on some element of the polynomial), then the
constraint function is not onto the entire space of invertible
polynomials, although it only excludes a very small portion very close
to the invertibility boundary.'

def untransform_params(self, constrained):

    constrained = np.array(constrained, ndmin=1)
    unconstrained = np.zeros(constrained.shape, constrained.dtype)
    start = end = 0
    if (self.k_trend > 0):
        end += self.k_trend
        unconstrained[start:end] = constrained[start:end]
        start += self.k_trend
    if self.mle_regression:
        end += self.k_exog
        unconstrained[start:end] = constrained[start:end]
        start += self.k_exog
    if (self.k_ar_params > 0):
        end += self.k_ar_params
        if self.enforce_stationarity:
            unconstrained[start:end] = unconstrain_stationary_univariate(constrained[start:end])
        else:
            unconstrained[start:end] = constrained[start:end]
        start += self.k_ar_params
    if (self.k_ma_params > 0):
        end += self.k_ma_params
        if self.enforce_invertibility:
            unconstrained[start:end] = unconstrain_stationary_univariate((- constrained[start:end]))
        else:
            unconstrained[start:end] = constrained[start:end]
        start += self.k_ma_params
    if (self.k_seasonal_ar > 0):
        end += self.k_seasonal_ar_params
        if self.enforce_stationarity:
            unconstrained[start:end] = unconstrain_stationary_univariate(constrained[start:end])
        else:
            unconstrained[start:end] = constrained[start:end]
        start += self.k_seasonal_ar_params
    if (self.k_seasonal_ma_params > 0):
        end += self.k_seasonal_ma_params
        if self.enforce_invertibility:
            unconstrained[start:end] = unconstrain_stationary_univariate((- constrained[start:end]))
        else:
            unconstrained[start:end] = constrained[start:end]
        start += self.k_seasonal_ma_params
    if (self.state_regression and self.time_varying_regression):
        end += self.k_exog
        unconstrained[start:end] = (constrained[start:end] ** 0.5)
        start += self.k_exog
    if self.measurement_error:
        unconstrained[start] = (constrained[start] ** 0.5)
        start += 1
        end += 1
    if self.state_error:
        unconstrained[start] = (constrained[start] ** 0.5)
    return unconstrained
