title: Logit and ClassLog(): how to classify a larger dataframe?
body: <p>I am running a Logit model using a sample from my data, but when I try to run the <code>ClassLog</code> function to classify my cases in the original dataframe I get an error:</p>
  
  <pre><code>Error in table(predict(MOD, type = "response") &gt; cut, resp) : 
  all arguments must have the same length
  </code></pre>
  
  <p>This is my reproducible example:</p>
  
  <pre><code>set.seed(25)
  myData = data.frame(x = rnorm(10000), y = runif(10000), dep = c(rep(1,400),rep(0,9600)))
  myData$dep = factor(myData$dep)
  </code></pre>
  
  <p>Creating a sample with the same number of <code>dep ==0</code> and <code>dep ==1</code>:</p>
  
  <pre><code>dep.1 = subset(myData,dep==0)
  dep.2 = subset(myData,dep==1)
  
  set.seed(30)
  rows = sample(nrow(dep.1),nrow(dep.2))
  dep.1 = dep.1[rows,]
  
  mySample = rbind(dep.1,dep.2)
  </code></pre>
  
  <p>Running the logit model:</p>
  
  <pre><code>model = glm(data=mySample, dep~x+y,family="binomial")
  
  library(QuantPsyc)
  </code></pre>
  
  <p><strong>Works</strong> with the sample used to run the model:</p>
  
  <pre><code>ClassLog(MOD = model, mySample$dep,cut=0.5)
  </code></pre>
  
  <p><strong>Does not work</strong> with the original data <code>myData</code>:</p>
  
  <pre><code>ClassLog(MOD = model, myData$dep,cut=0.5)
  </code></pre>
  
  <p>Is there any way to run ClassLog on the original (larger) dataframe? I know I can use <code>predict()</code> to get the Probability of dep == 1, but <code>ClassLog</code> offers a direct classification according to an arbitrary <code>cut</code> and a classification table, which is much more desirable to me.</p>