'Transform constrained parameters used in likelihood evaluation
to unconstrained parameters used by the optimizer.
Parameters
constrained : array_like
Array of constrained parameters used in likelihood evalution, to be
transformed.
Returns
unconstrained : array_like
Array of unconstrained parameters used by the optimizer.'

def untransform_params(self, constrained):

    constrained = np.array(constrained, ndmin=1)
    unconstrained = np.zeros(constrained.shape, dtype=constrained.dtype)
    unconstrained[self._params_trend] = constrained[self._params_trend]
    if ((self.k_ar > 0) and self.enforce_stationarity):
        if (self.error_cov_type == 'diagonal'):
            state_cov = np.diag(constrained[self._params_state_cov])
        elif (self.error_cov_type == 'unstructured'):
            state_cov_lower = np.zeros(self.ssm['state_cov'].shape, dtype=constrained.dtype)
            state_cov_lower[self._idx_lower_state_cov] = constrained[self._params_state_cov]
            state_cov = np.dot(state_cov_lower, state_cov_lower.T)
        coefficients = constrained[self._params_ar].reshape(self.k_endog, (self.k_endog * self.k_ar))
        (unconstrained_matrices, variance) = unconstrain_stationary_multivariate(coefficients, state_cov)
        unconstrained[self._params_ar] = unconstrained_matrices.ravel()
    else:
        unconstrained[self._params_ar] = constrained[self._params_ar]
    if ((self.k_ma > 0) and self.enforce_invertibility):
        state_cov = np.eye(self.k_endog, dtype=constrained.dtype)
        coefficients = constrained[self._params_ma].reshape(self.k_endog, (self.k_endog * self.k_ma))
        (unconstrained_matrices, variance) = unconstrain_stationary_multivariate(coefficients, state_cov)
        unconstrained[self._params_ma] = unconstrained_matrices.ravel()
    else:
        unconstrained[self._params_ma] = constrained[self._params_ma]
    unconstrained[self._params_regression] = constrained[self._params_regression]
    if (self.error_cov_type == 'diagonal'):
        unconstrained[self._params_state_cov] = (constrained[self._params_state_cov] ** 0.5)
    elif (self.error_cov_type == 'unstructured'):
        unconstrained[self._params_state_cov] = constrained[self._params_state_cov]
    if self.measurement_error:
        unconstrained[self._params_obs_cov] = (constrained[self._params_obs_cov] ** 0.5)
    return unconstrained
