title: How do I run a circular mixed effects model in parallel processing using packages bpnreg() and parallel()?
body: <p>I have a large data set that I am trying to run the bpnme() function on using 10,000 iterations. I can only get a subsample of this to work on my laptop by taking a sample of 500 rows and only calculating 100 iterations.</p>
  <p>Once I figure out how to parallelize on a work computer with 32 cores I hope I'll be able to run all 9,000 rows of data and all 10,000 iterations per model. Don't laugh but I have generated some reprex (probably in a fairly ridiculous fashion) but the resulting object df is an adequate representation of my research data. How do I use the mclapply() function to compute these models where I can specify more cores (m.c. = 31)?</p>
  <pre><code>library(tidyverse)
  library(bpnreg)
  library(parallel)
  </code></pre>
  <h3>one of three locations, anterior, middle, or posterior</h3>
  <pre><code>locations &lt;- 
    sample(letters [22:24])
  location &lt;- 
    sample(locations, 9100, replace = T)
  </code></pre>
  <h3>one of two sides left or right</h3>
  <pre><code>sides &lt;-
    sample(LETTERS[15:16])
  side &lt;-
    sample(sides, 9100, replace = T)
  </code></pre>
  <h3>one of 5 types (A, B, C, D, E)</h3>
  <pre><code>types &lt;-
    sample(LETTERS[1:5])
  type &lt;-
    sample(types, 9100, replace = T)
  </code></pre>
  <h3>normally distributed number value between 0.005-6.26</h3>
  <pre><code>radian_degree &lt;-
    rnorm(n = 9100, mean = 3.1324, sd = 0.31325)
  </code></pre>
  <h3>one of 4 specimens  numbered 1-4</h3>
  <pre><code>spec_num &lt;-
    sample(1:4, 9100, replace=T)
  </code></pre>
  <h3>Create 9,100 rows of a data object</h3>
  <pre><code>df &lt;-
    data.frame(spec_num, location, side, type, radian_degree) %&gt;% 
    sample_n(500)
  df$spec_num &lt;- as.numeric(df$spec_num) 
  </code></pre>
  <h3>Run three models while adding more fixed effects in each time. Note that only 100 iterations are specified. In reality I want 10,000 iterations and a burn = 1,000.</h3>
  <pre><code>fit.df.2 &lt;- bpnme(pred.I = radian_degree ~ side + (1|spec_num), data = df, its = 100, burn = 10, n.lag = 3, seed = 101)
  
  fit.df.3 &lt;- bpnme(pred.I = radian_degree ~ side + location + (1|spec_num), data = df, its = 100, burn = 10, n.lag = 3, seed = 101)
  
  fit.df.4 &lt;- bpnme(pred.I = radian_degree ~ side + location + type + (1|spec_num), data = df, its = 100, burn = 10, n.lag = 3, seed = 101)
  </code></pre>