title: Non-conformable arrays in R
body: <pre><code>y &lt;- matrix(c(7, 9, -5, 0, 2, 6), ncol = 1)
  try &lt;- t(y)
  tryy &lt;- try %*% y
  i &lt;- solve(tryy)
  h &lt;- y %*% i %*% try
  
  uniroot(as.vector(solve(((1-x) * diag(6)) + h)), c(-Inf, Inf))
  
  Error in (1 - x) * diag(6) : non-conformable arrays
  </code></pre>
  
  <p>The purpose of this command  <code>uniroot(as.vector(solve(((1-x) * diag(6)) + h)), c(-Inf, Inf))</code> is to solve the characteristics equation det[(1-λ)I+h] = 0 </p>
  
  <p>where, λ=eigenvalues , I=identity matrix , h=hat matrix=y(y'y)^(-1)y'</p>
  
  <p>here  λ is unknown ,we have to solve for it.</p>
  
  <p>I am not understanding where is the problem here? I have tried as:</p>
  
  <pre><code>  as.vector(solve(6*diag(6)+h))
  </code></pre>
  
  <p>This is not non-conformable. But why is not working inside the uniroot function? </p>