title: II type error in R
body: <p>I have two samples of normal distribution. I have null hypothesis E=a1 and alternative E=a2</p>
  
  <pre><code>s1 &lt;- rnorm(1000, mean = a1, sd = std)
  s2 &lt;- rnorm(1000, mean = a2, sd = std)
  </code></pre>
  
  <p>I can calculate I type error by doing this: </p>
  
  <pre><code>p_value = t.test(s1,alternative=c("t"),mu=a1)$p.value
  if(p_value &lt;= alpha) 
  #then it's first type error
  </code></pre>
  
  <p>How can I calculate II type error?</p>
  
  <p><code>
  </code></p>