Skip to content
Prev 326197 / 398502 Next

Add constraints to rbinom

You don't need a constraint (rbinom won't give x>n), but you need to make sure you are using the n you want to use: try
 x <- cbind(x,rbinom(300,n[i],p[i]))	# mind the "[i]" after the n
at the respective line. Furthermore, you need to remove one transformation of x to make sure you divide by the right n, try
rate <- t(x/n)

I think that should do the trick. I didn't check the remainder of the code, though.

HTH, Michael
Message-ID: <AE85F2AAC98B094483D12EEA72230EBD4FC1EF29@GADC-EMB019.na.pg.com>
In-Reply-To: <CALv--dbHvmMRgDobxhY8y1uAzUapKrS5ADiSNhcY5Le1OHLawA@mail.gmail.com>