1. use a sensible subject line
2. please read the docs prior to posting messages.
Some basic rule is, e.g., to initialize objects to their final lengths
before entering loops.
osita k ezeh wrote:
> please can anyone help me out. Am a new user of R
> program. Am having problem
> with this code below, not getting the expected
> 1. Each m, the cumulative sum should be 1.000 but the
> 2nd and 3rd m returned 2.000 and 3.000
> instead of 1.000.
Well, you say cumsum(out.prob) which is the cumulative sum of the whole
vector, not just that one for the current m. Your result would not
change when you replace cumsum by sum, BTW.
> 2. to get the LCL(m) and UCL(m) for each m base on
> these instructions
> if out.cum > 0.025 then LCL(m)= y-1
> if out.cum >0.975 then ucl(m)= y-1
> how do I code these instructions into this code.
What is LCL/UCL in general?
If you have lcl & co. already, then you can say:
if(out.cum > 0.025) lcl[m] <- y-1
if(out.cum > 0.975) ucl[m] <- y-1
please can anyone help me out. Am a new user of R
program. Am having problem
with this code below, not getting the expected
I wrote a function that replicates your results
and would probably be a little more efficient
(see Uwe's reply), but it replicates your results --
without "fixing" them. I think the real problem
here is that we're not sure what you want
(especially for query #1). (I assume LCL/UCL
are "lower/upper confidence limit".) I can
see that you're coding some kind of combinatoric
probability (all those lgamma() calls), but I haven't
taken the time to puzzle through and figure out
what it is. Perhaps there's a typo in your