Displaying 2 results from an estimated 2 matches for "hxc05".
2004 Feb 18
4
How to repeat a procedure
Hello,
1. After I generate a 100x50 matrix by x3<-matrix(0,100,50);for (i in
1:100) {x1<-rpois(50, mu[i]);x2<-x1; x2[runif(50)<.01]<-0; x3[i,]<-x2},
2. I want to calculate means and sample variances of each row and create a
new matrix 100x2;
3. I then want to repeat above procedure 500 times so that eventually I
will have 500 100x2 matrices.
Would someone mind helping me to
2004 Feb 10
1
generate random sample from ZINB
I want to generate 1,000 random samples of sample size=1,000 from ZINB.
I know there is a rnegbin() to generate random samples from NB, and I know
I can use
the following process:
do i=1 to 1000
n=0
do i=1 to 1000
if runi(1)>0.1 then x(i) = 0; else
x(i)=rnegbin();
n=n+1;
if n>1000 then stop;
end;
output;
end;
Anybody can help me out with the R code?
Thanks very much ahead of time.