[R] multivariate Poisson distribution
Hello, from a search of the archives and functions, I am looking for information on creating random correlated counts from a multivariate Poisson distribution. I can not seem to find a function that does this. Perhaps, it has not yet  been created. Has anyone created an R package that does this.  thanks,  Jourdan Gold   [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Ordinal Mantel-Haenszel type inference
Hello, I am searching for an R-Package that does an exentsion of the Mantel-Haenszel test for ordinal data as described in Liu and Agresti (1996) "A Mantel-Haenszel type inference for cummulative odds ratios". in Biometrics. I see packages such as Epi that perform it for binary data and derives a varaince for it using the Robbins and Breslow variance method. As well as another pacakge that derives it for nominal variables but does not provide a variance or confidence limit. Does a package exist that does this? I have searched the list archives and can't seem to see such a package but I could be missing something. thank you. yours sincerely, Jourdan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help on tapply using sample with differing sample-sizes
Hello, My question likely got buried so I am reposting it in the hopes that someone has an answer. I have thought more about the question and modified my question. I hope tha my specific question is: I am attempting to create a bootstrap procedure for a finite sample using the theory of Rao and Wu, JASA (1988) that replicates within each strata (h) n_h - 1 times. To this end, I require a different sample size for each stratum. Unfortunately, it appears that the sample command which is used to obtain my resamples only allows a scalar for the sample size. i.e it does not currently work with a vector. Does any one have any suggestions as to how to get around this or if this is not possible, if there is another way to accomplish what I want to do. Perhaps, tapply is not the best way to go about getting what I want. if so what would all you strong programmers reccommend instead. I am thinking that perhaps loops may be the only way to go. raoboot <- function (datavar, statavar, weight, nboot, ciqntl, ciqntu) { i <- 1 sdatavar <- sort(datavar) sstratavar <- sort(statavar) sweight <- sort(weight) sdatavarwght <- sdatavar*sweight # stramn <- tapply(sdatavar, sstratavar, mean) meanvect <- rep(0, times = nboot) stratasize <- tapply(sdatavarwght, sstratavar, length) stratasizemone <- stratasize -1 while (i < nboot) { #vector of resampled observations vectobsrestemp <- tapply(sdatavarwght, sstratavar, sample, replace = T, size = stratasizemone) vectobsres <- unlist(vectobsrestemp) meanvect[i] <- mean(vectobsres) i <- i + 1 } repvectboot <- rep(mean(meanvect), times = i) vb <- sum((repvectboot - meanvect)^2)/(i -1) lwrbndmnp <- quantile(meanvect, ciqntl) uppbndmnp <- quantile(meanvect, ciqntu) vb } __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help on tapply using resample as FUN element
my specific question is: I am attempting to create a bootstrap procedure for a finite sample using the theory of Rao and Wu, JASA (1988) that replicates within each strata (h) n_h - 1 times. I am able to sample n_h times using an innitial call to the resample function I suspect that it has to do with providing extra info to the FUN function but this seems to only allow one value i.e tapply(test, class, mean, trim = 0.1) i want to be able to have a different value of n for each sampler <- function(x) { sample(x, replace = T) } raoboot <- function (datavar, statavar, weight, nboot) { i <- 1 sdatavar <- sort(datavar) sstratavar <- sort(statavar) sweight <- sort(weight) sdatavarwght <- sdatavar*sweight stramn <- tapply(sdatavar, sstratavar, mean) meanvect <- rep(0, times = nboot) while (i < nboot) { #vector of resampled observations vectobsrestemp <- tapply(sdatavarwght, sstratavar, resampler) vectobsres <- unlist(vectobsrestemp) meanvect[i]<- mean(vectobsres) i <- i + 1 } repvectboot <- rep(mean(meanvect), times = i) vb <- sum((repvectboot - meanvect)^2)/(i -1) } __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.