title: How are envfit results created?
body: <p>I have a question regarding how to recreate the results from the <code>envfit()</code> function in the <a href="/questions/tagged/vegan" class="post-tag" title="show questions tagged &#39;vegan&#39;" rel="tag">vegan</a> package. </p>
  
  <p>Here is an example of <code>envfit()</code> being used with an ordination and an environmental vector. </p>
  
  <pre><code>data(varespec)
  data(varechem)
  ord &lt;- metaMDS(varespec)
  chem.envfit &lt;- envfit(ord, varechem, choices = c(1,2), permutations = 999)
  chem.scores.envfit &lt;- as.data.frame(scores(chem.envfit, display = "vectors"))
  chem.scores.envfit
  </code></pre>
  
  <p><em>"The values that you see in the table are the standardised coefficients from the linear regression used to project the vectors into the ordination. These are directions for arrows of unit length."</em> - comment from <a href="https://stackoverflow.com/questions/59290350/plotted-envfit-vectors-not-matching-nmds-scores">Plotted envfit vectors not matching NMDS scores</a></p>
  
  <p>Also, from <code>?envfit</code>:</p>
  
  <blockquote>
    <p>The printed output of continuous variables (vectors) gives the
    direction cosines which are the coordinates of the heads of unit
    length vectors. In plot these are scaled by their correlation (square
    root of the column r2) so that weak predictors have shorter arrows
    than strong predictors. You can see the scaled relative lengths using
    command scores.</p>
  </blockquote>
  
  <p>Could someone please show me explicitly what linear model is being run, what standardized coefficients are being used, and where cosine is being applied to create these values? </p>