title: Having trouble understanding the upper bound and lower bound in the following R code
body: <p>I have pasted the code i am having an issue with at the end. It contains R command lines to display the observed proportions of correct response over the ability score levels for group 1.
  The lower bound of ability for group 1 is speciﬁed with t1l that implies theta- 1-lower; the upper bound of ability for group 1 is speciﬁed with t1u that implies theta-1-upper:
  Before this code there was another code which defined theta as following:</p>
  <pre><code>theta &lt;- seq(-3, 3, .1875)
  f &lt;- rep(21, length(theta))
  </code></pre>
  <p>Then this code was mentioned. What i understand is that this code is finding some values between 2 bounds. However feel that if i want to find something in between 1 and 3 then i should make a code which says i want to find values less than 3 and more than 1.
  However this code  does this for the lower bound</p>
  <pre><code>theta[g] &lt;= t2l) { lowerg1 &lt;- lowerg1 + 1 }
  </code></pre>
  <p>This means it finds values less than 1? Values less than 1 would be something like 0 , -1 -2 etc and we want to find values in BETWEEN 1 and 3. I feel we should instead say theta[g] &gt;= t2l) so that i can find values larger than 1 so i can find values like 2 which is between 3 and 1
  It does the same thing for upper bound. but this will find ALL values below 3 not just between 3 and 1</p>
  <pre><code>theta[g] &lt;= t2u) 
  </code></pre>
  <p>This is how i am visualizing things to be going  on
  <a href="https://i.stack.imgur.com/uPiiS.png" rel="nofollow noreferrer">https://i.stack.imgur.com/uPiiS.png</a>
  And this is how i feel things should be
  <a href="https://i.stack.imgur.com/Jyly1.png" rel="nofollow noreferrer">https://i.stack.imgur.com/Jyly1.png</a></p>
  <pre><code>t2l &lt;- 1
  t2u &lt;- 3
  lowerg1 &lt;- 0
  for (g in 1:length(theta)) {
  if (theta[g] &lt;= t2l) { lowerg1 &lt;- lowerg1 + 1 }
  }
  upperg1 &lt;- 0
  for (g in 1:length(theta)) {
  if (theta[g] &lt;= t2u) { upperg1 &lt;- upperg1 + 1 }
  }
  theta2 &lt;- theta[lowerg1:upperg1]
  p2 &lt;- p[lowerg1:upperg1]
  if (mdl == 1) { maintext &lt;- paste(&quot;Group 2&quot;, &quot;\n&quot;) }
  if (mdl == 2) { maintext &lt;- paste(&quot;Group 2&quot;, &quot;\n&quot;) }
  if (mdl == 3) { maintext &lt;- paste(&quot;Group 2&quot;, &quot;\n&quot;) }
  plot(theta2, p2, xlim=c(-3,3), ylim=c(0,1),
  xlab=&quot;Ability&quot;, ylab=&quot;Probability of Correct Response&quot;,
  main=maintext)
  </code></pre>