title: error "derivs is larger than length of x" in b-splines used in lmer
body: <p>I use <code>Rstudio</code>. According to <a href="https://stats.stackexchange.com/questions/135694/using-b-splines-within-a-linear-mixed-effects-model-in-r">https://stats.stackexchange.com/questions/135694/using-b-splines-within-a-linear-mixed-effects-model-in-r</a> I would like to add so-called b-splines into my lmer model:</p>
  
  <pre><code>degree&lt;- 3
  fit&lt;- lmer(log(log(Amplification)) ~ bs(poly(Voltage, degree)) + bs(poly(Voltage, degree) | Serial_number),data = APD))
  </code></pre>
  
  <p>but this results in </p>
  
  <pre><code>Error in splineDesign(Aknots, x, ord) : 
    length of 'derivs' is larger than length of 'x'
  In addition: Warning messages:
  1: In Ops.factor(poly(Voltage, 3), Serial_number) :
    ‘+’ not meaningful for factors
  2: In min(x, na.rm = na.rm) :
    no non-missing arguments to min; returning Inf
  3: In max(x, na.rm = na.rm) :
    no non-missing arguments to max; returning -Inf
  </code></pre>
  
  <p>What does that mean? When I use instead</p>
  
  <pre><code>summary(fit&lt;- lmer(log(log(Amplification)) ~ (poly(bs(Voltage), degree)) + (poly(Voltage, degree) | Serial_number), data = APD))
  </code></pre>
  
  <p>then this results in</p>
  
  <pre><code>Error in poly(dots[[i]], degree, raw = raw, simple = raw) : 
    'degree' must be less than number of unique points
  </code></pre>
  
  <p>Going down to <code>degree=0</code> yields</p>
  
  <pre><code>Error in poly(dots[[1L]], degree, raw = raw, simple = raw &amp;&amp; nd &gt; 1) : 
    'degree' must be at least 1
  </code></pre>
  
  <p>How can I add b-splines into lmer?
  Thank you in advance!</p>