code: def initstate(y, modeltype, initial_smoothed, alpha, theta):
      states = np.zeros((1, 5), dtype=np.float32)
      states[0, 0] = (
          alpha * y[0] + (1 - alpha) * initial_smoothed
      )  # level
      states[0, 1] = y[0]  # mean y
      if modeltype in [DSTM, DOTM]:
          # dynamic models
          states[0, 2] = y[0]  # An
          states[0, 3] = 0  # Bn
          states[0, 4] = y[0]  # mu
      else:
          # nodynamic models
          n = len(y)
          Bn = (
              6
              * (
                  2 * np.mean(np.arange(1, n + 1) * y)
                  - (1 + n) * np.mean(y)
              )
              / (n**2 - 1)
          )
          An = np.mean(y) - (n + 1) * Bn / 2
          states[0, 2] = An
          states[0, 3] = Bn
          states[0, 4] = initial_smoothed + (1 - 1 / theta) * (An + Bn)
  
      return states
  
imports: import math
  from typing import Tuple
  import numpy
  from numba import njit
  from scipy.stats import norm
  from statsmodels.tsa.seasonal import seasonal_decompose
  from statsmodels.tsa.stattools import acf
  from .ets import restrict_to_bounds, results
  from .utils import _seasonal_naive, _repeat_val_seas, CACHE, NOGIL
label_desc: Use image node_id 1 for calling a global function with example usage: initstate(y, modeltype, initial_smoothed, alpha, theta) and returns: states