title: Apply kurtosis to a distribution in python
body: <p>I have a dataset which is in the format of</p>
  
  <p>frequency, direction, normalised power spectral density, spread, skewness, kurtosis</p>
  
  <p>I am able to visualise the distribution of a specific record using the code from the top answer in <a href="https://stackoverflow.com/a/5885349/1135883">skew normal distribution in scipy</a> but I am not sure how to apply a kurtosis value to a distribution?</p>
  
  <pre><code>from scipy import linspace
  from scipy import pi,sqrt,exp
  from scipy.special import erf
  from pylab import plot,show
  
  def pdf(factor, x):
      return (100*factor)/sqrt(2*pi) * exp(-x**2/2)
  
  def cdf(x):
      return (1 + erf(x/sqrt(2))) / 2
  
  def skew(x,e=0,w=1,a=0, norm_psd=1):
      t = (x-e) / w
      return 2 / w * pdf(norm_psd, t) * cdf(a*t)
  
  n = 540
  e = 341.9 # direction
  w = 59.3 # spread
  a = 3.3 # skew
  k = 4.27 # kurtosis
  n_psd = 0.5 # normalised power spectral density
  x = linspace(-90, 450, n) 
  
  
  p = skew(x, e, w, a, n_psd)
  print max(p)
  plot(x,p)
  show()
  </code></pre>
  
  <p><strong>Edit:</strong> I removed skew normal from my title as I don't think it is actually possible to apply a kurtosis value to the above distribution, I think a different distribution is necessary, as direction is involved a distribution from circular statistics may be more appropriate?</p>
  
  <p>Thanks to the answer below I can apply kurtosis using the pdf_mvsk function demonstrated in the code below, unfortunately my skew values cause a negative y value, but the answer satisfies my question.</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import statsmodels.sandbox.distributions.extras as extras
  
  pdffunc = extras.pdf_mvsk([341.9, 59.3, 3.3, 4.27])
  range = np.arange(0, 360, 0.1)
  plt.plot(range, pdffunc(range))
  plt.show()
  </code></pre>