search for: tempbin

Displaying 1 result from an estimated 1 matches for "tempbin".

Did you mean: dumpbin
2000 Sep 20
1
SV: sample from contingency table
...i <- function(n, size, p) { NrDim <- length(p) if(NrDim<2) stop("The simulated variabel has to be at least 2-dimensional") res <- matrix(data=NA, nrow=n, ncol=NrDim) p <- p/sum(p) TempSize <- size for(i in 1:NrDim) { TempP <- p[i]/sum(p[i:NrDim]) TempBin <- rbinom(n=n, size=TempSize, prob=TempP) TempSize <- TempSize-TempBin res[,i] <- TempBin } return(res) } # Then you can draw 10 samples like this, whith # each row representing a contingency table x <- as.matrix(1:4, nrow=2, ncol=2) rmulti(10, sum(x), x) Regin -----Op...