我必须产生波松回归,因为我想使用反常的民防部队方法。 下面是,即生成数据的员额。 但是,这是以反常 c法为基础的。 该员额遵循法典
> #sample size
> n <- 10
> #regression coefficients
> beta0 <- 1
> beta1 <- 0.2
> #generate covariate values
> x <- runif(n=n, min=0, max=1.5)
> #compute mu s
> mu <- exp(beta0 + beta1 * x)
> #generate Y-values
> y <- rpois(n=n, lambda=mu)
> #data set
> data <- data.frame(y=y, x=x)
> data
I do not want to use the r built in function rpois
. I have found this post which does utilize the method only for one lambda. Now, how can I generate Poisson distribution with inverse cdf method for a variety of lambda?
N.B. This useful post provides code for variety of sample sizes, I do not want that.