class_docstr: the Schwartz type 1 stochastic process
  
  :math::
  dx_t = \kappa (\mu - \ln x_t) x_t dt + \sigma x_tdW \
  
  The Schwartz type 1 process is a log of the Ornstein-Uhlenbeck stochastic
  process.
class_docstr_tok: ["the","Schwartz","type","1","stochastic","process",":","math",":",":","dx_t","=","\\kappa","(","\\mu","-","\\ln","x_t",")","x_t","dt","+","\\sigma","x_tdW","\\","The","Schwartz","type","1","process","is","a","log","of","the","Ornstein-Uhlenbeck","stochastic","process","."]
docstr: assumes data is 1d, univariate time series
  formula from sitmo
docstr_tok: ["assumes","data","is","1d",",","univariate","time","series","formula","from","sitmo"]
code: def fitls(self, data, dt):
      """assumes data is 1d, univariate time series
      formula from sitmo
      """
      # brute force, no parameter estimation errors
      nobs = len(data) - 1
      exog = np.column_stack((np.ones(nobs), np.log(data[:-1])))
      parest, res, rank, sing = np.linalg.lstsq(
          exog, np.log(data[1:]), rcond=-1
      )
      const, slope = parest
      errvar = res / (
          nobs - 2.0
      )  # check denominator estimate, of sigma too low
      kappa = -np.log(slope) / dt
      sigma = np.sqrt(errvar * kappa / (1 - np.exp(-2 * kappa * dt)))
      mu = const / (1 - np.exp(-kappa * dt)) + sigma**2 / 2.0 / kappa
      if np.shape(mu) == (1,):
          mu = mu[0]  # TODO: how to remove scalar array ?
      if np.shape(sigma) == (1,):
          sigma = sigma[0]
      # mu, kappa are good, sigma too small
      return mu, kappa, sigma
  
imports: import numpy
  from scipy import stats, signal
  import matplotlib.pyplot
label_desc: Use image node_id 6 for calling the SchwartzOne obj's underlying member method code with example usage: obj.fitls(data, dt) and returns: mu,  kappa,  sigma