title: Use specific alpha parameters for multiple elastic net in R
body: <p>I'm trying to perform multiple elastic net simultaneously in R. I have a 10x15 matrix each column is called Xi e.g. X1,X2,...,X15 and perform elastic net in order to obtain the optimal <code>alpha</code> and <code>lambda</code>
  parameters. Then i save the <code>alpha</code> values in a dataframe called <code>alphas</code> in my environment and looks like the following</p>
  <pre><code>alpha
  1  0.001
  2  0.000
  3  0.000
  4  0.064
  5  0.729
  6  0.729
  7  1.000
  8  0.001
  9  0.000
  10 0.000
  11  0.001
  12  0.000
  13  0.000
  14  0.064
  15  0.729
  </code></pre>
  <p>My goal is to perform multiple <code>cv.glmnet</code> (one for each Xi) with the corresponding alpha i already found. e.g. use <code>alpha=0.001</code> for <code>cv.glmnet</code> model of Xi, etc. How can i replace the alpha value in the below code in order to use all the obtained alpha values?</p>
  <pre><code>data&lt;-matrix(rnorm(36),nrow=10,ncol = 15)
  colnames(data) &lt;- c(&quot;X1&quot;, &quot;X2&quot;, &quot;X3&quot;, &quot;X4&quot;, &quot;X5&quot;, &quot;X6&quot;,&quot;X7&quot;,&quot;X8&quot;,&quot;X9&quot;,&quot;X10&quot;,&quot;X11&quot;,&quot;X12&quot;,&quot;X13&quot;,&quot;X14&quot;,&quot;X15&quot;)
  data #random data
  library(glmnet)
  library(coefplot)
  
  A &lt;- as.matrix(data)
  set.seed(1234)
  results &lt;- lapply(seq_len(ncol(A)), function(i) {
    list(
      cvfit = cv.glmnet(A[, -i] , A[, i] , standardize = TRUE , type.measure = &quot;mse&quot; , nfolds = 10 , alpha = 1)
    )
  })
  </code></pre>