title: How do you create a design matrix in Python?
body: <p>I am trying to create a design matrix using NumPy for a linear regression function. Here is the code I have so far:</p>
  <pre><code>import numpy as np
  
  def linReg(n, parameter):
    X = np.arange(0, n, 1)*2/n
    Y = (X * parameter) + np.random.randn(1)
  
    return X, Y
  </code></pre>
  <p>I am not entirely sure if my X design matrix variable is correct. How would I add a column of 1s to it? Should I use np.append?</p>