title: Creating classification features from wavelet transformed time series
body: <p>I'm interested in using a wavelet transform, Haar for example, to create classification variables from time series data to use in logistic regression. </p>
  
  <p>Simple example.  Let's say I'm trying to predict payment defaults and I have a person's monthly expense data and someone with consistent expenses is better than someone with increasing expenses in the the most recent 4 months.</p>
  
  <p>If I have two sample borrowers:</p>
  
  <p>Borrower A - Good - expensesA = c(100,110,95,105), default = 0</p>
  
  <p>Borrower B - Bad - expensesB = c(75,100,150,200), default = 1</p>
  
  <p>If I am using logistic regression, <code>glm()</code> in R, to create a classification model, and the R <code>wavelets</code> package <code>dwt()</code> function for a "haar" transform of the time series what are the appropriate features to extract from the <code>dwt()</code> object to use in <code>glm()</code>?</p>
  
  <p>The truncated output for Borrower A is:</p>
  
  <pre><code>tr = dwt(expensesA, filter = "haar")
  tr
  
  An object of class "dwt"
  Slot "W":
  $W1
  [,1]
  [1,] 7.071068
  [2,] 7.071068
  
  $W2
  [,1]
  [1,]   -5
  
  
  Slot "V":
  $V1
  [,1]
  [1,] 148.4924
  [2,] 141.4214
  
  $V2
  [,1]
  [1,]  205
  
  
  Slot "filter":
  Filter Class: Daubechies
  Name: HAAR
  Length: 2
  Level: 1
  Wavelet Coefficients: 7.0711e-01 -7.0711e-01
  Scaling Coefficients: 7.0711e-01 7.0711e
  
  -01
  </code></pre>
  
  <p>I know <code>W</code>s are wavelet coefficients and the <code>V</code>s the scaling coefficients.</p>
  
  <p>Do I need to use all four <code>W1</code> and <code>V1</code> values as variables to properly model this or is it okay to try just the <code>W1</code>s without <code>V1</code>s (or vice versa)?</p>
  
  <p>Is it worthwhile to try only the single <code>W2</code> and <code>V2</code>s as variables?</p>
  
  <p>Or is it better to try to use a clustering algortihm and label them based on clusters?</p>
  
  <p>I know it of course also depends on the data, but I'm looking for a starting point regarding best practices.</p>