title: lambda.1se not being in one standard error of the error
body: <p>In the documentation of the function <a href="https://www.rdocumentation.org/packages/glmnet/versions/2.0-10/topics/cv.glmnet" rel="nofollow noreferrer"><code>cv.glmnet()</code></a>, it is given that:</p>
  <blockquote>
  <p>lambda.1se  :<br />
  largest value of lambda such that error is within 1 standard error of the minimum.</p>
  </blockquote>
  <p>Which means that <code>lambda.1se</code> gives the <code>lambda</code>, which gives an error (<code>cvm</code>) which is one standard error away from the minimum error.</p>
  <p>So, while trying to check this fact:<br />
  There is a data set <code>Boston</code> in the library <code>MASS</code>. I performed a cross validation, using the lasso:</p>
  <pre><code>x = model.matrix(crim~.-1,data=Boston)#-1 for removing the intercept column
  y = Boston$crim
  cv.lasso = cv.glmnet(x,y,type.measure = &quot;mse&quot;,alpha=1)
  </code></pre>
  <p>And the value of <code>cv.lasso$lambda.min</code> comes out to be:</p>
  <pre><code>&gt; cv.lasso$lambda.min
  [1] 0.05630926
  </code></pre>
  <p>And, the value of <code>cv.lasso$lambda.1se</code> is:</p>
  <pre><code>&gt; cv.lasso$lambda.1se
  [1] 3.375651
  </code></pre>
  <p>Now, look at this:</p>
  <pre><code>&gt; std(cv.lasso$cvm)
  [1] 0.7177808
  </code></pre>
  <p>Where <code>std</code> is a function, that returns the standard error of the values inserted in it.<a href="https://i.stack.imgur.com/Azk6H.png" rel="nofollow noreferrer">1</a><br />
  And the minimum value of <code>cvm</code> can be found as:</p>
  <pre><code>&gt; cv.lasso$cvm[cv.lasso$lambda==cv.lasso$lambda.min]
  [1] 42.95009
  </code></pre>
  <p>So, we add the standard error to the value of <code>cvm</code>  and we get:</p>
  <pre><code>&gt; 42.95009+0.7177808
  [1] 43.66787
  </code></pre>
  <p>Even though there is no <code>lambda</code> value corresponding to this <code>cvm</code> value, we can have an idea on the basis of existing data:<br />
  <a href="https://i.stack.imgur.com/Azk6H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Azk6H.png" alt="enter image description here" /></a></p>
  <p>Which means <code>lambda.1se</code> should be between 0.4784899 and 0.4359821. But that's absolutely not the case. So, there's a gut feeling that says I'm making a blunder here. Can you help me point at that?</p>
  <hr />
  <p><a href="https://i.stack.imgur.com/Azk6H.png" rel="nofollow noreferrer">1</a>:Definition of <code>std</code>:</p>
  <pre><code>std&lt;-function(x)
    sd(x)/sqrt(length(x))
  </code></pre>