by Jimmy Dur
Last Updated April 11, 2018 18:19 PM

I am trying to reproduce a simulation study in a paper.To do it, I need to generate counts for control and treatment groups as described below,

generate $θ_{i1}$ from $Uni(0.1, 0.2)$ for $i = 1, . . . ,k_{0}$ and set $θ_{i2} =θ_{i1}$ for $i=1, . . . ,k_{0}$. Set $θ_{i1}= 0.2$ and $θ_{i2}= 0.5$ for $i =k_{0}+1,...,k$. Set $n=40$, and for each $j ∈ {1, 2}$ and $i$, generate a count $C_{ji}$ from the binomial distribution $Bin(θ_{ji}, n)$ whose quantile is $u_{i}$.

for a given $u$, I am trying to generate counts $C_{ji}$ but I am not sure if I am doing it correctly. Based on my understanding, I wrote down the following R code. And it always gives $C_{1j}=C_{2j}$ for all $j=1,...,k_{0}$. I don't think this is the data generated for the simulations in the paper I am following. I may be misunderstanding something. I would appreciate if one can help me out.

```
k=10;k0=8;n=40
u=c(0.017,0.017,0.2296,0.6251,0.539,0.66,0.03,0.99,0.0091,0.00028)
#obtain p0 and p1
θ1=c(runif(k0,0.2,0.3),rep(0.3,k-k0))
θ2=c(p0[1:k0],rep(0.7,k-k0))
c1<-numeric(k)
for (i in 1:k){
c1[i]=qbinom(u[i],n,θ1[i])
}
c2<-numeric(k)
for (i in 1:k){
c2[i]=qbinom(u[i],n,θ2[i])
}
```

- ServerfaultXchanger
- SuperuserXchanger
- UbuntuXchanger
- WebappsXchanger
- WebmastersXchanger
- ProgrammersXchanger
- DbaXchanger
- DrupalXchanger
- WordpressXchanger
- MagentoXchanger
- JoomlaXchanger
- AndroidXchanger
- AppleXchanger
- GameXchanger
- GamingXchanger
- BlenderXchanger
- UxXchanger
- CookingXchanger
- PhotoXchanger
- StatsXchanger
- MathXchanger
- DiyXchanger
- GisXchanger
- TexXchanger
- MetaXchanger
- ElectronicsXchanger
- StackoverflowXchanger
- BitcoinXchanger
- EthereumXcanger