Note that there are some explanatory texts on larger screens.

plurals
  1. POplotting error - halfnormal plot [
    text
    copied!<p>Hopefully this is a straight-forward question. I'm not sure where there error is--it seems like a<code>R</code> is not working here. I've restarted <code>R</code> and reproduced the error, so I'm not sure what's going on. </p> <p><strong>Problem:</strong> I have some data, and am trying to produce a halfnormal plot for the effects. Ho-hum, everything's going fine... except the most significant effect isn't showing up in my half normal plot:</p> <pre><code># load data dat2 &lt;- read.table("http://www.stat.ucla.edu/~hqxu/stat201A/data/solder2.dat") # required library library(faraway) # rename vars names(dat2) &lt;- tolower(names(dat2)) # create full model a1.1 &lt;- aov(defects ~ a + b + c + d + e + f + g + h + a:b + a:e + a:f + a:g + a:h + b:f + b:g + b:h + c:f + c:g + c:h + d:f + d:g + d:h + e:f + e:g + e:h,data=dat2) # plot effects halfnorm(a1.1$coef[-1], nlab= length(a1.1$coef[-1])/3-1, labs= names(a1.1$coef[-1]), ylab= "abs|Factor Effects|", main= "Half Normal Plot") + qqline(abs(a1.1$coef[-1])) </code></pre> <p><img src="https://i.stack.imgur.com/CPdva.png" alt="enter image description here"></p> <p>As you can see, my plot is missing effect C. The largest one. Please let me know if you're not able to reproduce this error. It seems very odd to me.</p> <pre><code># effects from the model, descending a1.1$coef[-1][order(abs(a1.1$coef[-1]), decreasing=T)][1:10] c a e a:h b:f c:f a:f c:g c:h a:g 56.875 -27.500 22.750 13.125 -13.000 -12.750 12.500 12.375 7.375 7.000 </code></pre> <p><strong>EDIT</strong> As expected, and noted below, this was simple. Here's the correct code:</p> <pre><code>halfnorm(a1.1$coef[-1], nlab= round(length(a1.1$coef[-1])/3,0), labs= names(a1.1$coef[-1]), ylab= "abs|Factor Effects|", main= "Half Normal Plot") + qqline(abs(a1.1$coef[-1])) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload