title: Linear regression in kdb
body: <p>This is how I build linear regression but when I include more than two columns, my code does not work.</p>
  
  <pre><code>// Load relevant columns into memory
  //
  t:?[`data;enlist(=;`date;dat);0b;(ind,dep)!ind,dep];
  
  
  X:9h$enlist[count[t]#1],t ind;
  beta:inv[X mmu flip X] mmu X mmu 9h$t dep;
  
  res:(`yInt,ind)!beta;
  </code></pre>
  
  <p><code>ind</code> is independent fields names in symbols and dep is the dependent fields names in symbol. This part <code>inv[X mmu flip X]</code> does not not work. There will be a row that's blank if I include more than two fields for ind and I cannot do <code>inv</code>. I am not really sure how I can include more columns/fields for independent variables. </p>